Conflicts:
	src/test/java/inf112/fiasko/roborally/objects/BoardTest.java
This commit is contained in:
GabrielMagnus
2020-03-16 16:54:41 +01:00
5 changed files with 64 additions and 1 deletions

View File

@ -67,6 +67,8 @@ public class BoardTest {
wallGrid.setElement(2, 1, new Wall(WallType.WALL_NORMAL, Direction.SOUTH));
wallGrid.setElement(2, 2, new Wall(WallType.WALL_NORMAL, Direction.EAST));
wallGrid.setElement(1, 2, new Wall(WallType.WALL_CORNER, Direction.NORTH_EAST));
tileGrid.setElement(3,3, new Tile(TileType.FLAG_1, Direction.NORTH));
tileGrid.setElement(2,2, new Tile(TileType.FLAG_2, Direction.NORTH));
board = new Board(tileGrid, wallGrid, robotList);
Grid<Tile> tileGridAllTypes = new Grid<>(6,6);
@ -93,6 +95,23 @@ public class BoardTest {
tileTypeNumberMap.put(TileType.COGWHEEL_LEFT, 1);
tileTypeNumberMap.put(TileType.TILE, 5);
boardWithDifferentAmountOfAllTypes = new Board(tileGridAllTypes,wallGridAllTypes,emptyRobotList);
}
@Test
public void flagGetsUpdatedOnRobotWithCorrectLastVisitedFlag() {
Robot testRobot = robotList.get(6);
assertEquals(0,testRobot.getLastFlagVisited());
board.updateFlagOnRobot(RobotID.ROBOT_7, TileType.FLAG_1);
assertEquals(1,testRobot.getLastFlagVisited());
}
@Test
public void flagDoesNotUpdatedOnRobotWithWringLastVisitedFlag() {
Robot testRobot = robotList.get(6);
assertEquals(0,testRobot.getLastFlagVisited());
board.updateFlagOnRobot(RobotID.ROBOT_7, TileType.FLAG_2);
assertEquals(0,testRobot.getLastFlagVisited());
}
@Test