Added unit tests for facts and integrity constraints.

This commit is contained in:
Patrick Lühne 2016-11-24 15:44:46 +01:00
parent cdfdd8f4ca
commit ac1f464ce3
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 16 additions and 0 deletions

View File

@ -64,4 +64,20 @@ TEST_CASE("[translation] Rules are translated correctly", "[translation]")
REQUIRE(output.str() == "V1 in _X1 and V2 in _V1 and exists X1 (X1 in _X1 and q(X1)) and exists X2 (X2 in _V1 and q(X2)) -> p(V1, V2)\n");
}
SECTION("fact")
{
input << "p(42).";
anthem::translate("input", input, context);
REQUIRE(output.str() == "V1 in 42 -> p(V1)\n");
}
SECTION("integrity constraint")
{
input << ":- p(42).";
anthem::translate("input", input, context);
REQUIRE(output.str() == "exists X1 (X1 in 42 and p(X1)) -> #false\n");
}
}