Tester.rotate() modified
This commit is contained in:
parent
1d2171b713
commit
0b170e99e9
@ -43,7 +43,7 @@ public class Tester {
|
||||
}
|
||||
}
|
||||
|
||||
void boxLift(String param) {
|
||||
String boxLift(String param) {
|
||||
switch (param) {
|
||||
case "O" :
|
||||
oneill.boxLift();
|
||||
@ -52,9 +52,10 @@ public class Tester {
|
||||
jaffa.boxLift();
|
||||
break;
|
||||
}
|
||||
return "box lifted";
|
||||
}
|
||||
|
||||
void boxDrop(String param) {
|
||||
String boxDrop(String param) {
|
||||
switch (param) {
|
||||
case "O" :
|
||||
oneill.boxDrop();
|
||||
@ -63,6 +64,7 @@ public class Tester {
|
||||
oneill.boxDrop();
|
||||
break;
|
||||
}
|
||||
return "box dropped";
|
||||
}
|
||||
|
||||
void shootONeillsGun(String param) {
|
||||
@ -76,26 +78,29 @@ public class Tester {
|
||||
}
|
||||
}
|
||||
|
||||
void rotate(String playerParam, String directionParam) {
|
||||
String rotate(String playerParam, String directionParam) {
|
||||
switch (playerParam) {
|
||||
case "O" :
|
||||
switch (directionParam) {
|
||||
case "L" :
|
||||
oneill.rotateLeft();
|
||||
break;
|
||||
return oneill.getFacingDirection().toString();
|
||||
case "R" :
|
||||
oneill.rotateRight();
|
||||
break;
|
||||
return oneill.getFacingDirection().toString();
|
||||
default: return "Hiba, nem fordult!";
|
||||
}
|
||||
case "J" :
|
||||
switch (directionParam) {
|
||||
case "L" :
|
||||
jaffa.rotateLeft();
|
||||
break;
|
||||
return jaffa.getFacingDirection().toString();
|
||||
case "R" :
|
||||
jaffa.rotateRight();
|
||||
break;
|
||||
return jaffa.getFacingDirection().toString();
|
||||
default: return "Hiba, nem fordult!";
|
||||
}
|
||||
default: return "Hiba, nem létező játékos!";
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,21 +302,20 @@ public class Tester {
|
||||
|
||||
@Test
|
||||
boolean testBoxes(){
|
||||
String[] commands = {"loadMap testBoxes\n",
|
||||
"boxLift\n",
|
||||
"boxDrop\n"};
|
||||
boolean succes = true;
|
||||
|
||||
String[] expectedOutputs = {"boc3 lifted\n",
|
||||
"box3 dropped\n"};
|
||||
if(!boxLift("O").equals("box lifted"))
|
||||
succes = false;
|
||||
|
||||
boolean results = testOnSequenceOfCommands(commands, expectedOutputs);
|
||||
if(!boxDrop("O").equals("box dropped"))
|
||||
succes = false;
|
||||
|
||||
System.out.print("testBoxes: ");
|
||||
if(results)
|
||||
if(succes)
|
||||
System.out.println("Sikeres!");
|
||||
else System.out.println("Sikertelen!");
|
||||
|
||||
return results;
|
||||
return succes;
|
||||
}
|
||||
|
||||
private boolean testOnSequenceOfCommands(String[] commands, String[] expectedOutputs) {
|
||||
|
Loading…
Reference in New Issue
Block a user