-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_quick_sort.py
More file actions
33 lines (22 loc) · 775 Bytes
/
test_quick_sort.py
File metadata and controls
33 lines (22 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pytest
from sort_quick.quick_sort import quick_sort, partition, swap
def test_can_handle_reverse_sorted_list():
test_input = [20, 18, 12, 8, 5, -2]
quick_sort(test_input)
assert test_input == [-2, 5, 8, 12, 18, 20]
def test_can_handle_few_unique_list():
test_input = [5, 12, 7, 5, 5, 7]
quick_sort(test_input)
assert test_input == [5, 5, 5, 7, 7, 12]
def test_can_handle_nearly_sorted_list():
test_input = [2, 3, 5, 7, 13, 11]
quick_sort(test_input)
assert test_input == [2, 3, 5, 7, 11, 13]
def test_can_handle_list_with_one_value():
test_input = [5]
quick_sort(test_input)
assert test_input == [5]
def test_can_handle_empty_list():
test_input = []
quick_sort(test_input)
assert test_input == []