Skip to content

Commit ed5bfaa

Browse files
Updating tests: adding cases and todo list
1 parent 4d323f9 commit ed5bfaa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

sorts/tests.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,19 @@
2727
{'input': [8, 7, 6, 5, 4, 3, -2, -5], 'expected': [-5, -2, 3, 4, 5, 6, 7, 8]},
2828
{'input': [-5, -2, 3, 4, 5, 6, 7, 8], 'expected': [-5, -2, 3, 4, 5, 6, 7, 8]},
2929
{'input': [5, 6, 1, 4, 0, 1, -2, -5, 3, 7], 'expected': [-5, -2, 0, 1, 1, 3, 4, 5, 6, 7]},
30+
{'input': [2, -2], 'expected': [-2, 2]},
31+
{'input': [1], 'expected': [1]},
32+
{'input': [], 'expected': []},
3033
]
3134

35+
'''
36+
TODO:
37+
- Fix some broken tests in particular cases (as [] for example),
38+
- Unify the input format: should always be function(input_collection) (no additional args)
39+
- Unify the output format: should always be a collection instead of updating input elements
40+
and returning None
41+
- Rewrite some algorithms in function format (in case there is no function definition)
42+
'''
3243

3344
TEST_FUNCTIONS = [
3445
bogo_sort,
@@ -59,4 +70,5 @@
5970

6071
for function in TEST_FUNCTIONS:
6172
for case in TEST_CASES:
62-
assert function(case['input']) == case['expected']
73+
result = function(case['input'])
74+
assert result == case['expected'], 'Executed function: {}, {} != {}'.format(function.__name__, result, case['expected'])

0 commit comments

Comments
 (0)