Added unit test that predicate arity is respected by #show statements.

This commit is contained in:
Patrick Lühne 2017-06-05 04:00:09 +02:00
parent 7ae0a1f289
commit 19ede968ed
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -123,4 +123,18 @@ TEST_CASE("[hidden predicate elimination] Hidden predicates are correctly elimin
"forall V1 (a(V1) <-> #true)\n"
"forall V2 (b(V2) <-> #false)\n");
}
SECTION("predicate arity is respected")
{
input <<
"a(X) :- a(X, Y).\n"
"a(X, Y) :- a(X, Y, Z).\n"
"a(1, 2, 3).\n"
"a(2, 4, 6).\n"
"#show a/2.";
anthem::translate("input", input, context);
CHECK(output.str() ==
"forall V1, V2 (a(V1, V2) <-> exists U1 ((V1 = 1 and V2 = 2 and U1 = 3) or (V1 = 2 and V2 = 4 and U1 = 6)))\n");
}
}