Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Trees
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
1MAE002 - ALGORITHM AND COMPUTING
Advanced
Trees
Commits
cda657d8
Verified
Commit
cda657d8
authored
10 months ago
by
STEVAN Antoine
Browse files
Options
Downloads
Patches
Plain Diff
give better error messages for "binary search" tests
parent
5546a27d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_binary_search.py
+3
-3
3 additions, 3 deletions
tests/test_binary_search.py
with
3 additions
and
3 deletions
tests/test_binary_search.py
+
3
−
3
View file @
cda657d8
...
...
@@ -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
}
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment