@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(); } } }
@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); }
@Test public void noFarSwitch() { assertEquals(false, round.switchPieces(0, 0, size - 1, size - 1)); }
@Test public void movesWork3() { List<Move> list = round.findMoves(); assertEquals(round.switchPieces(list.get(Math.min(0, 2))), true); }