2019-09-10 21:15:31 +02:00
|
|
|
package dev.kske.chess.board;
|
2019-07-08 06:41:10 +02:00
|
|
|
|
2020-01-19 22:12:33 +01:00
|
|
|
import static org.junit.Assert.*;
|
2019-07-08 06:41:10 +02:00
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import dev.kske.chess.board.Piece.Color;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Project: <strong>Chess</strong><br>
|
2019-07-12 10:07:02 +02:00
|
|
|
* File: <strong>BoardTest.java</strong><br>
|
2019-07-08 06:41:10 +02:00
|
|
|
* Created: <strong>08.07.2019</strong><br>
|
|
|
|
* Author: <strong>Kai S. K. Engelbart</strong>
|
|
|
|
*/
|
2019-07-12 10:07:02 +02:00
|
|
|
class BoardTest {
|
2019-07-08 06:41:10 +02:00
|
|
|
|
2020-01-19 22:12:33 +01:00
|
|
|
private Board board;
|
2019-07-08 06:41:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @throws java.lang.Exception
|
|
|
|
*/
|
|
|
|
@BeforeEach
|
|
|
|
void setUp() throws Exception {
|
|
|
|
board = new Board();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-01-19 22:12:33 +01:00
|
|
|
* Test method for {@link Board#Board(Board, boolean)}.
|
2019-07-08 06:41:10 +02:00
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
void testClone() {
|
2019-12-06 23:54:11 +01:00
|
|
|
Board clone = new Board(board, false);
|
2019-07-08 06:41:10 +02:00
|
|
|
assertNotSame(clone, board);
|
|
|
|
assertNotSame(clone.getBoardArr(), board.getBoardArr());
|
|
|
|
|
|
|
|
clone.getBoardArr()[0][0] = new Queen(Color.BLACK, clone);
|
2019-07-22 21:40:25 +02:00
|
|
|
clone.move(new Move(1, 1, 1, 2));
|
2019-07-08 06:41:10 +02:00
|
|
|
assertNotEquals(clone.getBoardArr()[0][0], board.getBoardArr()[0][0]);
|
2020-05-19 16:50:12 +02:00
|
|
|
assertNotEquals(
|
|
|
|
clone.getLog().getActiveColor(),
|
|
|
|
board.getLog().getActiveColor()
|
|
|
|
);
|
2019-07-08 06:41:10 +02:00
|
|
|
}
|
|
|
|
}
|