test functions modified
This commit is contained in:
parent
49601774ca
commit
a4e3247aa6
@ -21,13 +21,12 @@ public class Tester {
|
|||||||
Map playerLocations = dungeon.buildDungeon(new File(param));
|
Map playerLocations = dungeon.buildDungeon(new File(param));
|
||||||
oneill = new Player("ONeill", (Tile) playerLocations.get("oneill"), Direction.NORTH);
|
oneill = new Player("ONeill", (Tile) playerLocations.get("oneill"), Direction.NORTH);
|
||||||
jaffa = new Player("Jaffa", (Tile) playerLocations.get("jaffa"), Direction.NORTH);
|
jaffa = new Player("Jaffa", (Tile) playerLocations.get("jaffa"), Direction.NORTH);
|
||||||
|
replicator = new PlayerBase("Replicator", (Tile) playerLocations.get("replicator"), Direction.NORTH);
|
||||||
return dungeon;
|
return dungeon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listPlayers() {
|
String listPlayers() {
|
||||||
System.out.println(oneill);
|
return oneill.toString() + " " + jaffa.toString() + " " + replicator.toString();
|
||||||
System.out.println(jaffa);
|
|
||||||
System.out.println(replicator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void move(String param) {
|
void move(String param) {
|
||||||
@ -132,23 +131,27 @@ public class Tester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
boolean moveTest(){
|
boolean moveTest() throws IOException{
|
||||||
String[] commands = {"loadMap movetest\n",
|
boolean succes = true;
|
||||||
"listPlayers\n",
|
|
||||||
"move O",
|
loadMap("moveTest");
|
||||||
"listPlayers\n"};
|
|
||||||
|
|
||||||
String[] expectedOutputs = {"ONeill: 1,1\n",
|
String listOfPlayers = listPlayers();
|
||||||
"ONeill: 1,2\n"};
|
if(!listOfPlayers.equals("ONeill: 1, 1 Jaffa: -666, -666 Replicator: -666, -666"))
|
||||||
|
succes = false;
|
||||||
|
|
||||||
boolean results = testOnSequenceOfCommands(commands, expectedOutputs);
|
move("O");
|
||||||
|
|
||||||
|
listOfPlayers = listPlayers();
|
||||||
|
if(!listOfPlayers.equals("ONeill: 1, 2 Jaffa: -666, -666 Replicator: -666, -666"))
|
||||||
|
succes = false;
|
||||||
|
|
||||||
System.out.print("moveTest: ");
|
System.out.print("moveTest: ");
|
||||||
if(results)
|
if(succes)
|
||||||
System.out.println("Sikeres!");
|
System.out.println("Sikeres!");
|
||||||
else System.out.println("Sikertelen!");
|
else System.out.println("Sikertelen!");
|
||||||
|
|
||||||
return results;
|
return succes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -164,6 +167,16 @@ public class Tester {
|
|||||||
String[] expectedOutputs = {"BlueStargate: 5, 10\n",
|
String[] expectedOutputs = {"BlueStargate: 5, 10\n",
|
||||||
"YellowStargate: 5, 9\n",
|
"YellowStargate: 5, 9\n",
|
||||||
"ONeill: 5, 9\n"};
|
"ONeill: 5, 9\n"};
|
||||||
|
loadMap("testStargates");
|
||||||
|
|
||||||
|
shootONeillsGun("B");
|
||||||
|
|
||||||
|
rotate("O", "L");
|
||||||
|
|
||||||
|
shootONeillsGun("Y");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
boolean results = testOnSequenceOfCommands(commands, expectedOutputs);
|
boolean results = testOnSequenceOfCommands(commands, expectedOutputs);
|
||||||
|
|
||||||
System.out.print("testStargates: ");
|
System.out.print("testStargates: ");
|
||||||
|
Loading…
Reference in New Issue
Block a user