From: Mike D. Lowis Date: Tue, 3 Apr 2012 19:54:40 +0000 (-0400) Subject: Added tests for recognizing numbers X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=0f394f9bffe6d5d553b92947b4dae2abd5cb1288;p=archive%2Fdlang.git Added tests for recognizing numbers --- diff --git a/tests/test_dllexer.cpp b/tests/test_dllexer.cpp index 03b4899..b67d739 100644 --- a/tests/test_dllexer.cpp +++ b/tests/test_dllexer.cpp @@ -95,7 +95,21 @@ namespace { TEST(Recognize_Valid_Numbers) { - CHECK(false); + std::string input( + // Recognize all of the digits + "0 1 2 3 4 5 6 7 8 9\n" + // Recognize combinations of digits + "10 11 12 13 14 15 16 17 18 19\n" + // Recognize floating point numbers (with and without exponents) + "1.0 -1.0 0.1e1 10.0e-1" + ); + eTokenTypes expected[] = { + NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, + NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, + NUM, NUM, NUM, NUM, + (eTokenTypes)EOF + }; + TestLexerWithInput( input, expected ); } TEST(Recognize_Valid_Characters)