import unittest

from sort import mergesort


class SortingCorrectnessTest(unittest.TestCase):
    known_values = (
        (
            [42, 23, 16, 15, 8, 4],
            [4, 8, 15, 16, 23, 42]
        ),
        (
            [],
            []
        ),
        (
            [1],
            [1]
        ),
        (
            ['h', 'b', 'o'],
            ['b', 'h', 'o']
        ),
    )

    def test_sorting_correctness(self):
        """should give known result with known input"""

        for input_value, output_value in self.known_values:
            """Python Built-in sorting"""
            self.assertEqual(
                output_value,
                sorted(input_value)
            )

            """Merge Sort"""
            self.assertEqual(
                output_value,
                mergesort(input_value)
            )


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