Exemplo n.º 1
0
 def test_partition_with_one_element(self):
     lst_for_partition = [3]
     Sorting.partition(lst_for_partition, 0, 0)
     self.assertListEqual([3], lst_for_partition)
Exemplo n.º 2
0
 def test_merge_sort_with_doubles(self):
     sorted_list = Sorting.merge_sort([])
     self.assertListEqual([], sorted_list)
Exemplo n.º 3
0
 def test_partition(self):
     r_seq = list(range(55)) + list(range(56, 100))
     random.shuffle(r_seq)
     r_seq = [55] + r_seq
     self.assertEquals(55, Sorting.partition(r_seq, 0, len(r_seq)-1))
Exemplo n.º 4
0
 def test_merge_sort(self):
     sorted_list = Sorting.merge_sort(self.seq)
     self.assertListEqual(self.sorted_seq, sorted_list)
Exemplo n.º 5
0
 def test_merge_sort_with_doubles(self):
     sorted_list = Sorting.merge_sort(self.seq_with_doubles)
     self.assertListEqual(self.sorted_seq_with_doubles, sorted_list)
Exemplo n.º 6
0
 def test_insertion_sort_with_empty_list(self):
     Sorting.selection_sort(self.empty_list)
     self.assertListEqual([], self.empty_list)
Exemplo n.º 7
0
 def test_insertion_sort_with_empty_list(self):
     Sorting.selection_sort(self.empty_list)
     self.assertListEqual([], self.empty_list)
Exemplo n.º 8
0
 def test_partition_consistence(self):
     Sorting.partition(self.seq, 0, len(self.seq) - 1)
     self.assertListEqual(self.sorted_seq, sorted(self.seq))
Exemplo n.º 9
0
 def test_quick_sort(self):
     Sorting.quick_sort(self.seq)
     self.assertListEqual(self.sorted_seq, self.seq)
Exemplo n.º 10
0
 def test_partition(self):
     r_seq = list(range(55)) + list(range(56, 100))
     random.shuffle(r_seq)
     r_seq = [55] + r_seq
     self.assertEquals(55, Sorting.partition(r_seq, 0, len(r_seq) - 1))
Exemplo n.º 11
0
 def test_partition_with_one_element(self):
     lst_for_partition = [3]
     Sorting.partition(lst_for_partition, 0, 0)
     self.assertListEqual([3], lst_for_partition)
Exemplo n.º 12
0
 def test_merge_sort_with_doubles(self):
     sorted_list = Sorting.merge_sort([])
     self.assertListEqual([], sorted_list)
Exemplo n.º 13
0
 def test_merge_sort_with_doubles(self):
     sorted_list = Sorting.merge_sort(self.seq_with_doubles)
     self.assertListEqual(self.sorted_seq_with_doubles, sorted_list)
Exemplo n.º 14
0
 def test_merge_sort(self):
     sorted_list = Sorting.merge_sort(self.seq)
     self.assertListEqual(self.sorted_seq, sorted_list)
Exemplo n.º 15
0
 def test_partition_consistence(self):
     Sorting.partition(self.seq, 0, len(self.seq)-1)
     self.assertListEqual(self.sorted_seq, sorted(self.seq))
Exemplo n.º 16
0
 def test_insertion_sort(self):
     Sorting.insertion_sort(self.seq)
     self.assertListEqual(self.sorted_seq, self.seq)
Exemplo n.º 17
0
 def test_quick_sort(self):
     Sorting.quick_sort(self.seq)
     self.assertListEqual(self.sorted_seq, self.seq)
Exemplo n.º 18
0
 def test_insertion_sort(self):
     Sorting.insertion_sort(self.seq)
     self.assertListEqual(self.sorted_seq, self.seq)