Merge branch 'fix-comparisons' of github.com:potassco/anthem into develop

This commit is contained in:
Patrick Lühne 2017-03-28 17:21:15 +02:00
commit 67864fedbd
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
3 changed files with 13 additions and 1 deletions

View File

@ -2,6 +2,10 @@
## (unreleased) ## (unreleased)
Bug Fixes:
* fixes incorrectly simplified rules with comparisons
## 0.1.2 (2017-03-23) ## 0.1.2 (2017-03-23)
Features: Features:

View File

@ -81,7 +81,7 @@ struct ReplaceVariableInFormulaVisitor : public ast::RecursiveFormulaVisitor<Rep
static void accept(ast::Comparison &comparison, ast::Formula &, const ast::Variable &variable, const ast::Term &term) static void accept(ast::Comparison &comparison, ast::Formula &, const ast::Variable &variable, const ast::Term &term)
{ {
comparison.left.accept(ReplaceVariableInTermVisitor(), comparison.left, variable, term); comparison.left.accept(ReplaceVariableInTermVisitor(), comparison.left, variable, term);
comparison.right.accept(ReplaceVariableInTermVisitor(), comparison.left, variable, term); comparison.right.accept(ReplaceVariableInTermVisitor(), comparison.right, variable, term);
} }
static void accept(ast::In &in, ast::Formula &, const ast::Variable &variable, const ast::Term &term) static void accept(ast::In &in, ast::Formula &, const ast::Variable &variable, const ast::Term &term)

View File

@ -41,4 +41,12 @@ TEST_CASE("[simplification] Rules are simplified correctly", "[simplified]")
REQUIRE(output.str() == "((not covered(I) and I in 1..n) -> #false)\n"); REQUIRE(output.str() == "((not covered(I) and I in 1..n) -> #false)\n");
} }
SECTION("comparisons")
{
input << ":- M > N.";
anthem::translate("input", input, context);
REQUIRE(output.str() == "(M > N -> #false)\n");
}
} }