import copy import random import pytest from goulag_sort import send_to_goulag def test_empty_list(): assert send_to_goulag([]) == [] def test_single_element(): assert send_to_goulag([5]) == [5] def test_already_sorted(): assert send_to_goulag([10,20,45,50,60,100,150]) == [10,20,45,50,60,100,150] def test_reverse_sorted(): inputlist = [50,40,30,25,14,10,5] expectedlist = [5,10,14,25,30,40,50] inputlist = send_to_goulag(inputlist) assert inputlist == expectedlist def test_simple_sort(): inputlist = [ 622, 1010, 184, 1012, 780, 151, 708, 1020, 1013, 839, 84, 191, 831, 824, 1015, 126, 928, 963, 847, 61, 1022, 765, 566, 269, 584, 172, 121, 741, 264, 470, 332, 564, 463, 29, 315, 28, 859, 6, 1000, 486, 624, 617, 390, 176, 76, 256, 369, 764, 202, 805, 355, 715, 507, 514, 378, 772, 525, 746, 623, 37, 863, 1005, 730, 731, 321, 357, 65, 648, 310, 140, 375, 479, 926, 86, 335, 777, 684, 734, 539, 51, 265, 179, 745, 642, 806, 294, 182, 293, 768, 367, 594, 109, 481, 117, 709, 952, 403, 211, 682, 145] expectedlist = copy.deepcopy(inputlist) expectedlist = sorted(expectedlist) assert send_to_goulag(inputlist) == expectedlist def test_duplicated_sort(): inputlist = [10,20,30,30,50,65,100] expectedList = sorted(copy.deepcopy(inputlist)) assert send_to_goulag(inputlist) == expectedList def test_really_long_sort(): inputList = [random.randint(1,500000) for _ in range(10000)] expectedList = sorted(copy.deepcopy(inputList)) assert send_to_goulag(inputList) == expectedList