Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / test / ParserTests.cpp
diff options
context:
space:
mode:
Commitf8ccf5eedb60435b7fac66521554beab582c0b00 (patch)
Author
 alexvitkov <44268717+alexvitkov@users.noreply.github.com>
2020-10-24 17:58:54 +0300
Committer
 GitHub <noreply@github.com>
2020-10-24 17:58:54 +0300
Filescbee6e087ffc49463c69553c9505f4b9a7baa5ce /JSImpl/test/ParserTests.cpp
IPL-f8ccf5eedb60435b7fac66521554beab582c0b00.tar
IPL-f8ccf5eedb60435b7fac66521554beab582c0b00.tar.gz
IPL-f8ccf5eedb60435b7fac66521554beab582c0b00.zip
Parentd5fd7629fc6b85df0f27f3069bffef407a94cef8 (diff)
JSImpl: Implemented ASTInterpreter::Visit for unary + and - (#87)
* JSImpl: Implemented ASTInterpreter::Visit for unary + and - * JSImpl: Added tests for unary + and - * JSImpl: fixed appveyor ubuntu build Co-authored-by: Martin Dobrev <martindobrev0@gmail.com>
1 files changed, 3 insertions, 1 deletions
-rw-r--r--JSImpl/test/ParserTests.cpp4
diff --git a/JSImpl/test/ParserTests.cpp b/JSImpl/test/ParserTests.cpp
index 91534c5..8bdfb8c 100644
--- a/JSImpl/test/ParserTests.cpp
+++ b/JSImpl/test/ParserTests.cpp
@@ -103,7 +103,7 @@ TEST(Parser, VariableDeclarationMultiplicationOfVariables)
TEST(Parser, Unary)
{
- IPLVector<Token> tokens = Tokenize("var a = 5; a++; var b = 6; --b;").tokens;
+ IPLVector<Token> tokens = Tokenize("var a = 5; a++; var b = 6; --b; var minusB = -b; var plusB = +b;").tokens;
auto expr = Parse(tokens);
std::ostringstream output;
@@ -113,6 +113,8 @@ TEST(Parser, Unary)
ASSERT_TRUE(i.HasVariable("b"));
ASSERT_DOUBLE_EQ(i.ModifyVariable("a"), 6.0);
ASSERT_DOUBLE_EQ(i.ModifyVariable("b"), 5.0);
+ ASSERT_DOUBLE_EQ(i.ModifyVariable("minusB"), -5.0);
+ ASSERT_DOUBLE_EQ(i.ModifyVariable("plusB"), +5.0);
}