def test_insertion_sort():
    """ tester av sorteringsalgoritmer """
    assert insertion_sort([3, 4, 1, 2, 5]) == [1, 2, 3, 4, 5]
    assert insertion_sort([]) == []
    assert insertion_sort([3, 7, 10, 2, 7, 11, 1]) == [1, 2, 3, 7, 7, 10, 11]
    assert insertion_sort([100, 194, 678, 300200, 1337,
                           420]) == [100, 194, 420, 678, 1337, 300200]
Пример #2
0
def test_insertion_sort():
    """test av sorterongsalgoritmer"""
    assert insertion_sort([5, 7, 4, 8, 1, 2, 6, 3]) == [1, 2, 3, 4, 5, 6, 7, 8]
    assert insertion_sort([]) == []
    assert insertion_sort([9, 7, 3, 120, 674, 1, 6,
                           9]) == [1, 3, 6, 7, 9, 9, 120, 674]
    assert insertion_sort([69, 911, 666, 5500, 420,
                           1337]) == [69, 420, 666, 911, 1337, 5500]
Пример #3
0
def test_insertion_sort(problem, expected_answer):
    assert insertion_sort(problem) == expected_answer
Пример #4
0
def test_insertion_sort():
    l = [5, 7, 4, 8, 1, 2, 6, 3]
    assert insertion_sort(l) == [1, 2, 3, 4, 5, 6, 7, 8]