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 }) ]
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})]
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})]
def test_ifte_FAIL(): y = variables("y") goal = ifte(fail, same(False, y), same(True, y)) assert list(goal(Substitution())) == [Substitution({y: True})]
def test_ifte_succeed(): y = variables("y") goal = ifte(succeed, same(False, y), same(True, y)) assert list(goal(Substitution())) == [Substitution({y: False})]