Esempio n. 1
0
def test_unit_clause_int_repr():
    assert find_unit_clause_int_repr(map(set, [[1]]), {}) == (1, True)
    assert find_unit_clause_int_repr(map(set, [[1], [-1]]), {}) == (1, True)
    assert find_unit_clause_int_repr([{1, 2}], {1: True}) == (2, True)
    assert find_unit_clause_int_repr([{1, 2}], {2: True}) == (1, True)
    assert find_unit_clause_int_repr(map(set,
        [[1, 2, 3], [2, -3], [1, -2]]), {1: True}) == (2, False)
    assert find_unit_clause_int_repr(map(set,
        [[1, 2, 3], [3, -3], [1, 2]]), {1: True}) == (2, True)

    A, B, C = symbols('A,B,C')
    assert find_unit_clause([A | B | C, B | ~C, A ], {}) == (A, True)
Esempio n. 2
0
def test_unit_clause():
    A, B, C = symbols('A,B,C')
    assert find_unit_clause([A], {}) == (A, True)
    assert find_unit_clause([A, ~A], {}) == (A, True)  # Wrong ??
    assert find_unit_clause([A | B], {A: True}) == (B, True)
    assert find_unit_clause([A | B], {B: True}) == (A, True)
    assert find_unit_clause(
        [A | B | C, B | ~C, A | ~B], {A: True}) == (B, False)
    assert find_unit_clause([A | B | C, B | ~C, A | B], {A: True}) == (B, True)
    assert find_unit_clause([A | B | C, B | ~C, A ], {}) == (A, True)
Esempio n. 3
0
def test_unit_clause():
    assert find_unit_clause(map(set, [[1]]), {}) == (1, True)
    assert find_unit_clause(map(set, [[1], [-1]]), {}) == (1, True)
    assert find_unit_clause([{1, 2}], {1: True}) == (2, True)
    assert find_unit_clause([{1, 2}], {2: True}) == (1, True)
    assert find_unit_clause(map(set, [[1, 2, 3], [2, -3], [1, -2]]),
                            {1: True}) == (2, False)
    assert find_unit_clause(map(set, [[1, 2, 3], [3, -3], [1, 2]]),
                            {1: True}) == (2, True)
Esempio n. 4
0
def test_unit_clause():
    assert find_unit_clause(map(set, [[1]]), {}) == (1, True)
    assert find_unit_clause(map(set, [[1], [-1]]), {}) == (1, True)
    assert find_unit_clause([{1, 2}], {1: True}) == (2, True)
    assert find_unit_clause([{1, 2}], {2: True}) == (1, True)
    assert find_unit_clause(map(set, [[1, 2, 3], [2, -3], [1, -2]]),
                            {1: True}) == (2, False)
    assert find_unit_clause(map(set, [[1, 2, 3], [3, -3], [1, 2]]),
                            {1: True}) == (2, True)
Esempio n. 5
0
def test_unit_clause():
    assert find_unit_clause([{1}], {}) == (1, True)
    assert find_unit_clause([{1}, {-1}], {}) == (1, True)
    assert find_unit_clause([{1, 2}], {1: True}) == (2, True)
    assert find_unit_clause([{1, 2}], {2: True}) == (1, True)
    assert find_unit_clause([{1, 2, 3}, {2, -3}, {1, -2}],
                            {1: True}) == (2, False)
    assert find_unit_clause([{1, 2, 3}, {3, -3}, {1, 2}],
                            {1: True}) == (2, True)