summaryrefslogtreecommitdiffhomepage
path: root/tests/test-cppbnf.cpp
blob: e3655740148583257c88651713c60ad4cd8bfb7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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));
}