@Test public void knightCantMoveToSameColorPieceWhite() { game = new Chess(); Knight knight = new Knight(PColor.White); game.setPieceAt(4, 4, knight); game.setPieceAt(2, 3, whitePawn); assertFalse(game.checkMove(4, 4, 2, 3, knight)); }
@Test public void knightCanCapture() { game = new Chess(); Knight knight = new Knight(PColor.Black); game.setPieceAt(4, 4, knight); game.setPieceAt(2, 3, whitePawn); assertTrue(game.checkMove(4, 4, 2, 3, knight)); }
@Test public void bishopMovementDownRightSameColorInPlace() { game = new Chess(); Bishop bishop = new Bishop(PColor.Black); game.setPieceAt(2, 1, bishop); game.setPieceAt(5, 4, blackPawn); assertFalse(game.checkMove(2, 1, 5, 4, bishop)); }
@Test public void bishopMovementDownRightPieceBlocking() { game = new Chess(); Bishop bishop = new Bishop(PColor.Black); game.setPieceAt(2, 1, bishop); game.setPieceAt(4, 3, whitePawn); assertFalse(game.checkMove(2, 1, 5, 4, bishop)); }
@Test public void bishopMovementUpRightPieceBlocking() { game = new Chess(); Bishop bishop = new Bishop(PColor.Black); game.setPieceAt(5, 2, bishop); game.setPieceAt(3, 4, whitePawn); assertFalse(game.checkMove(5, 2, 2, 5, bishop)); }
@Test public void knightMovementDownLeftTwoCols() { game = new Chess(); Knight knight = new Knight(PColor.Black); game.setPieceAt(4, 4, knight); assertTrue(game.checkMove(4, 4, 5, 2, knight)); }
@Test public void knightMovementUpRightOneCol() { game = new Chess(); Knight knight = new Knight(PColor.Black); game.setPieceAt(4, 4, knight); assertTrue(game.checkMove(4, 4, 2, 5, knight)); }
@Test public void knightInvalidMovePatternTooFewCols2() { game = new Chess(); Knight knight = new Knight(PColor.Black); game.setPieceAt(4, 4, knight); assertFalse(game.checkMove(4, 4, 3, 4, knight)); }
@Test public void bishopMovementDownLeft() { game = new Chess(); Bishop bishop = new Bishop(PColor.Black); game.setPieceAt(2, 5, bishop); assertTrue(game.checkMove(2, 5, 5, 2, bishop)); }
@Test public void bishopInvalidMovement() { game = new Chess(); Bishop bishop = new Bishop(PColor.Black); game.setPieceAt(5, 5, bishop); assertFalse(game.checkMove(5, 5, 5, 2, bishop)); }