Exemplo n.º 1
0
 def test_WithDuplicate(self):
     lst = [1, 2, 2, 1, 0, 0, 15, 15]
     sortedList = lst
     quickSort(sortedList, 0, len(lst) - 1)
     self.assertEqual(sortedList, [0, 0, 1, 1, 2, 2, 15, 15])
Exemplo n.º 2
0
 def test_BigNumbers(self):
     lst = [135604, 1000000, 45, 78435, 456219832, 2, 546]
     sortedList = lst
     quickSort(sortedList, 0, len(lst) - 1)
     self.assertEqual(sortedList,
                      [2, 45, 546, 78435, 135604, 1000000, 456219832])
Exemplo n.º 3
0
 def test_WithZero(self):
     lst = [10, 0]
     sortedList = lst
     quickSort(sortedList, 0, len(lst) - 1)
     self.assertEqual(sortedList, [0, 10])
Exemplo n.º 4
0
 def test_TwoUnsorted(self):
     lst = [2, 1]
     sortedList = lst
     quickSort(sortedList, 0, len(lst) - 1)
     self.assertEqual(sortedList, [1, 2])
Exemplo n.º 5
0
 def test_TwoSorted(self):
     lst = [1, 2]
     sortedList = lst
     quickSort(sortedList, 0, len(lst) - 1)
     self.assertEqual(lst, sortedList)
Exemplo n.º 6
0
 def test_SingleList(self):
     lst = [1]
     sortedList = lst
     quickSort(sortedList, 0, len(lst) - 1)
     self.assertEqual(lst, sortedList)
Exemplo n.º 7
0
 def test_EmptyList(self):
     lst = []
     sortedList = lst
     quickSort(sortedList, 0, len(lst) - 1)
     self.assertEqual(lst, sortedList)