|
27 | 27 | {'input': [8, 7, 6, 5, 4, 3, -2, -5], 'expected': [-5, -2, 3, 4, 5, 6, 7, 8]},
|
28 | 28 | {'input': [-5, -2, 3, 4, 5, 6, 7, 8], 'expected': [-5, -2, 3, 4, 5, 6, 7, 8]},
|
29 | 29 | {'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': []}, |
30 | 33 | ]
|
31 | 34 |
|
| 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 | +''' |
32 | 43 |
|
33 | 44 | TEST_FUNCTIONS = [
|
34 | 45 | bogo_sort,
|
|
59 | 70 |
|
60 | 71 | for function in TEST_FUNCTIONS:
|
61 | 72 | 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