def test_set():
    skiplist = SkiplistList()
    assert skiplist.add(0, 10) == True
    assert skiplist.add(1, 20) == True
    assert skiplist.add(2, 10) == True
    assert skiplist.add(3, 40) == True
    assert skiplist.add(1, 40) == True
    assert skiplist.set(0, 11) == True
    assert skiplist.get(0) == 11
    assert skiplist.set(2, 22) == True
    assert skiplist.get(2) == 22
    assert skiplist.set(3, 44) == True
    assert skiplist.get(3) == 44
    assert skiplist.set(2, 25) == True
    assert skiplist.get(2) == 25
예제 #2
0
def test_set():  ###
    skiplist = SkiplistList()
    assert skiplist.add(0, 10) == True
    assert skiplist.add(1, 20) == True
    assert skiplist.add(2, 10) == True
    assert skiplist.add(3, 40) == True
    assert skiplist.add(1, 40) == True
    assert skiplist.set(0, 11) == True
    assert skiplist.get(0) == 11
    assert skiplist.set(2, 22) == True
    assert skiplist.get(2) == 22
    assert skiplist.set(3, 44) == True
    assert skiplist.get(3) == 44
    assert skiplist.set(2, 25) == True
    assert skiplist.get(2) == 25
    assert skiplist.dummy.back.data == 40