diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-10-24 16:32:18 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-10-24 16:32:18 +0200 |
commit | 1011655d2ef76a0c0aa29dbbff091dab139198e3 (patch) | |
tree | 63763828f259846f56285691805c187583ecb6bb /tests/test-lexer.cpp | |
parent | 1349c00b782eca3ea841bfa388301cb6fc908cc7 (diff) |
Add FlowGraph
Diffstat (limited to 'tests/test-lexer.cpp')
-rw-r--r-- | tests/test-lexer.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
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 <boost/algorithm/string.hpp> + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include <algorithm> +#include <cctype> +#include <deque> +#include <map> +#include <memory> +#include <string> +#include <utility> +#include <vector> + +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<Token> tokens{lexer.Lex("int main() { return 1; }")}; + + ASSERT_EQ(tokens.size(), 9); +} |