diff options
Diffstat (limited to 'test-lexer.cpp')
-rw-r--r-- | test-lexer.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test-lexer.cpp b/test-lexer.cpp index 4942013..4f68fc6 100644 --- a/test-lexer.cpp +++ b/test-lexer.cpp @@ -48,10 +48,11 @@ TEST_F(Test, BNF) { std::string Top{"program"}; BNF bnf{ {"program", {{"statement-list"}}}, - {"statement-list", {{"statement", "statement-list"}, - {}, }}, - {"statement", {{"assigmnent", ";"}}}, - {"assignment", {{"identifier", "=", "identifier"}}} + {"statement-list", {{"statement-list", "statement"}, + {"statement"}, }}, + {"statement", {{"assignment", ";"}}}, + {"assignment", {{"identifier", "=", "identifier"}, + {"identifier", "=", "pp-number"}}} }; // implicit? @@ -80,15 +81,17 @@ TEST_F(Test, BNF) { auto tokens = lexer.Lex(Code); ASSERT_EQ(tokens, tokens_reference); -#if 0 +#if 1 for (const auto& i: tokens) { - std::cout << i.value << std::endl; + std::cout << i.type << ": " << i.value << std::endl; } #endif + + Lex::Lexer::PreprocessorTokensToTokens(tokens); Gram::Compiler compiler(bnf, Top); - auto Program = compiler.compile(tokens); + auto Tree = compiler.compile(tokens); - //ASSERT_EQ(Program, Program_reference); + ASSERT_TRUE(Tree.Valid(Top)); } int main(int argc, char* argv[]) { |