diff --git a/wizard-work/beam/test_rotated_binary_search.py b/wizard-work/beam/test_rotated_binary_search.py index 39d6fb3..ea921c4 100644 --- a/wizard-work/beam/test_rotated_binary_search.py +++ b/wizard-work/beam/test_rotated_binary_search.py @@ -24,8 +24,9 @@ def test_rotated(): base = [1,2,3,4,5,6,7] for r in range(len(base)): arr = base[r:] + base[:r] - assert find_pivot(arr) == r, (r, find_pivot(arr)) - assert count_rotations(arr) == r + expected_pivot = (len(base) - r) % len(base) + assert find_pivot(arr) == expected_pivot, (r, find_pivot(arr), expected_pivot) + assert count_rotations(arr) == expected_pivot for t in base: i = search(arr, t) assert i != -1 and arr[i] == t