2019-05-23 12:26:28 +02:00
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
2019-05-23 13:25:30 +02:00
|
|
|
import joueurs.Joueur;
|
2019-05-23 12:26:28 +02:00
|
|
|
import piecesEchiquier.*;
|
|
|
|
|
|
|
|
class testGeneraux {
|
|
|
|
private Echiquier e;
|
2019-05-23 13:25:30 +02:00
|
|
|
private Joueur jb;
|
2019-05-23 12:26:28 +02:00
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
public void initialisation() {
|
|
|
|
e = new Echiquier();
|
2019-05-23 13:25:30 +02:00
|
|
|
jb = new Joueur("Joueur Blanc","Blanc");
|
2019-05-23 12:26:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void testEchiquier() {
|
|
|
|
//toString
|
|
|
|
assertEquals("8 TN CN FN QN KN FN CN TN \n"
|
|
|
|
+ "7 PN PN PN PN PN PN PN PN \n"
|
|
|
|
+ "6 .. .. .. .. .. .. .. .. \n"
|
|
|
|
+ "5 .. .. .. .. .. .. .. .. \n"
|
|
|
|
+ "4 .. .. .. .. .. .. .. .. \n"
|
|
|
|
+ "3 .. .. .. .. .. .. .. .. \n"
|
|
|
|
+ "2 PB PB PB PB PB PB PB PB \n"
|
|
|
|
+ "1 TB CB FB QB KB FB CB TB \n"
|
|
|
|
+ " A B C D E F G H", e.toString());
|
|
|
|
|
|
|
|
//verificationMouvement fait dans test piece
|
|
|
|
|
|
|
|
//estVide
|
|
|
|
/*Position p = new Position(3, 6);
|
|
|
|
assertTrue(e.estVide(p));*/
|
2019-05-23 13:25:30 +02:00
|
|
|
for (int x = 1; x < 9; x++) {
|
|
|
|
for (int y = 3; y < 7; y++) {
|
|
|
|
Position p = new Position(x, y);
|
2019-05-23 12:26:28 +02:00
|
|
|
assertTrue(e.estVide(p));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-23 13:25:30 +02:00
|
|
|
for (int x = 1; x < 9; x++) {
|
|
|
|
for (int y = 1; y < 3; y++) {
|
|
|
|
Position p = new Position(x, y);
|
2019-05-23 12:26:28 +02:00
|
|
|
assertFalse(e.estVide(p));
|
|
|
|
}
|
|
|
|
}
|
2019-05-23 13:25:30 +02:00
|
|
|
for (int x = 1; x < 9; x++) {
|
|
|
|
for (int y = 7; y < 9; y++) {
|
|
|
|
Position p = new Position(x, y);
|
2019-05-23 12:26:28 +02:00
|
|
|
assertFalse(e.estVide(p));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-23 13:25:30 +02:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testePiece () {
|
|
|
|
//aBouge
|
|
|
|
e.verificationMouvement(jb, "C2", "c3");
|
|
|
|
assertTrue(e.getPionB3().aBouge());
|
|
|
|
|
|
|
|
assertFalse(e.getCavalierB1().aBouge());
|
|
|
|
}
|
2019-05-23 12:26:28 +02:00
|
|
|
}
|