Ejemplo n.º 1
0
def test_heap_sort_empty():
    data = []
    expected = []
    output = sort.heap_sort(data)
    assert (output == expected), "Got: {}; Expected: {}".format(
        output, expected)
Ejemplo n.º 2
0
def test_heap_sort_single():
    data = [-1]
    expected = [-1]
    output = sort.heap_sort(data)
    assert (output == expected), "Got: {}; Expected: {}".format(
        output, expected)
Ejemplo n.º 3
0
def test_heap_sort_unsorted_even():
    data = [4, 2, 6, 1]
    expected = [1, 2, 4, 6]
    output = sort.heap_sort(data)
    assert (output == expected), "Got: {}; Expected: {}".format(
        output, expected)
Ejemplo n.º 4
0
def test_heap_sort_unsorted_odd():
    data = [7, 8, 3, 5, 5]
    expected = [3, 5, 5, 7, 8]
    output = sort.heap_sort(data)
    assert (output == expected), "Got: {}; Expected: {}".format(
        output, expected)
Ejemplo n.º 5
0
def test_heap_sort_sorted_odd():
    data = [1, 2, 3]
    expected = [1, 2, 3]
    output = sort.heap_sort(data)
    assert (output == expected), "Got: {}; Expected: {}".format(
        output, expected)