Commit 0fd7836a authored by Farah Matta's avatar Farah Matta

Test fonctionnel fini

parent 3980ed2e
......@@ -67,6 +67,7 @@ public class Pawn {
this.gold=g;
}
/**
* Creates a Pawn with 2 hitpoints and 0 gold.
* @param n The letter that represents the pawn.
......@@ -150,6 +151,7 @@ public class Pawn {
if (enemy.isDead()) gold++;
if (message != "")
return message;
else
return "";
}
......
......@@ -20,8 +20,6 @@ public class PawnTest {
assertEquals('F',pawn.getLetter());
}
@Test //Fonctionnel - Spec3
public void moveTest() throws OutOfBoardException {
board.removeAllPawns();
......@@ -37,6 +35,40 @@ public class PawnTest {
assertTrue(p.getX()==3);
}
@Test //Fonctionnel - Spec4
public void attackTest() throws OutOfBoardException {
board.removeAllPawns();
Pawn p = new Pawn('A',3,3,board);
Pawn p2= new Pawn('B',2,3,board);
board.addPawn(p);
board.addPawn(p2);
p.move(Direction.Left);
}
@Test //Fonctionnel - Spec4
public void attackTestBonus() throws OutOfBoardException {
board.removeAllPawns();
Pawn p = new Pawn('A',2,3,board);
Pawn p2= new Pawn('B',3,3,board);
board.addPawn(p);
board.addPawn(p2);
p.move(Direction.Right);
p.move(Direction.Right);
p.move(Direction.Right);
}
/*@Test //Fonctionnel - Spec3
public void moveTest2() throws OutOfBoardException {
board.removeAllPawns();
Pawn p = new Pawn('A',0,0,board);
board.addPawn(p);
p.move(Direction.Up);
//assertEquals("This square does not exist: 5,6",p.move(Direction.Up));
}*/
@Test //Fonctionnel - Spec5
public void getHitpointsTest() {
assertEquals(6,pawn.getHitpoints());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment