示例#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
 }
示例#5
0
 @Test
 public void abilityAvailableWhenYouLoaded() {
   round
       .getPlayer(0)
       .addToCollected(
           new int[] {
             20, 20, 20,
             20, 20, 20
           });
   assertEquals(true, round.useAbility(1));
 }
示例#6
0
 @Test
 public void onlyListMovesAllowed() {
   List<Move> list = round.findMoves();
   for (int i = 0; i < round.getBoardSize(); i++) {
     Move move = new Move(0, i, 1, i);
     if (!list.contains(move)) {
       assertEquals(false, round.switchPieces(move));
       i = round.getBoardSize();
     }
   }
 }
示例#7
0
 @Test
 public void noAbilitySpamEvenWhenYouLoaded() {
   round
       .getPlayer(0)
       .addToCollected(
           new int[] {
             70, 0, 0,
             0, 0, 0
           });
   round.useAbility(1);
   assertEquals(false, round.useAbility(1));
 }
示例#8
0
  @Test(timeout = 1300) // Kestää pitkään, kun tekee paljon liikkeitä
  public void cannotExhaustMovesInOneSecond() {
    boolean moves = true;

    Calendar c = Calendar.getInstance();
    c.add(Calendar.SECOND, 1);
    while (Calendar.getInstance().compareTo(c) < 0) {
      try {
        Move move = round.findMoves().get(0);
        round.switchPieces(move);
      } catch (Exception e) {
        moves = false;
        break;
      }
    }
    assertEquals(moves, true);
  }
示例#9
0
  @Test
  public void newBoardDoesSomething() {
    boolean test = false;

    try {
      round.getTypeAt(0, 0);
      test = true;
    } catch (Exception e) {

    }

    assertEquals(true, test);
  }
示例#10
0
 @Before
 public void setUp() {
   round = new GameRound();
   round.newBoard();
   size = round.getBoardSize();
 }
示例#11
0
 @Test
 public void noAbilityUseWithoutResources() {
   assertEquals(false, round.useAbility(0));
 }
示例#12
0
 @Test
 public void typesAreNotJustZeroes2() {
   assertEquals(
       true,
       round.getTypeAt(1, 0) != 0 || round.getTypeAt(1, 1) != 0 || round.getTypeAt(1, 2) != 0);
 }
示例#13
0
 @Test
 public void startWithHumanTurn() {
   assertEquals(true, round.isHumanTurn());
 }
示例#14
0
  @Test
  public void movesWork3() {
    List<Move> list = round.findMoves();

    assertEquals(round.switchPieces(list.get(Math.min(0, 2))), true);
  }
示例#15
0
 @Test
 public void twoPlayers() {
   assertEquals(false, round.getPlayer(1) == null);
 }
示例#16
0
 @Test
 public void typesAreNotJustOnes() {
   assertEquals(
       true,
       round.getTypeAt(0, 0) != 1 || round.getTypeAt(0, 1) != 1 || round.getTypeAt(0, 2) != 1);
 }
示例#17
0
 @Test
 public void noFarSwitch() {
   assertEquals(false, round.switchPieces(0, 0, size - 1, size - 1));
 }
示例#18
0
 @Test
 public void movesNotNull() {
   assertEquals(false, round.findMoves() == null);
 }
示例#19
0
 @Test
 public void movesNotEmpty() {
   assertEquals(false, round.findMoves().isEmpty());
 }