From 4366cb1f8e2c8c57b108e5b3f07ab451c1a7112d Mon Sep 17 00:00:00 2001 From: omalinov Date: Sun, 21 Oct 2018 13:18:25 +0300 Subject: Hex and exponent tests (#10) --- JSImpl/src/main.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'JSImpl/src/main.cpp') diff --git a/JSImpl/src/main.cpp b/JSImpl/src/main.cpp index bd57ce7..cf9bf70 100644 --- a/JSImpl/src/main.cpp +++ b/JSImpl/src/main.cpp @@ -102,6 +102,22 @@ void TestParseUnaryExpr() expr->Accept(p); } +void TestHexNumber() +{ + IPLVector tokens; + const auto& res = Tokenize("0x10", tokens); + + CHECK(res.IsSuccessful && tokens[0].Type == TokenType::Number && tokens[0].Number == 16); +} + +void TestScientificNotationNumber() +{ + IPLVector tokens; + const auto& res = Tokenize("1e2", tokens); + + CHECK(res.IsSuccessful && tokens[0].Type == TokenType::Number && tokens[0].Number == 100); +} + int main() { //EXECUTE_TEST(TestLess); @@ -113,8 +129,9 @@ int main() //EXECUTE_TEST(TestStringSingleQuotedStrings); //EXECUTE_TEST(TestKeyWord); //EXECUTE_TEST(TestVariableDeclaration); - - TestParseUnaryExpr(); + EXECUTE_TEST(TestHexNumber); + EXECUTE_TEST(TestScientificNotationNumber); + // TestParseUnaryExpr(); #if defined(_WIN32) std::system("pause"); #endif -- cgit v1.3.1-23-gd82d