def test_insertion_sort_nearly_sorted(): arr = [2, 3, 5, 7, 13, 11] expected = [2, 3, 5, 7, 11, 13] actual = insertion_sort(arr) assert actual == expected
def test_insertion_sort_simple(): arr = [8, 4, 23, 42, 16, 15] expected = [4, 8, 15, 16, 23, 42] actual = insertion_sort(arr) assert actual == expected
def test_insertion_sort_reverse(): arr = [20, 18, 12, 8, 5, -2] expected = [-2, 5, 8, 12, 18, 20] actual = insertion_sort(arr) assert actual == expected
def test_insertion_sort_few_unique(): arr = [5, 12, 7, 5, 5, 7] expected = [5, 5, 5, 7, 7, 12] actual = insertion_sort(arr) assert actual == expected
def test_already_sorted(): array = [1, 2, 3, 4, 5] test = insertion_sort(array) assert test == [1, 2, 3, 4, 5]
def test_insertion_sort_empty(): array = [] test = insertion_sort(array) assert test == []
def test_insertion_sort_single(): array = [1] test = insertion_sort(array) assert test == [1]
def test_insertion_sort_duplicates(): array = [1, 5, 4, 3, 2, 1] test = insertion_sort(array) assert test == [1, 1, 2, 3, 4, 5]
def test_insertion_sort(): array = [5, 4, 3, 2, 1] test = insertion_sort(array) assert test == [1, 2, 3, 4, 5]