def testOnRightLowerCornerSurrounded(self): cells = game.create_cells(game.ROWS, game.COLUMNS) for row in range(game.ROWS - 2, game.ROWS): for col in range(game.ROWS - 2, game.ROWS): cells[row][col] = True self.assertEqual(3, game.get_number_of_neighbors(game.ROWS - 1, game.COLUMNS - 1, cells), "Should be 3")
def testOnCenterSurrounded(self): cells = game.create_cells(game.ROWS, game.COLUMNS) for row in range(3, 6): for col in range(3, 6): cells[row][col] = True self.assertEqual(8, game.get_number_of_neighbors(4, 4, cells), "Should be 8")
def testOnRightLowerCornerIsolated(self): cells = game.create_cells(game.ROWS, game.COLUMNS) self.assertEqual(0, game.get_number_of_neighbors(game.ROWS - 1, game.COLUMNS - 1, cells), "Should be 0")
def testOneCenterIsolated(self): cells = game.create_cells(game.ROWS, game.COLUMNS) self.assertEqual(0, game.get_number_of_neighbors(4, 4, cells), "Should be 0")