From 0f394f9bffe6d5d553b92947b4dae2abd5cb1288 Mon Sep 17 00:00:00 2001 From: "Mike D. Lowis" Date: Tue, 3 Apr 2012 15:54:40 -0400 Subject: [PATCH] Added tests for recognizing numbers --- tests/test_dllexer.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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) -- 2.52.0