MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / test_floor_ceil

Function test_floor_ceil

data_structures/binary_tree/red_black_tree.py:629–642  ·  view source on GitHub ↗

Tests the floor and ceiling functions in the tree.

()

Source from the content-addressed store, hash-verified

627
628
629def test_floor_ceil() -> bool:
630 """Tests the floor and ceiling functions in the tree."""
631 tree = RedBlackTree(0)
632 tree.insert(-16)
633 tree.insert(16)
634 tree.insert(8)
635 tree.insert(24)
636 tree.insert(20)
637 tree.insert(22)
638 tuples = [(-20, None, -16), (-10, -16, 0), (8, 8, 8), (50, 24, None)]
639 for val, floor, ceil in tuples:
640 if tree.floor(val) != floor or tree.ceil(val) != ceil:
641 return False
642 return True
643
644
645def test_min_max() -> bool:

Callers 2

pytestsFunction · 0.85
mainFunction · 0.85

Calls 4

insertMethod · 0.95
floorMethod · 0.95
ceilMethod · 0.95
RedBlackTreeClass · 0.85

Tested by

no test coverage detected