Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete Castling Tests Comprehensiveness #14

Open
frozenfrank opened this issue Jan 26, 2025 · 0 comments
Open

Complete Castling Tests Comprehensiveness #14

frozenfrank opened this issue Jan 26, 2025 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@frozenfrank
Copy link
Member

Overview

Naive implements of Castling could get away with it because of spotty test coverage.

Discussion

The Castling tests, along with other tests, were designed to give us a "good enough" assurance that the code was implemented properly. Each of the conditions are tested, but most are only tested from a single perspective.

Reasonable implementations of chess would work if all of these tests work, but students do all sorts of ugly, horrific, and unreasonable things to their code. We should make sure we test it properly.

This visualization was first introduced when the castling tests were most recently factored in #13.

Visualization

The current state of the tested conditions is as follows. Notice the significant holes.

Stated Condition Tested for "White" Tested for "Black"
King can castle correctly castleWhite castleBlack
Neither the King nor Rook have moved since the game started noCastleAfterMove
There are no pieces between the King and the Rook noCastleThroughPieces
The King does not start in Check noCastleFromCheck
[The King] does not cross a square on which it would be in Check noCastleThroughCheck
[The King] is not in Check after castling noCastleIntoCheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant