예제 #1
0
 def testRemoveWall(self):
     maze = Maze(4, 4, True)
     # remove a wall from first cell
     maze.removeWallBetween(0, 1)
     self.assertCountEqual(maze.getConnectionsOfCellAtIndex(0), [1])
     # remove another wall from first cell
     maze.removeWallBetween(0, 4)
     self.assertCountEqual(maze.getConnectionsOfCellAtIndex(0), [1, 4])
예제 #2
0
 def testAddWallAgain(self):
     maze = Maze(4, 4, False)
     # add a wall from first cell
     maze.addWallBetween(0, 1)
     self.assertCountEqual(maze.getConnectionsOfCellAtIndex(0), [4])
     # add another wall from first cell
     maze.addWallBetween(0, 4)
     self.assertCountEqual(maze.getConnectionsOfCellAtIndex(0), [])
예제 #3
0
 def testFullyConnectedInit(self):
     maze = Maze(4, 4, False)
     self.assertIsInstance(maze, Maze)
     self.assertCountEqual(maze.getConnectionsOfCellAtIndex(0), [1, 4])
     self.assertCountEqual(maze.getConnectionsOfCellAtIndex(5),
                           [1, 4, 6, 9])