def test_insert_fix(): """Test if rbtree is consistent after generated inserts.""" ints = [-1, 0, 2, 4, 1, 0] ss = sorted(deduplicate(ints)) sc = len(ss) s = sum(ss) c = len(ints) call_ffi(lib.test_insert, c, ints, ss, sc, s, True)
def test_insert(ints): """Test if rbtree is consistent after generated inserts.""" ss = sorted(deduplicate(ints)) sc = len(ss) s = sum(ss) c = len(ints) do_sum = True if abs(s) > (2**32 / 2) - 1: do_sum = False s = 0 call_ffi(lib.test_insert, c, ints, ss, sc, s, do_sum)
def test_delete(ints): """Test if rbtree is consistent after generated inserts and one deleted.""" ints = deduplicate(ints) c = len(ints) assume(c > 1) dl = ints[:-1] s = sum(dl) ss = sorted(dl) do_sum = True if abs(s) > (2**32 / 4) - 1: do_sum = False s = 0 call_ffi(lib.test_delete, c, ints, ss, c - 1, s, do_sum)
def test_rotate(): """Test if rotate left/right work.""" call_ffi(lib.test_rotate)
def test_insert_static(): """Test if rbtree is consistent after inserts.""" call_ffi(lib.test_insert_static)
def test_traits(): call_ffi(lib.test_traits)