示例#1
0
 def test_random(self):
     for i in range(0, 100):
         input_list = range(0, 100)
         random.shuffle(input_list)
         ref_sorted = sorted(input_list)
         sorted_list = sort.my_sort(input_list)
         self.assertEqual(ref_sorted, sorted_list)
 def setUp(self):
     self.result1 = my_sort([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
     self.result2 = my_sort([1, 2])
     self.result3 = my_sort([2, 1])
     self.result4 = my_sort([3, 3, 4])
     self.result5 = my_sort([90, 45, 66])
     self.result6 = my_sort(
         [90, 77, 66, 55, 44, 289848, 4983484, 13873, 18827, 13232])
     self.result7 = my_sort([27842, 3234, 245325, 3554, 24525, 224325, 111])
     self.result8 = my_sort([11111, 1, 11, 979749, 1111, 1111])
示例#3
0
 def test_repeat(self):
     r = sort.my_sort([9, 4, 7, 2, 4, 0, 1, 0])
     self.assertEqual([0, 0, 1, 2, 4, 4, 7, 9], r)
示例#4
0
 def test_few(self):
     r = sort.my_sort([1, 5, 8, 3, 2, 0])
     self.assertEqual([0, 1, 2, 3, 5, 8], r)
示例#5
0
 def test_one(self):
     r = sort.my_sort([1])
     self.assertEqual([1], r)
示例#6
0
 def test_empty(self):
     r = sort.my_sort([])
     self.assertEqual([], r)