示例#1
0
def test_string():
    a = wrap_string("foo")
    b = wrap_string("bar")
    c = intern("foo")

    assert UT.equiv(a, b) is false
    assert UT.equiv(a, c) is true

    assert UT.equiv(UT.hash(a), UT.hash(b)) is false
    assert UT.equiv(UT.hash(a), UT.hash(c)) is true
示例#2
0
def test_symbol():
    a = intern("foo")
    b = intern("bar")
    c = intern("foo", "bar")
    d = intern("foo")

    assert UT.equiv(a, b) is false
    assert UT.equiv(a, c) is false
    assert UT.equiv(a, d) is true

    assert UT.equiv(UT.hash(a), UT.hash(b)) is false
    assert UT.equiv(UT.hash(a), UT.hash(c)) is false
    assert UT.equiv(UT.hash(a), UT.hash(d)) is true