From 1011655d2ef76a0c0aa29dbbff091dab139198e3 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 24 Oct 2020 16:32:18 +0200 Subject: Add FlowGraph --- tests/test-lexer.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/test-lexer.cpp (limited to 'tests/test-lexer.cpp') diff --git a/tests/test-lexer.cpp b/tests/test-lexer.cpp new file mode 100644 index 0000000..23983f1 --- /dev/null +++ b/tests/test-lexer.cpp @@ -0,0 +1,39 @@ +#include "bnf.h" +#include "cpp.h" +#include "cppbnf.h" +#include "lexer.h" +#include "grammer.h" +#include "minicc.h" +#include "debug.h" + +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +class LexerTest: public ::testing::Test { +protected: + LexerTest(){ + debug = false; + } + ~LexerTest() override {} +}; + +TEST_F(LexerTest, Lex) { + auto bnf{SubBNF(CPPBNF::GetCppBNFLex(), "preprocessing-token")}; + + Lex::Lexer lexer(bnf, "preprocessing-token"); + + std::vector tokens{lexer.Lex("int main() { return 1; }")}; + + ASSERT_EQ(tokens.size(), 9); +} -- cgit v1.2.3