diff --git a/squirrelbattle/tests/mapgeneration_test.py b/squirrelbattle/tests/mapgeneration_test.py index d840b69..3879f8f 100644 --- a/squirrelbattle/tests/mapgeneration_test.py +++ b/squirrelbattle/tests/mapgeneration_test.py @@ -27,15 +27,16 @@ class TestBroguelike(unittest.TestCase): def is_connex(self, grid: List[List[Tile]]) -> bool: h, w = len(grid), len(grid[0]) y, x = randint(0, h - 1), randint(0, w - 1) - while not (grid[y][x].can_walk()): + while not (grid[y][x].can_walk() or grid[y][x] == Tile.DOOR): y, x = randint(0, h - 1), randint(0, w - 1) queue = Map.neighbourhood(grid, y, x) while queue: y, x = queue.pop() - if grid[y][x].can_walk(): + if grid[y][x].can_walk() or grid[y][x] == Tile.DOOR: grid[y][x] = Tile.WALL queue += Map.neighbourhood(grid, y, x) - return not any([t.can_walk() for row in grid for t in row]) + return not any([t.can_walk() or t == Tile.DOOR + for row in grid for t in row]) def test_build_doors(self) -> None: m = self.stom(". .\n. .\n. .\n")