Extended unit tests related to facts and integrity constraints.

This commit is contained in:
Patrick Lühne 2016-11-24 17:45:22 +01:00
parent 6167a83a99
commit f11097180a
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 33 additions and 1 deletions

View File

@ -90,7 +90,39 @@ TEST_CASE("[translation] Rules are translated correctly", "[translation]")
REQUIRE(output.str() == "#true -> p\n");
}
SECTION("integrity constraint")
SECTION("disjunctive fact (no arguments)")
{
input << "q; p.";
anthem::translate("input", input, context);
REQUIRE(output.str() == "#true -> p or q\n");
}
SECTION("disjunctive fact (arguments)")
{
input << "q; p(42).";
anthem::translate("input", input, context);
REQUIRE(output.str() == "V1 in 42 -> p(V1) or q\n");
}
SECTION("integrity constraint (no arguments)")
{
input << ":- p, q.";
anthem::translate("input", input, context);
REQUIRE(output.str() == "p and q -> #false\n");
}
SECTION("contradiction")
{
input << ":-.";
anthem::translate("input", input, context);
REQUIRE(output.str() == "#true -> #false\n");
}
SECTION("integrity constraint (arguments)")
{
input << ":- p(42), q.";
anthem::translate("input", input, context);