Maze tester

This commit is contained in:
2026-03-19 17:30:18 +01:00
parent 97b35fe3eb
commit 96b39fbeea
2 changed files with 31 additions and 4 deletions
-4
View File
@@ -25,10 +25,6 @@ class Maze:
res += "\n" res += "\n"
return res return res
def export_maze(self, file_name: str) -> None:
with open(file_name, "w") as file:
file.write(self.__str__())
def ascii_print(self) -> None: def ascii_print(self) -> None:
for line in self.maze: for line in self.maze:
if line is self.maze[0]: if line is self.maze[0]:
+31
View File
@@ -0,0 +1,31 @@
import numpy
from amaz_lib.Cell import Cell
from amaz_lib.Maze import Maze
def test_maze_setter_getter() -> None:
maze = Maze(numpy.array([]))
test = numpy.array(
[
[Cell(value=6), Cell(value=8), Cell(value=11)],
[Cell(value=6), Cell(value=8), Cell(value=11)],
[Cell(value=6), Cell(value=8), Cell(value=11)],
]
)
maze.set_maze(test)
assert numpy.array_equal(maze.get_maze(), test) == True
def test_maze_str() -> None:
test = numpy.array(
[
[Cell(value=6), Cell(value=8), Cell(value=11)],
[Cell(value=6), Cell(value=8), Cell(value=11)],
[Cell(value=6), Cell(value=8), Cell(value=11)],
]
)
maze = Maze(test)
assert maze.__str__() == "68B\n68B\n68B\n"