Пример #1
0
def test_term():
    X = Var()
    Y = Var()
    t1 = Term("f", [Atom.newatom("hallo"), X])
    t2 = Term("f", [Y, Atom.newatom("HALLO")])
    heap = Heap()
    print t1, t2
    t1.unify(t2, heap)
    assert X.getvalue(heap).name == "HALLO"
    assert Y.getvalue(heap).name == "hallo"
Пример #2
0
def test_var():
    b = Var()
    heap = Heap()
    b.unify(Atom.newatom("hallo"), heap)
    assert b.getvalue(heap).name == "hallo"
    a = Var()
    b = Var()
    a.unify(b, heap)
    a.unify(Atom.newatom("hallo"), heap)
    assert a.getvalue(heap).name == "hallo"
    assert b.getvalue(heap).name == "hallo"