|
@ -18,12 +18,10 @@ class VisualizerPlainTextUltraTest { |
|
|
"e.e", |
|
|
"e.e", |
|
|
"w.w" |
|
|
"w.w" |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
GameManager gameManager = new GameManager(); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
vptu.showScore = false; |
|
|
vptu.showScore = false; |
|
|
|
|
|
|
|
|
String expected = "" |
|
|
String expected = "" |
|
|
+ "|''| . |''|\n" |
|
|
+ "|''| . |''|\n" |
|
|
+ "|__| |__|\n" |
|
|
+ "|__| |__|\n" |
|
@ -46,14 +44,11 @@ class VisualizerPlainTextUltraTest { |
|
|
"e.e", |
|
|
"e.e", |
|
|
"w.w" |
|
|
"w.w" |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
GameManager gameManager = new GameManager(); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
vptu.showScore = false; |
|
|
vptu.showScore = false; |
|
|
|
|
|
|
|
|
gameManager.ghosts[0].position = new Vector2(1, 1); |
|
|
gameManager.ghosts[0].position = new Vector2(1, 1); |
|
|
|
|
|
|
|
|
String expected = "" |
|
|
String expected = "" |
|
|
+ "|''| . |''|\n" |
|
|
+ "|''| . |''|\n" |
|
|
+ "|__| |__|\n" |
|
|
+ "|__| |__|\n" |
|
@ -89,20 +84,15 @@ class VisualizerPlainTextUltraTest { |
|
|
"w.w", |
|
|
"w.w", |
|
|
"w.w" |
|
|
"w.w" |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
GameManager gameManager = new GameManager(); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
vptu.showScore = false; |
|
|
vptu.showScore = false; |
|
|
|
|
|
|
|
|
gameManager.Pause(); |
|
|
gameManager.Pause(); |
|
|
|
|
|
|
|
|
String expectedEnd = " Paused! \n\n"; |
|
|
String expectedEnd = " Paused! \n\n"; |
|
|
|
|
|
|
|
|
// act |
|
|
// act |
|
|
vptu.Update(); |
|
|
vptu.Update(); |
|
|
String result = (String)vptu.GetOutput(); |
|
|
String result = (String)vptu.GetOutput(); |
|
|
|
|
|
|
|
|
// assert |
|
|
// assert |
|
|
assertThat(result).endsWith(expectedEnd); |
|
|
assertThat(result).endsWith(expectedEnd); |
|
|
} |
|
|
} |
|
@ -110,18 +100,14 @@ class VisualizerPlainTextUltraTest { |
|
|
@Test |
|
|
@Test |
|
|
void VisualizerPlainTextUtlra_score_isVisualized() { |
|
|
void VisualizerPlainTextUtlra_score_isVisualized() { |
|
|
// arrange |
|
|
// arrange |
|
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
GameManager gameManager = new GameManager(); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
vptu.showScore = true; |
|
|
vptu.showScore = true; |
|
|
|
|
|
|
|
|
gameManager.score = 100; |
|
|
gameManager.score = 100; |
|
|
|
|
|
|
|
|
String expected = "\nSCORE: 100"; |
|
|
String expected = "\nSCORE: 100"; |
|
|
// act |
|
|
// act |
|
|
vptu.Update(); |
|
|
vptu.Update(); |
|
|
String result = (String)vptu.GetOutput(); |
|
|
String result = (String)vptu.GetOutput(); |
|
|
|
|
|
|
|
|
// assert |
|
|
// assert |
|
|
assertThat(result).startsWith(expected); |
|
|
assertThat(result).startsWith(expected); |
|
|
} |
|
|
} |
|
@ -129,19 +115,14 @@ class VisualizerPlainTextUltraTest { |
|
|
@Test |
|
|
@Test |
|
|
void VisualizerPlainTextUtlra_lives_areVisualized() { |
|
|
void VisualizerPlainTextUtlra_lives_areVisualized() { |
|
|
// arrange |
|
|
// arrange |
|
|
|
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
GameManager gameManager = new GameManager(); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); |
|
|
vptu.showScore = true; |
|
|
vptu.showScore = true; |
|
|
|
|
|
|
|
|
gameManager.score = 100; |
|
|
gameManager.score = 100; |
|
|
|
|
|
|
|
|
String expected = "\nSCORE: " + gameManager.score + " LIVES: " + gameManager.livesRemaining + "\n\n"; |
|
|
String expected = "\nSCORE: " + gameManager.score + " LIVES: " + gameManager.livesRemaining + "\n\n"; |
|
|
|
|
|
|
|
|
// act |
|
|
// act |
|
|
vptu.Update(); |
|
|
vptu.Update(); |
|
|
String result = (String)vptu.GetOutput(); |
|
|
String result = (String)vptu.GetOutput(); |
|
|
|
|
|
|
|
|
// assert |
|
|
// assert |
|
|
assertThat(result).startsWith(expected); |
|
|
assertThat(result).startsWith(expected); |
|
|
} |
|
|
} |
|
|