|
@ -3,6 +3,8 @@ package pacmanTests; |
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.function.IntPredicate; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
import pacmanGame.*; |
|
|
import pacmanGame.*; |
|
@ -34,6 +36,31 @@ class MapTest { |
|
|
assertThat(expectedBottomRight).isEqualTo(bottomRight); |
|
|
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 |
|
|
@Test |
|
|
void Map_getCell_returnsCorrectCells() { |
|
|
void Map_getCell_returnsCorrectCells() { |
|
|
// arrange |
|
|
// arrange |
|
@ -57,7 +84,7 @@ class MapTest { |
|
|
assertThat(expectedMiddle).isEqualTo(middle); |
|
|
assertThat(expectedMiddle).isEqualTo(middle); |
|
|
assertThat(expectedBottomRight).isEqualTo(bottomRight); |
|
|
assertThat(expectedBottomRight).isEqualTo(bottomRight); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void Map_getPath_returnCorrectPathSimple() { |
|
|
void Map_getPath_returnCorrectPathSimple() { |
|
|
// arrange |
|
|
// arrange |
|
|