Merge branch 'cica'

Tester methods modified
This commit is contained in:
ericnerdo 2016-04-26 00:57:22 +02:00
commit 651069d762
3 changed files with 87 additions and 30 deletions

View File

@ -30,4 +30,8 @@ public class Player extends PlayerBase {
public void shootStargate(Stargate stargate) {
this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection);
}
public int getZPMCount(){
return zpmContainer.size();
}
}

View File

@ -5,11 +5,13 @@ public class PlayerBase implements Destroyable {
protected Tile currentTile;
protected Direction facingDirection;
protected String name;
protected boolean destroyed;
public PlayerBase(String name, Tile startTile, Direction startDirection) {
this.name = name;
currentTile = startTile;
facingDirection = startDirection;
destroyed = false;
}
@Override
@ -18,6 +20,7 @@ public class PlayerBase implements Destroyable {
}
public void destroy() {
destroyed = true;
}
public Tile getCurrentTile() {
@ -78,4 +81,8 @@ public class PlayerBase implements Destroyable {
public void setFacingDirection(Direction direction) {
facingDirection = direction;
}
public boolean isDestroyed(){
return destroyed;
}
}

View File

@ -145,31 +145,31 @@ public class Tester {
@Test
boolean moveTest() throws IOException{
boolean succes = true;
boolean success = true;
loadMap("moveTest");
String listOfPlayers = listPlayers();
if(!listOfPlayers.equals("ONeill: 1, 1 Jaffa: -666, -666 Replicator: -666, -666"))
succes = false;
success = false;
move("O");
listOfPlayers = listPlayers();
if(!listOfPlayers.equals("ONeill: 1, 2 Jaffa: -666, -666 Replicator: -666, -666"))
succes = false;
success = false;
System.out.print("moveTest: ");
if(succes)
if(success)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return succes;
return success;
}
@Test
boolean testStargates() throws IOException{
boolean succes = true;
boolean success = true;
loadMap("testStargates");
shootONeillsGun("B");
@ -178,7 +178,7 @@ public class Tester {
String listOfStargates = listStargates();
if(!listOfStargates.equals("BlueStargate: 5, 10 YellowStargate: 10, 5 RedStargate: not spawned GreenStargate: not spawned"))
succes = false;
success = false;
move("O");
move("O");
@ -186,19 +186,23 @@ public class Tester {
String listOfPlayers = listPlayers();
if(!listOfPlayers.equals("ONeill: 5, 9 Jaffa: -666, -666 Replicator: -666, -666"))
succes = false;
success = false;
System.out.print("testStargates: ");
if(succes)
if(success)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return succes;
return success;
}
@Test
boolean testScalesAndGates() throws IOException {
<<<<<<< HEAD
boolean succes = true;
=======
boolean success = true;
>>>>>>> cica
loadMap("testScalesAndGates");
boxLift("O");
@ -208,50 +212,52 @@ public class Tester {
String gateOpen = getConnectedGateOpen((Scale)oneill.getCurrentTile().getAdjacentTile(oneill.facingDirection));
if(!gateOpen.equals("gate open"))
<<<<<<< HEAD
succes = false;
=======
success = false;
>>>>>>> cica
System.out.print("testScalesAndGates: ");
if(succes)
if(success)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return succes;
return success;
}
@Test
boolean gapTest(){
String[] commands = {"loadMap gapTest\n",
"move O\n"};
String[] expectedOutputs = {};
boolean results = testOnSequenceOfCommands(commands, expectedOutputs);
boolean gapTest() throws IOException{
loadMap("gapTest");
move("O");
boolean success = oneill.isDestroyed();
System.out.print("gapTest: ");
if(results)
if(success)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return results;
return success;
}
@Test
boolean ZPMTest() throws IOException{
boolean succes = true;
String[] commands = {"loadMap ZPMTest\n",
"move O\n"};
String[] expectedOutputs = {};
boolean success = true;
loadMap("ZPMTest");
move("O");
if(oneill.getZPMCount() != 1)
success = false;
System.out.print("ZPMTest: ");
if(succes)
if(success)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return succes;
return success;
}
@Test
@ -285,17 +291,30 @@ public class Tester {
return results;
}
<<<<<<< HEAD
@Test
boolean rotationTest() {
String[] commands = {"loadMap rotationTest\n",
"Rotate O L\n",
"Rotate O R\n"};
=======
>>>>>>> cica
String[] expectedOutputs = {};
boolean results = testOnSequenceOfCommands(commands, expectedOutputs);
@Test
boolean rotationTest() throws IOException {
boolean success = true;
loadMap("rotationTest");
if(!rotate("O", "L").equals("WEST"))
success = false;
if(!rotate("O", "R").equals("NORTH"))
success = false;
System.out.print("rotationTest: ");
<<<<<<< HEAD
return true; //TODO check this
}
@ -316,6 +335,33 @@ public class Tester {
else System.out.println("Sikertelen!");
return succes;
=======
if(success)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return success;
}
@Test
boolean testBoxes() throws IOException{
boolean success = true;
loadMap("testBoxes");
if(!boxLift("O").equals("box lifted"))
success = false;
if(!boxDrop("O").equals("box dropped"))
success = false;
System.out.print("testBoxes: ");
if(success)
System.out.println("Sikeres!");
else System.out.println("Sikertelen!");
return success;
>>>>>>> cica
}
private boolean testOnSequenceOfCommands(String[] commands, String[] expectedOutputs) {