Beispiel #1
0
 def test_down_movement_not_possible(self):
     """Test the possible_movements function"""
     # Arrange
     game = Game()
     game.board = [
         [0, 0, 0, 0],
         [0, 0, 0, 0],
         [0, 0, 0, 0],
         [0, 2, 0, 0],
     ]
     # Act & Assert
     self.assertEqual(game.possible_movements(), ["left", "right", "up"])
Beispiel #2
0
 def test_perform_move_right(self):
     """Test perform movement function"""
     # Arrange
     expected_output_board = [
         [0, 0, 0, 2],
         [0, 0, 0, 4],
         [0, 0, 0, 2],
         [0, 0, 0, 0],
     ]
     game = Game()
     game.board = [
         [2, 0, 0, 0],
         [2, 2, 0, 0],
         [0, 0, 2, 0],
         [0, 0, 0, 0],
     ]
     # Act
     game.perform_movement("right", insert_number=False)
     # Assert
     self.assertEqual(game.board, expected_output_board)