Skip to content
Snippets Groups Projects
Verified Commit cda657d8 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

give better error messages for "binary search" tests

parent 5546a27d
Branches
No related tags found
No related merge requests found
......@@ -4,10 +4,10 @@ from random import randint
def test_binary_search():
from search import binary_search
values = [randint(0, 1000) for _ in range(100)]
values = sorted([randint(0, 1000) for _ in range(100)])
for v in values:
assert binary_search(sorted(values), v), "aie"
assert binary_search(values, v), f"{v} should be in {values}"
for v in [randint(1000, 2000) for _ in range(100)]:
assert not binary_search(sorted(values), v), "foo"
assert not binary_search(values, v), f"{v} should NOT be in {values}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment