Пример #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());
 }