Added few more tests on the test suite

This commit is contained in:
Gustavo Henrique Santos Souza de Miranda 2025-05-20 17:18:12 -03:00
parent 90aa646774
commit c3b6f95cfb
1 changed files with 21 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import pytest
from goulag_sort import send_to_goulag from goulag_sort import send_to_goulag
def test_empty_list(): def test_empty_list():
assert send_to_goulag([]) == [] assert send_to_goulag([]) == []
@ -14,6 +15,19 @@ def test_single_element():
def test_already_sorted(): def test_already_sorted():
assert send_to_goulag([10,20,45,50,60,100,150]) == [10,20,45,50,60,100,150] assert send_to_goulag([10,20,45,50,60,100,150]) == [10,20,45,50,60,100,150]
def test_list_all_equal():
assert send_to_goulag([5,5,5,5,5,5,5,5]) == [5,5,5,5,5,5,5,5]
def test_negative_numbers():
inputlist = [-4,15,-10,50,13]
expectedlist = sorted(copy.deepcopy(inputlist))
assert send_to_goulag(inputlist) == expectedlist
def test_float_numbers():
inputlist = [1.7,45.2,10.2,5.4,78.2]
expectedlist = sorted(copy.deepcopy(inputlist))
assert send_to_goulag(inputlist) == expectedlist
def test_reverse_sorted(): def test_reverse_sorted():
inputlist = [50,40,30,25,14,10,5] inputlist = [50,40,30,25,14,10,5]
expectedlist = [5,10,14,25,30,40,50] expectedlist = [5,10,14,25,30,40,50]
@ -30,6 +44,13 @@ def test_simple_sort():
expectedlist = sorted(expectedlist) expectedlist = sorted(expectedlist)
assert send_to_goulag(inputlist) == expectedlist assert send_to_goulag(inputlist) == expectedlist
def test_partially_sorted_list():
inputlist = [10,20,30,4,12,2,56,15]
expectedlist = copy.deepcopy(inputlist)
expectedlist = sorted(expectedlist)
assert send_to_goulag(inputlist) == expectedlist
def test_duplicated_sort(): def test_duplicated_sort():
inputlist = [10,20,30,30,50,65,100] inputlist = [10,20,30,30,50,65,100]
expectedList = sorted(copy.deepcopy(inputlist)) expectedList = sorted(copy.deepcopy(inputlist))