Skip to content

Commit

Permalink
Remove requirement that DNF/CNF is simple
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdrake committed Mar 1, 2015
1 parent 65b3308 commit 95c9328
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions extension/boolexpr/boolexpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,6 @@ BoolExpr_OpCount(struct BoolExpr *ex)
bool
BoolExpr_IsDNF(struct BoolExpr *ex)
{
if (!IS_SIMPLE(ex))
return false;

if (IS_ZERO(ex) || IS_LIT(ex)) {
return true;
}
Expand All @@ -586,9 +583,6 @@ BoolExpr_IsDNF(struct BoolExpr *ex)
bool
BoolExpr_IsCNF(struct BoolExpr *ex)
{
if (!IS_SIMPLE(ex))
return false;

if (IS_ONE(ex) || IS_LIT(ex)) {
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions extension/boolexpr/test/test_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ TEST_F(BoolExprTest, IsCnfDnf)

// OR clause
ops[0] = OrN(2, xns[0], xs[1], xns[2], xs[3]);
EXPECT_FALSE(BoolExpr_IsDNF(ops[0])); // not simple
EXPECT_FALSE(BoolExpr_IsCNF(ops[0])); // not simple
EXPECT_TRUE(BoolExpr_IsDNF(ops[0]));
EXPECT_TRUE(BoolExpr_IsCNF(ops[0]));
ops[1] = BoolExpr_Simplify(ops[0]);
EXPECT_TRUE(BoolExpr_IsDNF(ops[1]));
EXPECT_TRUE(BoolExpr_IsCNF(ops[1]));

// AND clause
ops[2] = AndN(2, xns[0], xs[1], xns[2], xs[3]);
EXPECT_FALSE(BoolExpr_IsDNF(ops[2])); // not simple
EXPECT_FALSE(BoolExpr_IsCNF(ops[2])); // not simple
EXPECT_TRUE(BoolExpr_IsDNF(ops[2]));
EXPECT_TRUE(BoolExpr_IsCNF(ops[2]));
ops[3] = BoolExpr_Simplify(ops[2]);
EXPECT_TRUE(BoolExpr_IsDNF(ops[3]));
EXPECT_TRUE(BoolExpr_IsCNF(ops[3]));
Expand Down

0 comments on commit 95c9328

Please sign in to comment.