From f11097180a435fe238a0cd7b95e0da06cb8dc8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 24 Nov 2016 17:45:22 +0100 Subject: [PATCH] Extended unit tests related to facts and integrity constraints. --- tests/TestTranslation.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tests/TestTranslation.cpp b/tests/TestTranslation.cpp index 4102163..99fd2df 100644 --- a/tests/TestTranslation.cpp +++ b/tests/TestTranslation.cpp @@ -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);