def test_multiple_pathes(self): maze = [[1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [1, 0, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 1, 1]] solution = [[1, 1, 1, 1, 1], [2, 2, 0, 0, 1], [1, 2, 1, 1, 1], [1, 2, 0, 0, 1], [1, 2, 1, 1, 1]] solve_maze(maze) self.assertEqual(maze, solution)
def test_curved_path(self): maze = [[1, 1, 1, 1, 1], [0, 0, 1, 0, 0], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]] solution = [[1, 1, 1, 1, 1], [2, 2, 1, 2, 2], [1, 2, 1, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]] solve_maze(maze) self.assertEqual(maze, solution)
def test_complex_maze(self): maze = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1]] solution = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 2, 2, 2, 2], [1, 1, 1, 2, 1, 1, 1], [1, 0, 1, 2, 2, 2, 1], [1, 0, 1, 1, 1, 2, 1], [1, 2, 2, 2, 2, 2, 1], [1, 2, 1, 1, 1, 1, 1]] solve_maze(maze) self.assertEqual(maze, solution)
def test_vertical_single_path(self): maze = [[1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1]] solution = [[1, 1, 1, 1, 1], [2, 2, 2, 2, 2], [1, 1, 1, 1, 1]] solve_maze(maze) self.assertEqual(maze, solution)
def test_horizontal_single_path(self): maze = [[1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 0, 1]] solution = [[1, 2, 1], [1, 2, 1], [1, 2, 1], [1, 2, 1], [1, 2, 1]] solve_maze(maze) self.assertEqual(maze, solution)