コード例 #1
0
 @Test
 public void makeMoveWorksWithMoveChangesPlayer() {
   Move move = round.findMoves().get(0);
   round.makeMove(move.getY(), move.getX());
   round.makeMove(move.getY2(), move.getX2());
   assertEquals(false, round.isHumanTurn());
 }
コード例 #2
0
 @Test
 public void makeMoveWorksWithMoveAfterMoveCancel() {
   round.makeMove(0, 0);
   round.makeMove(0, 0);
   Move move = round.findMoves().get(0);
   round.makeMove(move.getY(), move.getX());
   assertEquals(true, round.makeMove(move.getY2(), move.getX2()));
 }
コード例 #3
0
  @Test(timeout = 4000)
  public void opponentReturnsTheTurn() {
    Move move = round.findMoves().get(0);
    round.makeMove(move.getY(), move.getX());
    round.makeMove(move.getY2(), move.getX2());
    while (round.makeMove(0, 0) == false) {}

    assertEquals(true, round.isHumanTurn());
  }
コード例 #4
0
 @Test
 public void makeMoveDoesntWorkIfEarlierNotCancelled() {
   Move move = round.findMoves().get(0);
   int y = Math.max(size - 1, move.getY());
   round.makeMove(y, 0);
   boolean test = round.makeMove(move.getY(), move.getX());
   assertEquals(true, round.makeMove(move.getY2(), move.getX2()) == test);
   // makeMoven ei pitäisi palauttaa true kahdesti peräkkäin
 }