43
43
namespace souffle ::ast::test {
44
44
45
45
inline Own<TranslationUnit> makeATU (std::string program) {
46
+ Global glb;
46
47
ErrorReport e;
47
- DebugReport d;
48
- return ParserDriver::parseTranslationUnit (program, e, d);
48
+ DebugReport d (glb) ;
49
+ return ParserDriver::parseTranslationUnit (glb, program, e, d);
49
50
}
50
51
51
52
inline Own<Clause> makeClause (std::string name, Own<Argument> headArgument) {
@@ -56,16 +57,17 @@ inline Own<Clause> makeClause(std::string name, Own<Argument> headArgument) {
56
57
}
57
58
58
59
TEST (Program, Parse) {
60
+ Global glb;
59
61
ErrorReport e;
60
- DebugReport d;
62
+ DebugReport d (glb) ;
61
63
// check the empty program
62
- Own<TranslationUnit> empty = ParserDriver::parseTranslationUnit (" " , e, d);
64
+ Own<TranslationUnit> empty = ParserDriver::parseTranslationUnit (glb, " " , e, d);
63
65
64
66
EXPECT_TRUE (empty->getProgram ().getTypes ().empty ());
65
67
EXPECT_TRUE (empty->getProgram ().getRelations ().empty ());
66
68
67
69
// check something simple
68
- Own<TranslationUnit> tu = ParserDriver::parseTranslationUnit (
70
+ Own<TranslationUnit> tu = ParserDriver::parseTranslationUnit (glb,
69
71
R"(
70
72
.type Node <: symbol
71
73
.decl e ( a : Node , b : Node )
@@ -87,16 +89,17 @@ TEST(Program, Parse) {
87
89
EXPECT_FALSE (prog.getRelation (" n" ));
88
90
}
89
91
90
- #define TESTASTCLONEANDEQUAL (SUBTYPE, DL ) \
91
- TEST (Ast, CloneAndEqual##SUBTYPE) { \
92
- ErrorReport e; \
93
- DebugReport d; \
94
- Own<TranslationUnit> tu = ParserDriver::parseTranslationUnit (DL, e, d); \
95
- Program& program = tu->getProgram (); \
96
- EXPECT_EQ (program, program); \
97
- Own<Program> cl (clone (program)); \
98
- EXPECT_NE (cl.get (), &program); \
99
- EXPECT_EQ (*cl, program); \
92
+ #define TESTASTCLONEANDEQUAL (SUBTYPE, DL ) \
93
+ TEST (Ast, CloneAndEqual##SUBTYPE) { \
94
+ Global glb; \
95
+ ErrorReport e; \
96
+ DebugReport d (glb); \
97
+ Own<TranslationUnit> tu = ParserDriver::parseTranslationUnit (glb, DL, e, d); \
98
+ Program& program = tu->getProgram (); \
99
+ EXPECT_EQ (program, program); \
100
+ Own<Program> cl (clone (program)); \
101
+ EXPECT_NE (cl.get (), &program); \
102
+ EXPECT_EQ (*cl, program); \
100
103
}
101
104
102
105
TESTASTCLONEANDEQUAL (Program,
0 commit comments