Fixed incorrect output of #sup and added unit test.

This commit is contained in:
Patrick Lühne 2016-11-24 15:51:25 +01:00
parent 790162532e
commit faf6cd0f6c
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 9 additions and 1 deletions

View File

@ -49,7 +49,7 @@ ColorStream &operator<<(ColorStream &stream, const Clingo::Symbol &symbol)
case Clingo::SymbolType::Infimum: case Clingo::SymbolType::Infimum:
return (stream << Keyword("#inf")); return (stream << Keyword("#inf"));
case Clingo::SymbolType::Supremum: case Clingo::SymbolType::Supremum:
return (stream << Keyword("sup")); return (stream << Keyword("#sup"));
case Clingo::SymbolType::Number: case Clingo::SymbolType::Number:
return (stream << Number<decltype(symbol.number())>(symbol.number())); return (stream << Number<decltype(symbol.number())>(symbol.number()));
case Clingo::SymbolType::String: case Clingo::SymbolType::String:

View File

@ -88,4 +88,12 @@ TEST_CASE("[translation] Rules are translated correctly", "[translation]")
REQUIRE(output.str() == "exists X1 (X1 in 42 and p(X1)) -> #false\n"); REQUIRE(output.str() == "exists X1 (X1 in 42 and p(X1)) -> #false\n");
} }
SECTION("inf/sup")
{
input << "p(X, #inf) :- q(X, #sup).";
anthem::translate("input", input, context);
REQUIRE(output.str() == "V1 in X and V2 in #inf and exists X1, X2 (X1 in X and X2 in #sup and q(X1, X2)) -> p(V1, V2)\n");
}
} }