Support modulus operation (absolute value)

This adds support for computing the absolute value of a term along with
an according unit test.
This commit is contained in:
2018-04-12 00:38:48 +02:00
parent 0608748349
commit 8c250f5c59
10 changed files with 123 additions and 7 deletions

View File

@@ -184,4 +184,12 @@ TEST_CASE("[completion] Rules are completed", "[completion]")
CHECK(output.str() == "forall V1, V2 not color(V1, V2)\nforall U1, U2, U3 (not color(U1, U2) or not color(U1, U3) or U2 = U3)\n");
}
SECTION("absolute value operation")
{
input << "adj(X, Y) :- X = 1..n, Y = 1..n, |X - Y| = 1.";
anthem::translate("input", input, context);
CHECK(output.str() == "forall V1, V2 (adj(V1, V2) <-> (V1 in 1..n and V2 in 1..n and |(V1 - V2)| = 1))\n");
}
}