Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / src / main.cpp
diff options
context:
space:
mode:
1 files changed, 19 insertions, 2 deletions
-rw-r--r--JSImpl/src/main.cpp21
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<Token> tokens;
+ const auto& res = Tokenize("0x10", tokens);
+
+ CHECK(res.IsSuccessful && tokens[0].Type == TokenType::Number && tokens[0].Number == 16);
+}
+
+void TestScientificNotationNumber()
+{
+ IPLVector<Token> 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