예제 #1
0
 def test_no_checkpoints(self):
     start_finish = [(0, 0), (5, 5)]
     self.assertEqual(
         algorithm(self.G, start_finish[0],
                   start_finish[1], self.checkpoints), [(0, 0), (1, 1),
                                                        (2, 2), (3, 3),
                                                        (4, 4), (5, 5)])
예제 #2
0
 def test_no_path_to_finish(self):
     start_finish = [(5, 5), (0, 0)]
     self.checkpoints = [(1, 1), (2, 4)]
     self.G.remove_edge((0, 0), (1, 0))
     self.G.remove_edge((0, 0), (0, 1))
     self.G.remove_edge((0, 0), (1, 1))
     self.assertEqual(
         algorithm(self.G, start_finish[0], start_finish[1],
                   self.checkpoints), [])
예제 #3
0
 def test_same_start_finish(self):
     start_finish = [(0, 0), (0, 0)]
     self.checkpoints = [(0, 5)]
     self.assertEqual(
         algorithm(self.G, start_finish[0],
                   start_finish[1], self.checkpoints), [(0, 0), (0, 1),
                                                        (0, 2), (0, 3),
                                                        (0, 4), (0, 5),
                                                        (0, 4), (0, 3),
                                                        (0, 2), (0, 1),
                                                        (0, 0)])
예제 #4
0
 def test_many_checkpoint(self):
     start_finish = [(0, 0), (5, 5)]
     self.checkpoints = [(0, 5), (2, 4)]
     self.assertEqual(
         algorithm(self.G, start_finish[0],
                   start_finish[1], self.checkpoints), [(0, 0), (1, 1),
                                                        (2, 2), (2, 3),
                                                        (2, 4), (1, 5),
                                                        (0, 5), (1, 5),
                                                        (2, 5), (3, 5),
                                                        (4, 5), (5, 5)])