From ac1f464ce3b0249af8e74cdfa9f480e70330e676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 24 Nov 2016 15:44:46 +0100 Subject: [PATCH] Added unit tests for facts and integrity constraints. --- tests/TestTranslation.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/TestTranslation.cpp b/tests/TestTranslation.cpp index 03909f8..994eeed 100644 --- a/tests/TestTranslation.cpp +++ b/tests/TestTranslation.cpp @@ -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"); + } }