Skip to content

Commit

Permalink
Restore attacks test
Browse files Browse the repository at this point in the history
  • Loading branch information
veloce committed Aug 1, 2024
1 parent 6d154d2 commit 059b916
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/attacks_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,33 @@ void main() {
. . . . . . . .
'''));
});

test('Legal board position asserts for attacks', () {
const illegalBoardPosition = 65;
const emptySquareSet = SquareSet.empty;

expect(() {
kingAttacks(Square(illegalBoardPosition));
}, throwsA(isA<AssertionError>()));

expect(() {
pawnAttacks(Side.white, Square(illegalBoardPosition));
}, throwsA(isA<AssertionError>()));

expect(() {
knightAttacks(Square(illegalBoardPosition));
}, throwsA(isA<AssertionError>()));

expect(() {
bishopAttacks(Square(illegalBoardPosition), emptySquareSet);
}, throwsA(isA<AssertionError>()));

expect(() {
rookAttacks(Square(illegalBoardPosition), emptySquareSet);
}, throwsA(isA<AssertionError>()));

expect(() {
queenAttacks(Square(illegalBoardPosition), emptySquareSet);
}, throwsA(isA<AssertionError>()));
});
}

0 comments on commit 059b916

Please sign in to comment.