summaryrefslogtreecommitdiffhomepage
path: root/test-cppbnf.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-03-21 16:06:47 +0100
committerRoland Reichwein <mail@reichwein.it>2020-03-21 16:06:47 +0100
commitcdf001920fde6652b344775589b0524ff6529809 (patch)
tree883ab6232a4c4ca4056b123bff7c7d1cd98c5cf4 /test-cppbnf.cpp
parent3cc139bce0283018473d4906ee2ea5f40f771255 (diff)
Added Gram::Compiler to CPP (WIP)
Diffstat (limited to 'test-cppbnf.cpp')
-rw-r--r--test-cppbnf.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/test-cppbnf.cpp b/test-cppbnf.cpp
new file mode 100644
index 0000000..e365574
--- /dev/null
+++ b/test-cppbnf.cpp
@@ -0,0 +1,45 @@
+#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 CppBnfTest: public ::testing::Test
+{
+protected:
+ CppBnfTest() {
+ //debug = true;
+ }
+ ~CppBnfTest() {
+ }
+};
+
+TEST_F(CppBnfTest, LexicalBnf) {
+ auto bnf = SubBNF(CPPBNF::GetCppBNFLex(), "preprocessing-token");
+
+ EXPECT_TRUE(CPPBNF::valid(bnf));
+ EXPECT_TRUE(CPPBNF::validLex(bnf));
+}
+
+TEST_F(CppBnfTest, GrammarBnf) {
+ auto bnf = SubBNF(CPPBNF::GetCppBNFGram(), "translation-unit");
+
+ EXPECT_TRUE(CPPBNF::valid(bnf));
+}
+