コード例 #1
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetInvalidCellCoordinatesFromIndexInNonSquareMaze(self):
     maze = Maze(12, 1)
     with self.assertRaises(
             IndexError,
             msg=
             "`cellIndex` out of range (761263748 not between 0 and 11).",
     ):
         _ = maze.getCoordinatesFromIndex(761263748)
コード例 #2
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetOutOfRangeTooHighCellCoordinatesFromIndex(self):
     maze = Maze(1, 1)
     # get too high cell index coordinates
     with self.assertRaises(
             IndexError,
             msg="`cellIndex` out of range (55 not between 0 and 0).",
     ):
         _ = maze.getCoordinatesFromIndex(55)
コード例 #3
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetLastCellCoordinatesFromIndexInNonSquareMaze(self):
     maze = Maze(37, 17)
     c = maze.getCoordinatesFromIndex(628).toTuple()
     self.assertEqual(c, (36, 16))
コード例 #4
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetRandomCellCoordinatesFromIndexInNonSquareMaze(self):
     maze = Maze(42, 16)
     c = maze.getCoordinatesFromIndex(488).toTuple()
     self.assertEqual(c, (26, 11))
コード例 #5
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetFirstCellCoordinatesFromIndexInNonSquareMaze(self):
     maze = Maze(3, 55)
     c = maze.getCoordinatesFromIndex(0).toTuple()
     self.assertEqual(c, (0, 0))
コード例 #6
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetLastCellCoordinatesFromIndex(self):
     maze = Maze(3, 3)
     # getting last cell in maze, should be (2, 2)
     c = maze.getCoordinatesFromIndex(8).toTuple()
     self.assertEqual(c, (2, 2))
コード例 #7
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetCentreCellCoordinatesFromIndex(self):
     maze = Maze(3, 3)
     # getting centre cell, should be (1, 1)
     c = maze.getCoordinatesFromIndex(4).toTuple()
     self.assertEqual(c, (1, 1))
コード例 #8
0
ファイル: maze.unittest.py プロジェクト: ntflix/Maze-Solvers
 def testGetFirstCellCoordinatesFromIndex(self):
     maze = Maze(2, 2)
     # first cell in maze should be (0, 0)
     c = maze.getCoordinatesFromIndex(0).toTuple()
     self.assertEqual(c, (0, 0))