def test_pick_iter(): # x & y g = x_and_y() u = 4 bits = {'x', 'y'} s = [{'x': 1, 'y': 1}] compare_iter_to_list_of_sets(u, g, s, bits) # care_bits == support (default) bits = None compare_iter_to_list_of_sets(u, g, s, bits) # # x | y g = x_or_y() u = 4 # support bits = None s = [{'x': 1, 'y': 0}, {'x': 1, 'y': 1}, {'x': 0, 'y': 1}] compare_iter_to_list_of_sets(u, g, s, bits) # only what appears along traversal bits = set() s = [{'x': 1}, {'x': 0, 'y': 1}] compare_iter_to_list_of_sets(u, g, s, bits) # bits < support bits = {'x'} s = [{'x': 1}, {'x': 0, 'y': 1}] compare_iter_to_list_of_sets(u, g, s, bits) bits = {'y'} s = [{'x': 1, 'y': 0}, {'x': 1, 'y': 1}, {'x': 0, 'y': 1}] compare_iter_to_list_of_sets(u, g, s, bits) # # x & !y g = x_and_not_y() u = -2 bits = {'x', 'y'} s = [{'x': 1, 'y': 0}] compare_iter_to_list_of_sets(u, g, s, bits) # gaps in order order = {'x': 0, 'y': 1, 'z': 2} bdd = BDD(order) u = bdd.add_expr('x & z') (m, ) = bdd.pick_iter(u) assert m == {'x': 1, 'z': 1}, m