예제 #1
0
 @Test
 public void captureForwards() {
   board.setPiece("Pawn", 0, 2, Color.WHITE);
   board.setPiece("Pawn", 2, 2, Color.WHITE);
   assertTrue("Pawn captured forwards.", board.movePiece(1, 1, 0, 2));
   board.setPiece("Pawn", 1, 1, Color.BLACK);
   assertTrue("Pawn captured forwards.", board.movePiece(1, 1, 2, 2));
 }
예제 #2
0
 @Test
 public void captureBackwards() {
   board.setPiece("Pawn", 0, 0, Color.WHITE);
   board.setPiece("Pawn", 2, 0, Color.WHITE);
   assertFalse("Pawns cannot capture backwards.", board.movePiece(1, 1, 2, 0));
 }
예제 #3
0
 @Test
 public void moveDiagonal() {
   assertFalse("Pawns cannot move diagonally.", board.movePiece(1, 1, 2, 2));
   assertFalse("Pawns cannot move diagonally.", board.movePiece(1, 1, 0, 0));
 }
예제 #4
0
 @Test
 public void moveHorizontal() {
   assertFalse("Pawns cannot move left.", board.movePiece(1, 1, 0, 1));
   assertFalse("Pawns cannot move right.", board.movePiece(1, 1, 2, 1));
 }
예제 #5
0
 @Test
 public void moveBackwards() {
   assertFalse("Pawns can't move backwards.", board.movePiece(1, 1, 1, 0));
 }
예제 #6
0
 @Test
 public void firstMoveTwoSquares() {
   assertTrue(
       "Pawn can move 2 squares vertically on the first move.", board.movePiece(1, 1, 1, 3));
 }
예제 #7
0
 @Before
 public void setUp() throws Exception {
   board = new Board();
   board.setPiece("Pawn", 1, 1, Color.BLACK);
 }