@Test public void sideMoves() { this.board.move('d', 2, 'd', 4); this.board.move('e', 7, 'e', 5); boolean ok = true; String s1 = "e5"; String s2 = "d5"; for (Square square : wPawn.whereToMove(board, board.getSquare('d', 4)).getList()) { if (!square.toString().equals(s1) && !square.toString().equals(s2)) { ok = false; } } this.board.move('f', 2, 'f', 4); s1 = "e4"; s2 = "d4"; String s3 = "f4"; for (Square square : bPawn.whereToMove(board, board.getSquare('e', 5)).getList()) { if (!square.toString().equals(s1) && !square.toString().equals(s2) && !square.toString().equals(s3)) { ok = false; } } assertEquals(true, ok); }
@Test public void FirstPawnMovesTest() { SquareList wSquares = wPawn.whereToMove(board, board.getSquare('e', 2)); SquareList bSquares = bPawn.whereToMove(board, board.getSquare('e', 7)); boolean ok = true; if (wSquares.size() != 2 || bSquares.size() != 2) { ok = false; } String s1 = "e3"; String s2 = "e4"; for (Square square : wSquares.getList()) { if (!square.toString().equals(s1) && !square.toString().equals(s2)) { ok = false; } } s1 = "e6"; s2 = "e5"; for (Square square : bSquares.getList()) { if (!square.toString().equals(s1) && !square.toString().equals(s2)) { ok = false; } } assertEquals(true, ok); }
@Test public void valueTest() { assertEquals(1, wPawn.getValue()); assertEquals(1, bPawn.getValue()); }