diff options
| Commit | 4366cb1f8e2c8c57b108e5b3f07ab451c1a7112d (patch) | |
|---|---|---|
| Author | 2018-10-21 13:18:25 +0300 | |
| Committer | 2018-10-21 13:18:25 +0300 | |
| Files | be93fa1de58ea27148d500bdbeb310c8c5b5a563 /JSImpl/src | |
| IPL-4366cb1f8e2c8c57b108e5b3f07ab451c1a7112d.tar IPL-4366cb1f8e2c8c57b108e5b3f07ab451c1a7112d.tar.gz IPL-4366cb1f8e2c8c57b108e5b3f07ab451c1a7112d.zip | ||
| Parent | 0b31a8d9326e23c9718b0d2f7dd949b06651b619 (diff) | |
Hex and exponent tests (#10)
1 files changed, 19 insertions, 2 deletions
| -rw-r--r-- | JSImpl/src/main.cpp | 21 |
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 |
