summaryrefslogtreecommitdiffhomepage
path: root/test-lexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test-lexer.cpp')
-rw-r--r--test-lexer.cpp17
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);
+}