Added unit test for alternative syntax for disjunctive heads.

This commit is contained in:
Patrick Lühne 2016-11-24 17:33:19 +01:00
parent 384cd8677c
commit 25a55a6457
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 9 additions and 0 deletions

View File

@ -57,6 +57,15 @@ TEST_CASE("[translation] Rules are translated correctly", "[translation]")
REQUIRE(output.str() == "V1 in N and V2 in 1 and V3 in 2 and V4 in 3 and V5 in N and exists X1, X2 (X1 in N and X2 in (1..5) and X1 = X2) -> p(V1, V2, V3) or q(V4, V5)\n");
}
SECTION("disjunctive head (alternative syntax)")
{
// TODO: check why order of disjunctive literals is inverted
input << "q(3, N), p(N, 1, 2) :- N = 1..5.";
anthem::translate("input", input, context);
REQUIRE(output.str() == "V1 in N and V2 in 1 and V3 in 2 and V4 in 3 and V5 in N and exists X1, X2 (X1 in N and X2 in (1..5) and X1 = X2) -> p(V1, V2, V3) or q(V4, V5)\n");
}
SECTION("escaping conflicting variable names")
{
input << "p(X1, V1) :- q(X1), q(V1).";