Testing

Test Coverage

The board interpreter test suite is located in board_interpreter_test.cpp. It covers:

  • Coordinate conversion: round-trip tests for fromFEN/toFEN and toSquareIndex/fromSquareIndex.

  • Path generation: correctness tests for all six piece types including edge cases (pawn double move, knight at board corners, king move).

  • Blocker detection: tests with zero, one, and multiple blockers at various positions on a path.

  • Parking spot finding: empty board, fully occupied board, and paths where all nearby squares are excluded.

  • A* pathfinding: clear board, simple obstacles, and constrained configurations.

  • Move planning: end-to-end tests for moves with no blockers, single blockers, multiple blockers, and captures.

Additionally, captured_piece_test.cpp validates the interaction between the board interpreter and the gantry controller for capture moves, ensuring the captured piece is handled before the primary move path is traversed.

Running Tests

Build and run the test suite with CMake:

cd build
cmake .. -DBUILD_TESTS=ON
make
ctest --output-on-failure