|
@ -58,22 +58,23 @@ class GhostTest { |
|
|
void Ghost_chase_chasesPlayer() { |
|
|
void Ghost_chase_chasesPlayer() { |
|
|
// arrange |
|
|
// arrange |
|
|
String[] mapTest = { |
|
|
String[] mapTest = { |
|
|
"wwwww", |
|
|
|
|
|
"w...w", |
|
|
|
|
|
"wwwww" |
|
|
|
|
|
|
|
|
"wwwwwwwwwwwwwwwwwwwwwwwwwwww", |
|
|
|
|
|
"w..........................w", |
|
|
|
|
|
"wwwwwwwwwwwwwwwwwwwwwwwwwwww" |
|
|
}; |
|
|
}; |
|
|
GameManager gameManager = new GameManager(); |
|
|
GameManager gameManager = new GameManager(); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
|
|
|
|
|
|
Vector2 expectedGhostPos = new Vector2(2, 1); |
|
|
|
|
|
|
|
|
Vector2 expectedGhostPos = new Vector2(24, 1); |
|
|
gameManager.player.position = new Vector2(1, 1); |
|
|
gameManager.player.position = new Vector2(1, 1); |
|
|
gameManager.ghosts[0].position = new Vector2(3, 1); |
|
|
|
|
|
|
|
|
gameManager.ghosts[0].position = new Vector2(25, 1); |
|
|
// act |
|
|
// act |
|
|
|
|
|
|
|
|
gameManager.ghosts[0].move(); |
|
|
gameManager.ghosts[0].move(); |
|
|
Vector2 ghostPos = gameManager.ghosts[0].position; |
|
|
Vector2 ghostPos = gameManager.ghosts[0].position; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// assert |
|
|
// assert |
|
|
assertThat(ghostPos).isEqualTo(expectedGhostPos); |
|
|
assertThat(ghostPos).isEqualTo(expectedGhostPos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |