예제 #1
0
def test_query_none():
    v = VICBF(10000, 3)
    try:
        v.query(None)
    except ValueError:
        assert True
        return
    assert False
예제 #2
0
def test_insert_overflow():
    v = VICBF(10000, 3)
    for i in range(1000):
        v.insert(123)
    assert v.query(123)
    for i in range(1000):
        v.remove(123)
    # Even though it should now theoretically be removed, the implementation
    # should still return true because the values should have been fixed at
    # the maximum when the overflow occured
    assert v.query(123)
예제 #3
0
def test_query_multi_insert_remove():
    v = VICBF(10000, 3)
    v.insert(123)
    v.insert(123)
    v.remove(123)
    assert v.query(123)
예제 #4
0
def test_query_not_inserted():
    v = VICBF(10000, 3)
    v.insert(123)
    assert not v.query(4567)
예제 #5
0
def test_query_inserted():
    v = VICBF(10000, 3)
    v.insert(123)
    assert v.query(123)
예제 #6
0
def test_many_inserts():
    v = VICBF(10000, 3)
    for i in range(1000):
        v.insert(i)
    assert not v.query(1001)
예제 #7
0
def test_remove():
    v = VICBF(10000, 3)
    v.insert(123)
    v.remove(123)
    assert not v.query(123)