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

Method canCastleLeft

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

Source from the content-addressed store, hash-verified

165 }
166
167 @Test
168 public void canCastleLeft() {
169 Board board = new Board();
170 board.canCastle[0][1] = false;
171 board.placeKing(0, 4, Color.WHITE);
172 board.placeKing(7, 4, Color.BLACK);
173 board.placeRook(0, 0, Color.WHITE);
174 System.out.println(board);
175 System.out.println(board.getPiece(0, 4).getMoveList(board));
176 Assert.assertEquals(6, board.getPiece(0, 4).getMoveList(board).size());
177 Assert.assertTrue(board.getPiece(0, 4).getMoveList(board).stream().noneMatch(c -> c.captureMove));
178 board.makeMove(board.getPiece(0, 4).getMoveList(board).stream().filter(c -> Math.abs(c.piece.position.col - c.target.col) == 2).findAny().get());
179 System.out.println(board);
180 System.out.println(board.getPiece(0, 2).getMoveList(board));
181 Assert.assertEquals(4, board.getPiece(0, 2).getMoveList(board).size());
182 Assert.assertEquals(11, board.getPiece(0, 3).getMoveList(board).size());
183 }
184
185 @Test
186 public void canCastleRight() {

Callers

nothing calls this directly

Calls 6

placeKingMethod · 0.95
placeRookMethod · 0.95
getPieceMethod · 0.95
makeMoveMethod · 0.95
getMoveListMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected