diff options
| Commit | 359511c5a6db875b62f78e21dca557b15501e879 (patch) | |
|---|---|---|
| Author | 2022-10-12 21:08:33 +0300 | |
| Committer | 2022-10-12 21:16:29 +0300 | |
| Files | 7622d6cd2ad07e4183a8ba8b5d1283a85075ed56 /JSImpl | |
| IPL-359511c5a6db875b62f78e21dca557b15501e879.tar IPL-359511c5a6db875b62f78e21dca557b15501e879.tar.gz IPL-359511c5a6db875b62f78e21dca557b15501e879.zip | ||
| Parent | bd94e293e7f59b527d900d9e6a277672f13a6630 (diff) | |
Fixed build with GCC
2 files changed, 8 insertions, 3 deletions
| -rw-r--r-- | JSImpl/src/ASTInterpreter.h | 2 | ||||
| -rw-r--r-- | JSImpl/test/ASTInterpreterTests.cpp | 9 |
diff --git a/JSImpl/src/ASTInterpreter.h b/JSImpl/src/ASTInterpreter.h index 0c2c776..a17399b 100644 --- a/JSImpl/src/ASTInterpreter.h +++ b/JSImpl/src/ASTInterpreter.h @@ -11,7 +11,7 @@ public: ~ASTInterpreter(); - typedef std::variant<double, IPLString> Value; + typedef std::variant<bool, double, IPLString> Value; typedef IPLSharedPtr<Value> ValuePtr; typedef IPLVector<ValuePtr> ValueStack; diff --git a/JSImpl/test/ASTInterpreterTests.cpp b/JSImpl/test/ASTInterpreterTests.cpp index e8cf282..d431de0 100644 --- a/JSImpl/test/ASTInterpreterTests.cpp +++ b/JSImpl/test/ASTInterpreterTests.cpp @@ -25,6 +25,11 @@ struct ASTInterpret : ::testing::Test return std::get<double>(*Interpreter.ModifyVariable(name)); } + bool ValueAsBool(const char* name) + { + return std::get<bool>(*Interpreter.ModifyVariable(name)); + } + IPLString ValueAsString(const char* name) { return std::get<IPLString>(*Interpreter.ModifyVariable(name)); @@ -61,14 +66,14 @@ TEST_F(ASTInterpret, LessNumber) { Run("var answer = 6 < 7"); ASSERT_TRUE(HasVariable("answer")); - ASSERT_DOUBLE_EQ(ValueAsNumber("answer"), 1.0); + ASSERT_TRUE(ValueAsBool("answer")); } TEST_F(ASTInterpret, LessString) { Run("var name = 'John' < 'Doe'"); ASSERT_TRUE(HasVariable("name")); - ASSERT_DOUBLE_EQ(ValueAsNumber("name"), 0.0); + ASSERT_FALSE(ValueAsBool("name")); } TEST_F(ASTInterpret, StringLessNumber) |
