Exemplo n.º 1
0
    def test_merge_biglist(self):
        size = 300
        left = sorted(sorts.get_values(size))
        right = sorted(sorts.get_values(size))
        values = left + right
        expected = sorted(values)

        sorts.merge(values, 0, size, 2 * size - 1)
        self.assertEqual(expected, values)
Exemplo n.º 2
0
 def test_merge_sort(self):
     size = 170
     values = sorts.get_values(size)
     actual = sorts.merge_sort(values, 0, size - 1)
     expected = sorted(values)
     self.assertEqual(expected, actual)
Exemplo n.º 3
0
 def test_insertion_sort(self):
     numbers = sorts.get_values(20)
     actual = sorts.insertion_sort(numbers)
     expected = sorted(numbers)
     self.assertEqual(expected, actual)