Beispiel #1
0
def test_ifte_disj():
    x, y = variables("x, y")
    goal = ifte(disj(same(True, x), same(False, x)), same(False, y),
                same(True, y))
    assert list(goal(Substitution())) == [
        Substitution({
            x: True,
            y: False
        }),
        Substitution({
            x: False,
            y: False
        })
    ]
Beispiel #2
0
def test_ifte_g2_suspended():
    y = variables("y")
    goal = ifte(fail, same(False, y), suspend(same(True, y)))
    s_inf = goal(Substitution())
    s_inf = assert_suspended(s_inf)
    assert list(s_inf) == [Substitution({y: True})]
Beispiel #3
0
def test_ifte_cond_suspended():
    y = variables("y")
    goal = ifte(suspend(succeed), same(False, y), same(True, y))
    s_inf = goal(Substitution())
    s_inf = assert_suspended(s_inf)
    assert list(s_inf) == [Substitution({y: False})]
Beispiel #4
0
def test_ifte_FAIL():
    y = variables("y")
    goal = ifte(fail, same(False, y), same(True, y))
    assert list(goal(Substitution())) == [Substitution({y: True})]
Beispiel #5
0
def test_ifte_succeed():
    y = variables("y")
    goal = ifte(succeed, same(False, y), same(True, y))
    assert list(goal(Substitution())) == [Substitution({y: False})]