def test_astar_failure(self):
     try:
         f = open(mapname)
         start, end = load_map.file_to_tile(f)
         walkable = start.walkable
         self.assertEquals(algorithms.astar(start, end), None)
     finally:
         f.close()
 def test_astar_success(self):
     try:
         f = open(mapname)
         start, end = load_map.file_to_tile(f)
         walkable = start.walkable
         path = algorithms.astar(start, end)
         self.verify_path(walkable, path)
     finally:
         f.close()
Esempio n. 3
0
 def test_file_to_tile(self):
     f = StringIO(load_map.START + load_map.TARGET)
     start, end = load_map.file_to_tile(f)
     self.assertEquals(start.pos, (0, 0))
     self.assertEquals(end.pos, (1, 0))
 def test_file_to_tile(self):
     f = StringIO(load_map.START + load_map.TARGET)
     start, end = load_map.file_to_tile(f)
     self.assertEquals(start.pos, (0, 0))
     self.assertEquals(end.pos, (1, 0))