コード例 #1
0
 @Test
 public void testGetPieceLocation() {
   abg = MockData.abstractBoardGame();
   Piece p = MockData.pieceFactory().createPawn(Color.BLACK);
   Location l = new Location(7, 7, 0);
   abg.addPiece(p, l);
   assert (abg.getByLocation(l).equals(p));
   assert (abg.getByPiece(p).equals(l));
 }
コード例 #2
0
  @Test
  public void testAbg_TR() {
    abg = MockData.abstractBoardGame();
    Piece p = MockData.pieceFactory().createPawn(Color.BLACK);
    Location l1 = new Location(7, 7, 0);
    Location l2 = new Location(7, 6, 0);
    abg.addPiece(p, l1);

    abg.abg_TR(p, l1, l2);
    assert (abg.getByLocation(l1) == null);
    assert (abg.getByLocation(l2).equals(p));
  }
コード例 #3
0
  @Test
  public void testToString() {
    abg = new AbstractBoardGame(8, 8, 2, MockData.pieceFactory());
    Piece p = MockData.pieceFactory().createPawn(Color.BLACK);
    Location l = new Location(7, 7, 0);
    abg.addPiece(p, l);
    p = MockData.pieceFactory().createKing(Color.BLACK);
    l = new Location(2, 3, 0);
    abg.addPiece(p, l);
    p = MockData.pieceFactory().createObstacle();
    l = new Location(1, 6, 0);
    abg.addPiece(p, l);
    System.out.print(abg.toString());

    System.out.print(abg.toString(0));
  }
コード例 #4
0
 @Test
 public void testSetAbstractBoard() {
   abg.setAbstractBoard(
       new AbstractBoard(MockData.CHESS_DIMENSION, MockData.CHESS_DIMENSION - 1, 1));
   assertFalse(abg.getAbstractBoard().equals(MockData.abstractBoard()));
   assertTrue(abg.getByLocation(new Location(7, 7, 0)) == null);
   assertTrue(abg.getByLocation(new Location(6, 6, 0)) != null);
 }
コード例 #5
0
 @Test
 public void testAbstractBoardGameIntegerIntegerInteger() {
   abg =
       new AbstractBoardGame(
           MockData.CHESS_DIMENSION,
           MockData.CHESS_DIMENSION,
           MockData.CHESS_DIMENSION,
           MockData.pieceFactory());
 }
コード例 #6
0
 @Test
 public void testGetAbstractBoard() {
   assertTrue(abg.getAbstractBoard().equals(MockData.abstractBoard()));
 }
コード例 #7
0
 @Test
 public void testAbstractBoardGameAbstractBoard() {
   abg = new AbstractBoardGame(MockData.abstractBoard(), MockData.pieceFactory());
 }
コード例 #8
0
 @Before
 public void initialize() {
   abg = MockData.chessGame();
 }