def test_counts(): n = 10 actual = list(range(n)) counts = [0] quicksort.quick_sort(actual, 0, n - 1, quicksort.partition_first, counts) assert counts[0] > 0 print(counts[0])
def test_partition(partitioner): n = 10 expected = list(range(n)) actual = expected.copy() random.shuffle(actual) quicksort.quick_sort(actual, 0, n - 1, partitioner) assert actual == expected
def test_quick_sort_with_sorting(create_set): assert quick_sort(create_set) == sorted(create_set)
def test_quick_sort_different_types(array, expected): assert quick_sort(array) == expected array_type = type(array) assert type(quick_sort(array)) == array_type
def test(partition_fn): counts = [0] array = BIG_ARRAY.copy() qs.quick_sort(array, 0, BIG_ARRAY_LEN - 1, partition_fn, counts) assert array == SORTED_BIG_ARRAY print(counts[0])