diff --git a/src/formula/TimeBoundedOperator.h b/src/formula/TimeBoundedOperator.h index 779d346e6..f0f443f97 100644 --- a/src/formula/TimeBoundedOperator.h +++ b/src/formula/TimeBoundedOperator.h @@ -8,6 +8,8 @@ #ifndef TIMEBOUNDEDOPERATOR_H_ #define TIMEBOUNDEDOPERATOR_H_ +#include + #include "AbstractPathFormula.h" #include "exceptions/InvalidArgumentException.h" @@ -85,11 +87,16 @@ public: * May be used in subclasses to simplify string output. */ virtual std::string toString() const { - std::string result = "["; - result += std::to_string(lowerBound); - result += ","; - result += std::to_string(upperBound); - result += "]"; + std::string result = ""; + if (upperBound == std::numeric_limits::infinity()) { + result = ">=" + std::to_string(lowerBound); + } else { + result = "["; + result += std::to_string(lowerBound); + result += ","; + result += std::to_string(upperBound); + result += "]"; + } return result; } diff --git a/test/parser/CslParserTest.cpp b/test/parser/CslParserTest.cpp index 7b3a09cee..7bf11fcdb 100644 --- a/test/parser/CslParserTest.cpp +++ b/test/parser/CslParserTest.cpp @@ -121,10 +121,7 @@ TEST(CslParserTest, parseComplexFormulaTest) { ASSERT_NE(cslParser->getFormula(), nullptr); - //NOTE: This test case is dependent on the string output of the double value infinity. - // In g++ and clang++ on Linux, it is "inf". If some compiler (or library) uses a different output, please - // notify me and I will restructure this test case. - ASSERT_EQ("(S <= 0.500000 [P <= 0.500000 [a U c]] & (P > 0.500000 [G b] | !P < 0.400000 [G P > 0.900000 [F[7.000000,inf] (a & b)]]))", cslParser->getFormula()->toString()); + ASSERT_EQ("(S <= 0.500000 [P <= 0.500000 [a U c]] & (P > 0.500000 [G b] | !P < 0.400000 [G P > 0.900000 [F>=7.000000 (a & b)]]))", cslParser->getFormula()->toString()); delete cslParser->getFormula(); delete cslParser;