diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 96160ca..be98221 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/src/main/java/pacmanGame/GameManager.java @@ -45,15 +45,7 @@ public class GameManager { default: break; } - time++; - /* - if(time == 300) { - spawnCherry(); - } - if (time == 600) { - destroyCherry(); - }*/ - + time++; } public void spawnCherry() { diff --git a/src/test/java/pacmanTests/MapTest.java b/src/test/java/pacmanTests/MapTest.java index 723fa63..571d8eb 100644 --- a/src/test/java/pacmanTests/MapTest.java +++ b/src/test/java/pacmanTests/MapTest.java @@ -3,6 +3,8 @@ package pacmanTests; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.*; +import java.util.function.IntPredicate; + import org.junit.jupiter.api.Test; import pacmanGame.*; @@ -34,6 +36,31 @@ class MapTest { assertThat(expectedBottomRight).isEqualTo(bottomRight); } + @Test + void Map_getCell_returnsExceptionCells() { + // arrange + String[] mapTest = { + "eew", + "e..", + "ww." + }; + GameManager gameManager = new GameManager(); + gameManager.map = new Map(mapTest, gameManager); + Map testMap = gameManager.map; + Cell expectedTopLeft = testMap.cells[2][0]; + Cell expectedMiddle = testMap.cells[1][1]; + Cell expectedBottomRight = testMap.cells[0][2]; + // act + Cell topLeft = testMap.GetCell(new Vector2(2, 0)); + Cell middle = testMap.GetCell(new Vector2(1, 1)); + Cell bottomRight = testMap.GetCell(new Vector2(0, 2)); + IntPredicate expectedTopRight; + // assert + assertThat(expectedTopLeft).isEqualTo(topLeft); + assertThat(expectedMiddle).isEqualTo(middle); + assertThat(expectedBottomRight).isEqualTo(bottomRight); + } + @Test void Map_getCell_returnsCorrectCells() { // arrange @@ -57,7 +84,7 @@ class MapTest { assertThat(expectedMiddle).isEqualTo(middle); assertThat(expectedBottomRight).isEqualTo(bottomRight); } - + @Test void Map_getPath_returnCorrectPathSimple() { // arrange