From 3393f84a4a27854009a515fb2a63f7df10b223ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 3 May 2018 16:57:19 +0200 Subject: [PATCH] Add unit tests covering equality checks The equality check is used within a simplification rule that turns biconditionals into simple implications in special cases. This adds some unit tests that cover this simplification rule as well as the equality check implementation. --- tests/TestSimplification.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/TestSimplification.cpp b/tests/TestSimplification.cpp index 9ec60fa..b760c12 100644 --- a/tests/TestSimplification.cpp +++ b/tests/TestSimplification.cpp @@ -50,4 +50,34 @@ TEST_CASE("[simplification] Rules are simplified correctly", "[simplification]") CHECK(output.str() == "(U1 > U2 -> #false)\n"); } + + SECTION("biconditionals are replaced with implifactions with choice rules") + { + context.performCompletion = true; + + input << "{p(a)}."; + anthem::translate("input", input, context); + + CHECK(output.str() == "forall V1 (p(V1) -> V1 = a)\n"); + } + + SECTION("biconditionals are replaced with implifactions with complicated choice rules") + { + context.performCompletion = true; + + input << "{p(n + 5)}."; + anthem::translate("input", input, context); + + CHECK(output.str() == "forall V1 (p(V1) -> V1 in (n + 5))\n"); + } + + SECTION("biconditionals are not replaced with implifactions with nonchoice rules") + { + context.performCompletion = true; + + input << "p(a)."; + anthem::translate("input", input, context); + + CHECK(output.str() == "forall V1 (p(V1) <-> V1 = a)\n"); + } }