Skip to content

Commit

Permalink
Added unit test for equivalent clause removal.
Browse files Browse the repository at this point in the history
  • Loading branch information
azreika committed Nov 23, 2020
1 parent 57612d9 commit 4c565f9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ast/tests/ast_utils_test.cpp
Expand Up @@ -169,5 +169,27 @@ TEST(AstUtils, ReorderClauseAtoms) {
toString(*reorderedClause1));
}

TEST(AstUtils, RemoveEquivalentClauses) {
ErrorReport e;
DebugReport d;

Own<TranslationUnit> tu = ParserDriver::parseTranslationUnit(
R"(
.decl a()
a(). a(). a(). a(). a(). a(). a(). a(). a(). a(). a(). a(). a(). a(). a().
)",
e, d);

Program& program = tu->getProgram();
EXPECT_EQ(1, program.getRelations().size());

Relation* a = getRelation(program, "a");
EXPECT_NE(a, nullptr);
EXPECT_EQ(15, getClauses(program, *a).size());

removeRelationClauses(*tu, "a");
EXPECT_EQ(0, getClauses(program, *a).size());
}

} // namespace test
} // namespace souffle::ast

0 comments on commit 4c565f9

Please sign in to comment.