from sorting_integer import random_ints, bucket_sort, counting_sort
import unittest

sort = counting_sort
class IntegerSortTest(unittest.TestCase):

    def test_sort_on_empty_list(self):
        items = []
        sort(items)
        assert items == []  # List should not be changed

    def test_sort_on_small_lists_of_integers(self):
        items1 = [3]
        sort(items1)
        assert items1 == [3]  # List should not be changed
        items2 = [5, 3]
        sort(items2)
        assert items2 == [3, 5]  # List should be in sorted order
        items3 = [5, 7, 3]
        sort(items3)
        assert items3 == [3, 5, 7]


    def test_sort_on_lists_of_random_integers(self):
        # Generate list of 10 random integers from range [1...20]
        items1 = random_ints(10, 1, 20)
        sorted_items1 = sorted(items1)  # Create a copy of list in sorted order
        sort(items1)  # Call mutative sort function to sort list items in place
        assert items1 == sorted_items1

        # Generate list of 20 random integers from range [1...50]
        items2 = random_ints(20, 1, 50)
        sorted_items2 = sorted(items2)  # Copy
        sort(items2)  # Mutate
        assert items2 == sorted_items2

        # Generate list of 30 random integers from range [1...100]
        items3 = random_ints(30, 1, 100)
        sorted_items3 = sorted(items3)  # Copy
        sort(items3)  # Mutate
        assert items3 == sorted_items3
if __name__ == '__main__':
    # Get sort function from command-line argument
    # FIXME: This is causing unittest to throw an error
    # sort = get_sort_function()
    unittest.main()
8ad7a61351f143bc5040f361d1322d73a12f1436
<mask token>


class IntegerSortTest(unittest.TestCase):

    def test_sort_on_empty_list(self):
        items = []
        sort(items)
        assert items == []
    <mask token>

    def test_sort_on_lists_of_random_integers(self):
        items1 = random_ints(10, 1, 20)
        sorted_items1 = sorted(items1)
        sort(items1)
        assert items1 == sorted_items1
        items2 = random_ints(20, 1, 50)
        sorted_items2 = sorted(items2)
        sort(items2)
        assert items2 == sorted_items2
        items3 = random_ints(30, 1, 100)
        sorted_items3 = sorted(items3)
        sort(items3)
        assert items3 == sorted_items3


<mask token>

<mask token>


class IntegerSortTest(unittest.TestCase):

    def test_sort_on_empty_list(self):
        items = []
        sort(items)
        assert items == []

    def test_sort_on_small_lists_of_integers(self):
        items1 = [3]
        sort(items1)
        assert items1 == [3]
        items2 = [5, 3]
        sort(items2)
        assert items2 == [3, 5]
        items3 = [5, 7, 3]
        sort(items3)
        assert items3 == [3, 5, 7]

    def test_sort_on_lists_of_random_integers(self):
        items1 = random_ints(10, 1, 20)
        sorted_items1 = sorted(items1)
        sort(items1)
        assert items1 == sorted_items1
        items2 = random_ints(20, 1, 50)
        sorted_items2 = sorted(items2)
        sort(items2)
        assert items2 == sorted_items2
        items3 = random_ints(30, 1, 100)
        sorted_items3 = sorted(items3)
        sort(items3)
        assert items3 == sorted_items3


<mask token>

<mask token>
sort = counting_sort


class IntegerSortTest(unittest.TestCase):

    def test_sort_on_empty_list(self):
        items = []
        sort(items)
        assert items == []

    def test_sort_on_small_lists_of_integers(self):
        items1 = [3]
        sort(items1)
        assert items1 == [3]
        items2 = [5, 3]
        sort(items2)
        assert items2 == [3, 5]
        items3 = [5, 7, 3]
        sort(items3)
        assert items3 == [3, 5, 7]

    def test_sort_on_lists_of_random_integers(self):
        items1 = random_ints(10, 1, 20)
        sorted_items1 = sorted(items1)
        sort(items1)
        assert items1 == sorted_items1
        items2 = random_ints(20, 1, 50)
        sorted_items2 = sorted(items2)
        sort(items2)
        assert items2 == sorted_items2
        items3 = random_ints(30, 1, 100)
        sorted_items3 = sorted(items3)
        sort(items3)
        assert items3 == sorted_items3


if __name__ == '__main__':
    unittest.main()

from sorting_integer import random_ints, bucket_sort, counting_sort
import unittest
sort = counting_sort


class IntegerSortTest(unittest.TestCase):

    def test_sort_on_empty_list(self):
        items = []
        sort(items)
        assert items == []

    def test_sort_on_small_lists_of_integers(self):
        items1 = [3]
        sort(items1)
        assert items1 == [3]
        items2 = [5, 3]
        sort(items2)
        assert items2 == [3, 5]
        items3 = [5, 7, 3]
        sort(items3)
        assert items3 == [3, 5, 7]

    def test_sort_on_lists_of_random_integers(self):
        items1 = random_ints(10, 1, 20)
        sorted_items1 = sorted(items1)
        sort(items1)
        assert items1 == sorted_items1
        items2 = random_ints(20, 1, 50)
        sorted_items2 = sorted(items2)
        sort(items2)
        assert items2 == sorted_items2
        items3 = random_ints(30, 1, 100)
        sorted_items3 = sorted(items3)
        sort(items3)
        assert items3 == sorted_items3


if __name__ == '__main__':
    unittest.main()

from sorting_integer import random_ints, bucket_sort, counting_sort
import unittest

sort = counting_sort
class IntegerSortTest(unittest.TestCase):

    def test_sort_on_empty_list(self):
        items = []
        sort(items)
        assert items == []  # List should not be changed

    def test_sort_on_small_lists_of_integers(self):
        items1 = [3]
        sort(items1)
        assert items1 == [3]  # List should not be changed
        items2 = [5, 3]
        sort(items2)
        assert items2 == [3, 5]  # List should be in sorted order
        items3 = [5, 7, 3]
        sort(items3)
        assert items3 == [3, 5, 7]


    def test_sort_on_lists_of_random_integers(self):
        # Generate list of 10 random integers from range [1...20]
        items1 = random_ints(10, 1, 20)
        sorted_items1 = sorted(items1)  # Create a copy of list in sorted order
        sort(items1)  # Call mutative sort function to sort list items in place
        assert items1 == sorted_items1

        # Generate list of 20 random integers from range [1...50]
        items2 = random_ints(20, 1, 50)
        sorted_items2 = sorted(items2)  # Copy
        sort(items2)  # Mutate
        assert items2 == sorted_items2

        # Generate list of 30 random integers from range [1...100]
        items3 = random_ints(30, 1, 100)
        sorted_items3 = sorted(items3)  # Copy
        sort(items3)  # Mutate
        assert items3 == sorted_items3
if __name__ == '__main__':
    # Get sort function from command-line argument
    # FIXME: This is causing unittest to throw an error
    # sort = get_sort_function()
    unittest.main()