Beispiel #1
0
 def test_GIVEN_graph_dicircle_WHEN_fw_THEN_return_kn_correct_result_path(self):
     for algorithm in self.algorithms:
         data, stderr = execute_algorithm(self.exec_path, algorithm, gen_graph_dicircle_in(self.SIZE))
         self.assertEqual(stderr, '')
         self.assertListEqual(data['graph'], gen_kn_graph_for_dcircle_out(self.SIZE))
         self.assertListEqual(data['predecessors'], gen_kn_pred_for_dcircle_out(self.SIZE))
Beispiel #2
0
 def test_GIVEN_graph_k1_WHEN_fw_THEN_return_k1_result_path(self):
     for algorithm in self.algorithms:
         data, stderr = execute_algorithm(self.exec_path, algorithm, gen_k1_graph_in(self.SIZE))
         self.assertEqual(stderr, '')
         self.assertListEqual(data['graph'], gen_k1_graph_out(self.SIZE))
         self.assertListEqual(data['predecessors'], gen_k1_predecessors_out(self.SIZE))
Beispiel #3
0
 def test_GIVEN_graph_empty_WHEN_fw_THEN_return_result_empty(self):
     for algorithm in self.algorithms:
         result, stderr = execute_algorithm(self.exec_path, algorithm, "0 0")
         self.assertEqual(stderr, '')
         self.assertEqual(result['graph'], [])
         self.assertEqual(result['predecessors'], [])
Beispiel #4
0
 def test_GIVEN_graph_k0_WHEN_fw_THEN_return_k0_result_path(self):
     for algorithm in self.algorithms:
         data, stderr = execute_algorithm(self.exec_path, algorithm, f"{self.SIZE} 0")
         self.assertEqual(stderr, '')
         self.assertListEqual(data['graph'], gen_graph_out(self.SIZE, diagonal=0))
         self.assertListEqual(data['predecessors'], gen_graph_out(self.SIZE, -1))
Beispiel #5
0
 def _compare_result_graph_from_two_algorithms(self, input_graph: str, first: str, second: str):
     results = {}
     for algorithm in [first, second]:
         results[algorithm], stderr = execute_algorithm(self.exec_path, algorithm, input_graph)
     self.assertListEqual(results[first]['graph'], results[second]['graph'])