Example #1
0
def test__BST_remove_and_insert3(xs, ys):
    '''
    This test performs a mixture of both insertions and removals.
    This ensures that there are no weird interactions between inserting and removing.
    '''
    xs = list(set(xs))
    bst = BST(xs)
    for y in ys:
        bst.insert(y)
        x = bst.find_smallest()
        bst.remove(x)
        assert bst.is_bst_satisfied()
Example #2
0
def test__BST_find_smallest(xs):
    xs = list(set(xs))
    if len(xs) > 0:
        x = min(xs)
        bst = BST(xs)
        assert x == bst.find_smallest()