From b0388b9b285f02047496ac13bf87ce97bd05c44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sat, 8 Apr 2017 20:22:50 +0200 Subject: [PATCH] Added example from the completion paper as unit test. --- tests/TestCompletion.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/TestCompletion.cpp b/tests/TestCompletion.cpp index a5cbbfb..29998d1 100644 --- a/tests/TestCompletion.cpp +++ b/tests/TestCompletion.cpp @@ -81,5 +81,19 @@ TEST_CASE("[completion] Rules are completed", "[completion]") CHECK(output.str() == "not h\n"); } + SECTION("example") + { + input << "{in(1..n, 1..r)}.\n" + "covered(I) :- in(I, S).\n" + ":- I = 1..n, not covered(I).\n" + ":- in(I, S), in(J, S), in(I + J, S)."; + REQUIRE_NOTHROW(anthem::translate("input", input, context)); + + CHECK(output.str() == "forall V1, V2 (in(V1, V2) <-> (V1 in 1..n and V2 in 1..r and in(V1, V2)))\n" + "forall V1 (covered(V1) <-> exists I, S (V1 = I and in(I, S)))\n" + "forall I not (I in 1..n and not covered(I))\n" + "forall I, S, J not (in(I, S) and in(J, S) and exists X5 (X5 in (I + J) and in(X5, S)))\n"); + } + // TODO: test collecting free variables }