Enforcing unit tests not to throw exceptions.

This commit is contained in:
2017-04-08 19:59:59 +02:00
parent a1648e27c9
commit 2ae5cfbfa6
3 changed files with 86 additions and 82 deletions

View File

@@ -21,9 +21,9 @@ TEST_CASE("[completion] Rules are completed", "[completion]")
SECTION("predicte in single rule head")
{
input << "p :- q.";
anthem::translate("input", input, context);
REQUIRE_NOTHROW(anthem::translate("input", input, context));
REQUIRE(output.str() == "(p <-> q)\n");
CHECK(output.str() == "(p <-> q)\n");
}
SECTION("predicate in multiple rule heads")
@@ -31,9 +31,9 @@ TEST_CASE("[completion] Rules are completed", "[completion]")
input << "p :- q.\n"
"p :- r.\n"
"p :- s.";
anthem::translate("input", input, context);
REQUIRE_NOTHROW(anthem::translate("input", input, context));
REQUIRE(output.str() == "(p <-> (q or r or s))\n");
CHECK(output.str() == "(p <-> (q or r or s))\n");
}
SECTION("multiple predicates are correctly separated")
@@ -43,26 +43,30 @@ TEST_CASE("[completion] Rules are completed", "[completion]")
"p :- q.\n"
"r :- t.\n"
"q :- r.";
anthem::translate("input", input, context);
REQUIRE_NOTHROW(anthem::translate("input", input, context));
REQUIRE(output.str() == "(p <-> (s or q))\n(q <-> (t or r))\n(r <-> t)\n");
CHECK(output.str() == "(p <-> (s or q))\n(q <-> (t or r))\n(r <-> t)\n");
}
SECTION("integrity constraints")
{
input << ":- q.\n"
":- s(5).";
anthem::translate("input", input, context);
":- s(5).\n"
"#false :- t\n"
"#false :- v(5).";
REQUIRE_NOTHROW(anthem::translate("input", input, context));
REQUIRE(output.str() == "not q\nnot s(5)\n");
CHECK(output.str() == "not q\nnot s(5)\nnot t\nnot v(5)");
}
SECTION("facts")
{
input << "q.\n"
"r.";
anthem::translate("input", input, context);
"r.\n"
"t :- #true.\n"
"s :- #true.";
REQUIRE_NOTHROW(anthem::translate("input", input, context));
REQUIRE(output.str() == "(q <-> #true)\n(r <-> #true)\n");
CHECK(output.str() == "q\nr\nt\ns\n");
}
}