Example #1
0
 def test_sort_duplicates(self):
     "Tests sorting of duplicate values"
     sequence = [1, 1, 2, 2, 3, 4, 6, 7]
     array = sequence[:]
     shuffle(array)
     array = quick.sort(array)
     self.assertEquals(array, sequence)
Example #2
0
 def test_sort_empty(self):
     "Tests sorting of an empty array"
     array = []
     array = quick.sort(array)
     self.assertEquals(array, [])
Example #3
0
 def test_sort_shuffle(self):
     "Tests shuffled values from 1 to 100"
     array = range(100)
     shuffle(array)
     array = quick.sort(array)
     self.assertEquals(array, range(100))
Example #4
0
 def test_sort_reverse(self):
     "Tests reverse sequence sort"
     array = range(100)
     array.reverse()
     array = quick.sort(array)
     self.assertEquals(array, range(100))
Example #5
0
 def test_sort(self):
     "Tests simple sequencial sort"
     array = range(100)
     array = quick.sort(array)
     self.assertEquals(array, range(100))
Example #6
0
 def test_sort_single(self):
     "Tests single element sort"
     array = [9]
     array = quick.sort(array)
     self.assertEquals(array, [9])