From 7904b41e60a5a73104c076487f6d4bc122f4d5fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Mon, 5 Jun 2017 03:34:13 +0200 Subject: [PATCH] Added unit test covering circular dependencies with #show statements. --- tests/TestHiddenPredicateElimination.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/TestHiddenPredicateElimination.cpp b/tests/TestHiddenPredicateElimination.cpp index 12d4377..dff0849 100644 --- a/tests/TestHiddenPredicateElimination.cpp +++ b/tests/TestHiddenPredicateElimination.cpp @@ -91,4 +91,19 @@ TEST_CASE("[hidden predicate elimination] Hidden predicates are correctly elimin "forall V3 (c(V3) <-> (V3 = 1 or V3 = 2))\n" "forall V4 not d(V4)\n"); } + + SECTION("circular dependencies cannot be fully removed") + { + input << + "a(X) :- b(X).\n" + "b(X) :- not c(X).\n" + "c(X) :- d(X).\n" + "d(X) :- not b(X).\n" + "#show a/1."; + anthem::translate("input", input, context); + + CHECK(output.str() == + "forall V1 (a(V1) <-> not d(V1))\n" + "forall V2 (d(V2) <-> not not d(V2))\n"); + } }