finitions testes

This commit is contained in:
Chiara 2019-05-23 13:25:30 +02:00
parent 2ef8e6f5e4
commit aa5cb78cb9
2 changed files with 21 additions and 14 deletions

View File

@ -3,14 +3,17 @@ import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import joueurs.Joueur;
import piecesEchiquier.*; import piecesEchiquier.*;
class testGeneraux { class testGeneraux {
private Echiquier e; private Echiquier e;
private Joueur jb;
@BeforeEach @BeforeEach
public void initialisation() { public void initialisation() {
e = new Echiquier(); e = new Echiquier();
jb = new Joueur("Joueur Blanc","Blanc");
} }
@Test @Test
@ -31,25 +34,33 @@ class testGeneraux {
//estVide //estVide
/*Position p = new Position(3, 6); /*Position p = new Position(3, 6);
assertTrue(e.estVide(p));*/ assertTrue(e.estVide(p));*/
for (int i = 3; i < 6; i++) { for (int x = 1; x < 9; x++) {
for (int j = 1; i < 9; i++) { for (int y = 3; y < 7; y++) {
Position p = new Position(j, i); Position p = new Position(x, y);
assertTrue(e.estVide(p)); assertTrue(e.estVide(p));
} }
} }
for (int i = 0; i < 3; i++) { for (int x = 1; x < 9; x++) {
for (int j = 1; i < 9; i++) { for (int y = 1; y < 3; y++) {
Position p = new Position(j, i); Position p = new Position(x, y);
assertFalse(e.estVide(p)); assertFalse(e.estVide(p));
} }
} }
for (int i = 7; i < 9; i++) { for (int x = 1; x < 9; x++) {
for (int j = 1; i < 9; i++) { for (int y = 7; y < 9; y++) {
Position p = new Position(j, i); Position p = new Position(x, y);
assertFalse(e.estVide(p)); assertFalse(e.estVide(p));
} }
} }
} }
@Test
public void testePiece () {
//aBouge
e.verificationMouvement(jb, "C2", "c3");
assertTrue(e.getPionB3().aBouge());
assertFalse(e.getCavalierB1().aBouge());
}
} }

View File

@ -16,10 +16,6 @@ class testPiece {
e = new Echiquier(); e = new Echiquier();
jb = new Joueur("Joueur Blanc","Blanc"); jb = new Joueur("Joueur Blanc","Blanc");
jn = new Joueur("Joueur Noir", "Noir"); jn = new Joueur("Joueur Noir", "Noir");
System.out.println();
System.out.println("nouveau test : ");
System.out.println();
} }
@AfterEach @AfterEach