46 inline Own<TranslationUnit>
makeATU(std::string program =
".decl A,B,C(x:number)") {
54 ss << tu->getProgram();
59 auto headAtom = mk<Atom>(
"A");
60 headAtom->addArgument(std::move(headArgument));
61 auto clause = mk<Clause>();
62 clause->setHead(std::move(headAtom));
67 auto testArgument = mk<NilConstant>();
70 tu1->getProgram().addClause(
makeClauseA(std::move(testArgument)));
75 TEST(AstPrint, NumberConstant) {
76 auto testArgument = mk<NumericConstant>(
"2");
81 tu1->getProgram().addClause(
makeClauseA(std::move(testArgument)));
83 EXPECT_EQ(tu1->getProgram(), tu2->getProgram());
89 auto testArgument = mk<StringConstant>(
"test string");
92 tu1->getProgram().addClause(
makeClauseA(std::move(testArgument)));
94 EXPECT_EQ(tu1->getProgram(), tu2->getProgram());
98 auto testArgument = mk<Variable>(
"testVar");
101 tu1->getProgram().addClause(
makeClauseA(std::move(testArgument)));
107 auto testArgument = mk<UnnamedVariable>();
110 tu1->getProgram().addClause(
makeClauseA(std::move(testArgument)));
116 auto testArgument = mk<Counter>();
119 tu1->getProgram().addClause(
makeClauseA(std::move(testArgument)));
124 TEST(AstPrint, AggregatorMin) {
125 auto atom = mk<Atom>(
"B");
126 atom->addArgument(mk<Variable>(
"x"));
130 body.push_back(mk<Atom>(
"B"));
132 min->setBody(std::move(body));
135 auto& prog1 = tu1->getProgram();
138 EXPECT_EQ(tu1->getProgram(), tu2->getProgram());
141 TEST(AstPrint, AggregatorMax) {
142 auto atom = mk<Atom>(
"B");
143 atom->addArgument(mk<Variable>(
"x"));
147 body.push_back(std::move(atom));
148 max->setBody(std::move(body));
151 auto& prog1 = tu1->getProgram();
154 EXPECT_EQ(tu1->getProgram(), tu2->getProgram());
157 TEST(AstPrint, AggregatorCount) {
158 auto atom = mk<Atom>(
"B");
159 atom->addArgument(mk<Variable>(
"x"));
163 body.push_back(std::move(atom));
164 count->setBody(std::move(body));
167 auto& prog1 = tu1->getProgram();
170 EXPECT_EQ(tu1->getProgram(), tu2->getProgram());
173 TEST(AstPrint, AggregatorSum) {
174 auto atom = mk<Atom>(
"B");
175 atom->addArgument(mk<Variable>(
"x"));
179 body.push_back(std::move(atom));
180 sum->setBody(std::move(body));
183 auto& prog1 = tu1->getProgram();
186 EXPECT_EQ(tu1->getProgram(), tu2->getProgram());