From 359511c5a6db875b62f78e21dca557b15501e879 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Wed, 12 Oct 2022 21:08:33 +0300 Subject: Fixed build with GCC --- JSImpl/src/ASTInterpreter.h | 2 +- JSImpl/test/ASTInterpreterTests.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'JSImpl') 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 Value; + typedef std::variant Value; typedef IPLSharedPtr ValuePtr; typedef IPLVector 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(*Interpreter.ModifyVariable(name)); } + bool ValueAsBool(const char* name) + { + return std::get(*Interpreter.ModifyVariable(name)); + } + IPLString ValueAsString(const char* name) { return std::get(*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) -- cgit v1.3.1-23-gd82d