Tester.testExtraZPMs() fixed

This commit is contained in:
ericnerdo 2016-04-25 23:58:33 +02:00
parent 0e5681ef7d
commit 1cbaec4d46

View File

@ -108,6 +108,12 @@ public class Tester {
return blue + " " + yellow + " " + red + " " + green;
}
String getConnectedGateOpen(Scale s){
if(s.getGateConnected().isOpen())
return "gate open";
else return "gate closed";
}
/* custom Test annotation */
@Target(ElementType.METHOD) // it's for methods
@Retention(RetentionPolicy.RUNTIME) // we want to retain annotations in runtime
@ -185,43 +191,19 @@ public class Tester {
return succes;
}
@Test
boolean testExtraZPM(){
String[] commands = {"loadMap testExtraZPMs\n",
"listZPMs\n",
"move O\n",
"move O\n",
"listZPMs\n"};
String[] expectedOutputs = {};
loadMap("testExtraZPMs");
boolean results = testOnSequenceOfCommands(commands, expectedOutputs);
System.out.print("testExtraZPMs: ");
if(results)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return results;
}
boolean testScalesAndGates() throws IOException {
boolean succes = true;
String[] commands = {"loadMap testScalesAndGates\n",
"boxLift O\n",
"rotate O L\n",
"boxDrop O\n"};
String[] expectedOutputs = {"door open\n"};
loadMap("testScalesAndGates");
boxLift("O");
rotate("O", "L");
boxDrop("O");
String gateOpen = getConnectedGateOpen((Scale)oneill.getCurrentTile().getAdjacentTile(oneill.facingDirection));
if(!gateOpen.equals("gate open"))
succes = false;
System.out.print("testScalesAndGates: ");
if(succes)
System.out.println("Sikeres!");