DaMaze
This commit is contained in:
35
tests.py
Normal file
35
tests.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import unittest
|
||||
|
||||
from maze import Maze
|
||||
|
||||
|
||||
class Tests(unittest.TestCase):
|
||||
def test_maze_create_cells(self):
|
||||
num_cols = 12
|
||||
num_rows = 10
|
||||
m1 = Maze(0, 0, num_rows, num_cols, 10, 10)
|
||||
self.assertEqual(
|
||||
len(m1.cells),
|
||||
num_cols,
|
||||
)
|
||||
self.assertEqual(
|
||||
len(m1.cells[0]),
|
||||
num_rows,
|
||||
)
|
||||
|
||||
def test_maze_break_entrance_and_exit(self):
|
||||
num_cols = 12
|
||||
num_rows = 10
|
||||
m1 = Maze(0, 0, num_rows, num_cols, 10, 10)
|
||||
self.assertEqual(
|
||||
m1.cells[0][0].has_top_wall,
|
||||
False,
|
||||
)
|
||||
self.assertEqual(
|
||||
m1.cells[num_cols - 1][num_rows - 1].has_bottom_wall,
|
||||
False,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user