diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-03-15 18:19:49 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-03-15 18:19:49 +0100 |
commit | 9f69b006dde3c3fbe19ed3e0275d3b7348f2aa87 (patch) | |
tree | 6ac42793568339463f913cf39474794c8613d0b6 /test-lexer.cpp | |
parent | 3a7006fcf5f8ecffd852fbba6d8ee03ce8a35dce (diff) |
New lexer
Diffstat (limited to 'test-lexer.cpp')
-rw-r--r-- | test-lexer.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/test-lexer.cpp b/test-lexer.cpp index a94e550..9f1cb77 100644 --- a/test-lexer.cpp +++ b/test-lexer.cpp @@ -1,5 +1,6 @@ #include "bnf.h" #include "cpp.h" +#include "cppbnf.h" #include "lexer.h" #include "grammer.h" #include "minicc.h" @@ -19,14 +20,20 @@ #include <utility> #include <vector> -class Test: public ::testing::Test { +class LexerTest: public ::testing::Test { protected: - Test(){ + LexerTest(){ debug = false; } - ~Test() override {} + ~LexerTest() override {} }; -TEST_F(Test, BNF) { -} +TEST_F(LexerTest, Lex) { + auto bnf{SubBNF(GetCppBNFLex(), "preprocessing-token")}; + + Lex::Lexer lexer(bnf, "preprocessing-token"); + std::vector<Token> tokens{lexer.Lex("int main() { return 1; }")}; + + ASSERT_EQ(tokens.size(), 9); +} |