mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
Conflicts: src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java
This commit is contained in:
commit
0e3245f721
@ -67,6 +67,24 @@ public class PhaseTest {
|
||||
assertEquals(RobotID.ROBOT_1, board.getRobotOnPosition(robot1Position));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void playerWinsAfterTouchingAllFlagsInCorrectOrder() {
|
||||
FakeGame testGame = new FakeGame();
|
||||
List<Robot> robot = new ArrayList<>();
|
||||
List<Player> player = new ArrayList<>();
|
||||
robot.add(new Robot(RobotID.ROBOT_1, new Position(0,0)));
|
||||
player.add(new Player(RobotID.ROBOT_1, "Player 1"));
|
||||
|
||||
try {
|
||||
board = BoardLoaderUtil.loadBoard("boards/win_test_board.txt", robot);
|
||||
Phase testPhase = new Phase(board, player, 0, testGame);
|
||||
testPhase.checkAllFlags();
|
||||
assertEquals("Player 1", testGame.getWinningPlayerName());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void robotRegistersFlagWhenOnCorrectOne() {
|
||||
assertEquals(robot3.getLastFlagVisited(), 0);
|
||||
|
3
src/test/resources/boards/win_test_board.txt
Normal file
3
src/test/resources/boards/win_test_board.txt
Normal file
@ -0,0 +1,3 @@
|
||||
1 1
|
||||
17;1
|
||||
0
|
Loading…
x
Reference in New Issue
Block a user