|
|
@ -26,28 +26,28 @@ class ChessBoardTest { |
|
|
|
@Test |
|
|
|
void initBoard() { |
|
|
|
ChessFigure[][] board = chessBoard.getBoard(); |
|
|
|
for (int x = 0; x < board.length; x++) { |
|
|
|
for (int y = 0; y < board[0].length; y++) { |
|
|
|
for (int x = 0; x < board[0].length; x++) { |
|
|
|
for (int y = 0; y < board.length; y++) { |
|
|
|
//test pawns |
|
|
|
if (y == 1) { |
|
|
|
assertEquals(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.BLACK), board[x][y]); |
|
|
|
assertEquals(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.BLACK), board[y][x]); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(y == 6) { |
|
|
|
assertEquals(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.WHITE), board[x][y]); |
|
|
|
assertEquals(new ChessFigure(ChessFigure.Type.PAWN, ChessFigure.Team.WHITE), board[y][x]); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if(y == 0){ |
|
|
|
assertEquals(new ChessFigure(startOrder[x], ChessFigure.Team.BLACK), board[x][y]); |
|
|
|
assertEquals(new ChessFigure(startOrder[x], ChessFigure.Team.BLACK), board[y][x]); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(y == 7){ |
|
|
|
assertEquals(new ChessFigure(startOrder[x], ChessFigure.Team.WHITE), board[x][y]); |
|
|
|
assertEquals(new ChessFigure(startOrder[x], ChessFigure.Team.WHITE), board[y][x]); |
|
|
|
continue; |
|
|
|
} |
|
|
|
//rest should be empty(null) |
|
|
|
assertNull(board[x][y]); |
|
|
|
assertNull(board[y][x]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |