예제 #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 = radix.sort(array)
     self.assertEquals(array, sequence)
예제 #2
0
 def test_sort_empty(self):
     "Tests sorting of an empty array"
     array = []
     array = radix.sort(array)
     self.assertEquals(array, [])
예제 #3
0
 def test_sort_shuffle(self):
     "Tests shuffled values from 1 to 100"
     array = range(100)
     shuffle(array)
     array = radix.sort(array)
     self.assertEquals(array, range(100))
예제 #4
0
 def test_sort_reverse(self):
     "Tests reverse sequence sort"
     array = range(100)
     array.reverse()
     array = radix.sort(array)
     self.assertEquals(array, range(100))
예제 #5
0
 def test_sort(self):
     "Tests simple sequencial sort"
     array = range(100)
     array = radix.sort(array)
     self.assertEquals(array, range(100))
예제 #6
0
 def test_sort_single(self):
     "Tests single element sort"
     array = [9]
     array = radix.sort(array)
     self.assertEquals(array, [9])