|
@ -5,9 +5,7 @@ import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
import pacmanGame.GameManager; |
|
|
|
|
|
import pacmanGame.Map; |
|
|
|
|
|
import pacmanGame.VisualizerPlainText; |
|
|
|
|
|
|
|
|
import pacmanGame.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GameManagerTest { |
|
|
class GameManagerTest { |
|
@ -48,4 +46,33 @@ class GameManagerTest { |
|
|
// assert |
|
|
// assert |
|
|
assertThat(initialVptOutput).isNotEqualTo(updatedVptOutput); |
|
|
assertThat(initialVptOutput).isNotEqualTo(updatedVptOutput); |
|
|
} |
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
void GameManager_GostPlayerColisionTest_DetectsColosion() { |
|
|
|
|
|
|
|
|
|
|
|
// arrange |
|
|
|
|
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
|
|
|
gameManager.player.position = gameManager.ghosts[0].position.Clone(); |
|
|
|
|
|
//act |
|
|
|
|
|
boolean colision = gameManager.GostPlayerColisionTest(); |
|
|
|
|
|
boolean expected = true; |
|
|
|
|
|
|
|
|
|
|
|
// assert |
|
|
|
|
|
assertThat(colision).isEqualTo(expected); |
|
|
|
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
void GameManager_GostPlayerColisionTest_DoesntDetectColosion() { |
|
|
|
|
|
|
|
|
|
|
|
// arrange |
|
|
|
|
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
|
|
|
gameManager.player.position = new Vector2(2,3); |
|
|
|
|
|
gameManager.ghosts[0].position = new Vector2(4,5); |
|
|
|
|
|
//act |
|
|
|
|
|
boolean colision = gameManager.GostPlayerColisionTest(); |
|
|
|
|
|
boolean expected = false; |
|
|
|
|
|
|
|
|
|
|
|
// assert |
|
|
|
|
|
assertThat(colision).isEqualTo(expected); |
|
|
|
|
|
} |
|
|
} |
|
|
} |