예제 #1
0
def test_selfbalancing():
    size = 200000
    import random
    random.seed(1)
    randvals = [random.randint(1, 10000000) for x in range(size)]

    vt = VariantTree()
    for i,x in enumerate(randvals):
        vt.set_item(x,1)
        if i % 1000 == 0:
            assert vt.verify()

    random.shuffle(randvals)

    for i,x in enumerate(randvals):
        vt.clear_item(x)
        if i % 1000 == 0:
            assert vt.verify()