コード例 #1
0
def test_random_input():
    h = BinaryHeap()
    for i in random.sample(range(100), 100):
        h.push(i)
    assert all_items(h) == range(0, 100)
コード例 #2
0
def test_reverse_range():
    heap = BinaryHeap()
    for i in range(5, 0, -1):
        heap.push(i)
    assert all_items(heap) == range(1, 6)
コード例 #3
0
def test_load_up_the_list():
    heap = BinaryHeap()
    for i in range(10000, 0, -1):
        heap.push(i)
    assert all_items(heap) == range(1, 10001)
コード例 #4
0
def test_one_push_pop():
    bin_list = BinaryHeap()
    bin_list.push(10)
    assert bin_list.pop() == 10