def test_up(self): board = PuzzleBoard(size=2) board.move("down") self.assertEqual(board.get_field(0, 0), 2) self.assertEqual(board.get_field(0, 1), None) board.move("up") self.assertEqual(board.get_field(0, 0), None) self.assertEqual(board.get_field(0, 1), 2)
def test_move_left(self): board = PuzzleBoard(size=2) board.move("right") self.assertEqual(board.get_field(0, 0), 1) self.assertEqual(board.get_field(1, 0), None) board.move("left") self.assertEqual(board.get_field(0, 0), None) self.assertEqual(board.get_field(1, 0), 1)
def test_move_down_already_down(self): board = PuzzleBoard(size=2) board.move("down") self.assertEqual(board.get_field(0, 0), 2) self.assertEqual(board.get_field(0, 1), None) board.move("down") self.assertEqual(board.get_field(0, 0), 2) self.assertEqual(board.get_field(0, 1), None)
def test_initialize(self): board = PuzzleBoard(size=2) self.assertEqual(board.get_field(0, 0), None) self.assertEqual(board.get_field(1, 0), 1) self.assertEqual(board.get_field(0, 1), 2) self.assertEqual(board.get_field(1, 1), 3)