Exemplo n.º 1
0
 def test_bfs_to_self(self):
     test_layout = (
     """ ############
         #0.     #.1#
         ############ """)
     universe = CTFUniverse.create(test_layout, 2)
     al = Graph(universe.free_positions())
     assert [] == al.bfs((1,1), [(1, 1), (2, 1)])
Exemplo n.º 2
0
 def test_path_to_same_position(self):
     test_layout = (
     """ ##################
         #0#.  .  # .     #
         #2#####    #####1#
         #     . #  .  .#3#
         ################## """)
     universe = CTFUniverse.create(test_layout, 4)
     al = Graph(universe.free_positions())
     assert [] == al.a_star((1, 1), (1, 1))
     assert [] == al.bfs((1, 1), [(1, 1)])
Exemplo n.º 3
0
 def test_bfs_exceptions(self):
     test_layout = (
     """ ############
         #0.     #.1#
         ############ """)
     universe = CTFUniverse.create(test_layout, 2)
     al = Graph(universe.free_positions())
     with pytest.raises(NoPathException):
         al.bfs((1, 1), [(10, 1)])
     with pytest.raises(NoPathException):
         al.bfs((1, 1), [(10, 1), (9, 1)])
     with pytest.raises(NoPathException):
         al.bfs((0, 1), [(10, 1)])
     with pytest.raises(NoPathException):
         al.bfs((1, 1), [(11, 1)])