def test_to_expr(): bdd = _bdd.BDD() bdd.declare('x', 'y') u = bdd.add_expr('x') s = bdd.to_expr(u) assert s == 'x', s u = bdd.add_expr('x /\ y') s = bdd.to_expr(u) assert s == 'ite(x, y, FALSE)', s
def test_copy_bdd(): bdd = _bdd.BDD() other = _bdd.BDD() bdd.declare('x') other.declare('x') u = bdd.var('x') v = _bdd.copy_bdd(u, other) v_ = other.var('x') assert v == v_, other.to_expr(v) # involution u_ = _bdd.copy_bdd(v, bdd) assert u == u_, bdd.to_expr(u_)