Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / test / ASTInterpreterTests.cpp
diff options
context:
space:
mode:
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)