Skip to content

Commit

Permalink
Fix issue #121, Equal(1, a, b) is wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdrake committed Jun 5, 2015
1 parent b3d2b65 commit 7eabd8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions extension/boolexpr/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,9 @@ _eq_simplify(struct BoolExpr *op)
else if (uniq_len == 1) {
y = BoolExpr_IncRef(uniq[0]);
}
/* Equal(1, x0, ...) <=> Nand(x0, ...) */
/* Equal(1, x0, ...) <=> And(x0, ...) */
else {
struct BoolExpr *temp;
CHECK_NULL(temp, _simple_op(OP_AND, uniq_len, uniq));
CHECK_NULL_1(y, Not(temp), temp);
BoolExpr_DecRef(temp);
CHECK_NULL(y, _simple_op(OP_AND, uniq_len, uniq));
}
}
else {
Expand Down
4 changes: 2 additions & 2 deletions extension/boolexpr/test/test_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ TEST_F(BoolExprSimpleTest, EqualCases)
exps[0] = NorN(2, xs[0], xs[1]);
EXPECT_TRUE(Similar(ops[7], exps[0]));

// eq(1, x0, x1) <=> Nand(x0, x1)
// eq(1, x0, x1) <=> And(x0, x1)
ops[8] = EqualN(3, &One, xs[0], xs[1]);
ops[9] = BoolExpr_Simplify(ops[8]);
exps[1] = NandN(2, xs[0], xs[1]);
exps[1] = AndN(2, xs[0], xs[1]);
EXPECT_TRUE(Similar(ops[9], exps[1]));

// eq(x1, x0, x1, x0) <=> x0 = x1
Expand Down

0 comments on commit 7eabd8b

Please sign in to comment.