Beispiel #1
0
 def sort_btn_clicked(self):
     self.logger.log('Button clicked')
     self.sorted_array = ' '.join(
         map(
             str,
             Sorting([float(i) for i in self.input_array.split(' ')
                      ]).insertion_sort()))
     self.logger.log('Sorted array: %s' % self.sorted_array)
 def sort_btn_clicked(self):
     self.sorted_array = ' '.join(
         map(
             str,
             Sorting([float(i) for i in self.input_array.split(' ')
                      ]).insertion_sort()))
Beispiel #3
0
 def test_can_sort_seventh_case(self):
     sort = Sorting(SEVENTH_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 5, 45])
Beispiel #4
0
 def test_can_sort_float_values(self):
     sort = Sorting(SIXTH_CASE)
     self.assertEqual(sort.insertion_sort(),
                      [0.05, 0.5, 1.5, 1.6, 3.4, 7.5])
Beispiel #5
0
 def test_can_sort_negtive_values(self):
     sort = Sorting(FIFTH_CASE)
     self.assertEqual(sort.insertion_sort(), [-44, -7, -1, 0, 5, 56])
Beispiel #6
0
 def test_can_sort_fourth_case(self):
     sort = Sorting(FOURTH_CASE)
     self.assertEqual(sort.insertion_sort(), [1, 3, 5, 45])
Beispiel #7
0
 def test_can_sort_third_case(self):
     sort = Sorting(THIRD_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 1, 2, 4, 8, 45])
Beispiel #8
0
 def test_can_sort_second_case(self):
     sort = Sorting(SECOND_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 1, 2, 4, 8, 45])
Beispiel #9
0
 def test_can_resolv_words(self):
     sort = Sorting([1, '45', 3, 'erf', '5'])
     self.assertEqual(sort.convert_to_array_of_int(), [1, 45, 3, 5])
Beispiel #10
0
 def test_can_convert_str_to_int(self):
     sort = Sorting([0, 1, '2', '45'])
     self.assertEqual(sort.convert_to_array_of_int(), [0, 1, 2, 45])
Beispiel #11
0
 def test_can_sort_first_case(self):
     sort = Sorting(FIRST_CASE)
     self.assertEqual(sort.insertion_sort(), [0, 4, 7])
Beispiel #12
0
 def test_raise_when_create_not_from_list(self):
     with self.assertRaises(TypeError):
         Sorting(3)
Beispiel #13
0
 def test_sorting_should_be_list(self):
     arr = [3]
     self.assertTrue(Sorting(arr))
Beispiel #14
0
 def test_init_param_list(self):
     arr = [1, 2, 3]
     self.assertEqual(arr, Sorting(arr).array)
Beispiel #15
0
 def test_can_create_sorting(self):
     sorting = Sorting([])
     self.assertTrue(isinstance(sorting, Sorting))