Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / test / ASTInterpreterTests.cpp
diff options
context:
space:
mode:
Commit359511c5a6db875b62f78e21dca557b15501e879 (patch)
Author
 Dimitar Trendafilov <trendafilov.dn@gmail.com>
2022-10-12 21:08:33 +0300
Committer
 Dimitar Trendafilov <trendafilov.dn@gmail.com>
2022-10-12 21:16:29 +0300
Files7622d6cd2ad07e4183a8ba8b5d1283a85075ed56 /JSImpl/test/ASTInterpreterTests.cpp
IPL-359511c5a6db875b62f78e21dca557b15501e879.tar
IPL-359511c5a6db875b62f78e21dca557b15501e879.tar.gz
IPL-359511c5a6db875b62f78e21dca557b15501e879.zip
Parentbd94e293e7f59b527d900d9e6a277672f13a6630 (diff)
Fixed build with GCC
1 files changed, 7 insertions, 2 deletions
-rw-r--r--JSImpl/test/ASTInterpreterTests.cpp9
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)