MCPcopy Index your code
hub / github.com/coding-parrot/chess-engine / castleNotBlockedByCheck

Method castleNotBlockedByCheck

src/test/java/KingTest.java:254–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

252 }
253
254 @Test
255 public void castleNotBlockedByCheck() {
256 Board board = new Board();
257 board.placeKing(0, 4, Color.WHITE);
258 board.placeKing(7, 4, Color.BLACK);
259 board.placeRook(0, 7, Color.WHITE);
260 board.placeRook(0, 0, Color.WHITE);
261 board.placeBishop(0, 2, Color.WHITE);
262 board.placePawn(1, 5, Color.WHITE);
263 board.placePawn(1, 6, Color.WHITE);
264 board.placeRook(5, 7, Color.BLACK);
265 System.out.println(board);
266 System.out.println(board.getPiece(0, 4).getMoveList(board));
267 Assert.assertEquals(5, board.getPiece(0, 4).getMoveList(board).size());
268 Assert.assertTrue(board.getPiece(0, 4).getMoveList(board).stream().anyMatch(c -> Math.abs(c.piece.position.col - c.target.col) == 2));
269 board.makeMove(board.getPiece(0, 4).getMoveList(board).stream().filter(c -> Math.abs(c.piece.position.col - c.target.col) == 2).findAny().get());
270 System.out.println(board);
271 System.out.println(board.getPiece(0, 6).getMoveList(board));
272 Assert.assertTrue(board.getPiece(0, 6).getMoveList(board).isEmpty());
273 Assert.assertEquals(2, board.getPiece(0, 5).getMoveList(board).size());
274 }
275
276 @Test
277 public void castleBlockedByCheckBlack() {

Callers

nothing calls this directly

Calls 9

placeKingMethod · 0.95
placeRookMethod · 0.95
placeBishopMethod · 0.95
placePawnMethod · 0.95
getPieceMethod · 0.95
makeMoveMethod · 0.95
isEmptyMethod · 0.80
getMoveListMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected