Esempio n. 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());
 }
Esempio n. 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()));
 }
Esempio n. 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());
  }
Esempio n. 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
 }
Esempio n. 5
0
 @Test
 public void abilityAvailableWhenYouLoaded() {
   round
       .getPlayer(0)
       .addToCollected(
           new int[] {
             20, 20, 20,
             20, 20, 20
           });
   assertEquals(true, round.useAbility(1));
 }
Esempio n. 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();
     }
   }
 }
Esempio n. 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));
 }
Esempio n. 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);
  }
Esempio n. 9
0
  @Test
  public void newBoardDoesSomething() {
    boolean test = false;

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

    }

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

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