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

Method castleFail

src/test/java/BoardTest.java:97–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 }
96
97 @Test(expected = NoSuchElementException.class)
98 public void castleFail() {
99 Board board = new Board();
100 board.placeKing(0, 4, Color.WHITE);
101 board.placeKing(7, 4, Color.BLACK);
102 board.placeRook(7, 7, Color.BLACK);
103 board.placeRook(7, 0, Color.BLACK);
104 board.placeBishop(7, 2, Color.BLACK);
105 board.placePawn(6, 5, Color.BLACK);
106 board.placePawn(6, 6, Color.BLACK);
107 board.placeRook(4, 7, Color.WHITE);
108 System.out.println(board);
109 System.out.println(board.getPiece(7, 4).getMoveList(board));
110 Assert.assertEquals(5, board.getPiece(7, 4).getMoveList(board).size());
111 Assert.assertTrue(board.getPiece(7, 4).getMoveList(board).stream().anyMatch(c -> Math.abs(c.piece.position.col - c.target.col) == 2));
112 board.makeMove(board.getPiece(4, 7).getMoveList(board).stream().filter(c -> c.captureMove).findAny().get());
113 System.out.println(board);
114 System.out.println(board.getPiece(7, 4).getMoveList(board));
115 board.makeMove(board.getPiece(7, 4).getMoveList(board).stream().filter(c -> Math.abs(c.piece.position.col - c.target.col) == 2).findAny().get());
116 }
117
118 @Test(expected = NoSuchElementException.class)
119 public void castleFailWithKnightCapture() {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected