Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fbaaff539e
@ -2,5 +2,7 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="src" path="tests"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -111,7 +111,7 @@ public class Echiquier {
|
|||||||
return echec;
|
return echec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean verificationMouvement(Joueur J, String A, String B) // FONCTION TRADUCTION, VERIF + DEPLACEMENTS SI POSSIBLE
|
public boolean verificationMouvement(Joueur J, String coorA, String coorB) // FONCTION TRADUCTION, VERIF + DEPLACEMENTS SI POSSIBLE
|
||||||
{
|
{
|
||||||
int i = -1;
|
int i = -1;
|
||||||
int j = -1;
|
int j = -1;
|
||||||
|
41
tests/testPiece.java
Normal file
41
tests/testPiece.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import joueurs.Joueur;
|
||||||
|
import piecesEchiquier.*;
|
||||||
|
|
||||||
|
class testPiece {
|
||||||
|
private Echiquier e;
|
||||||
|
private Joueur j;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void initialisation() {
|
||||||
|
Echiquier e = new Echiquier();
|
||||||
|
Joueur j = new Joueur("Marion la Stagiaire","Blanc");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testVerif() {
|
||||||
|
assertFalse(e.VerifFinale(j, "A4", "A5")); //choix de case vide
|
||||||
|
assertFalse(e.VerifFinale(j, "A7", "A8")); //mauvais choix de pion
|
||||||
|
assertFalse(e.VerifFinale(j, "A1", "A2")); //manger pion allier
|
||||||
|
assertFalse(e.VerifFinale(j, "A2", "B5")); //mauvais deplacement
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testTour() {
|
||||||
|
e.getPionB1().getPosition().setX(5);
|
||||||
|
e.getPionB1().getPosition().setY(4);
|
||||||
|
e.VerifFinale(j, "A1", "A4");
|
||||||
|
assertEquals(0, e.getPionB1().getPosition().getX());
|
||||||
|
assertEquals(4, e.getPionB1().getPosition().getY());
|
||||||
|
e.VerifFinale(j, "A4", "F4");
|
||||||
|
assertEquals(5, e.getPionB1().getPosition().getX());
|
||||||
|
assertEquals(4, e.getPionB1().getPosition().getY());
|
||||||
|
|
||||||
|
assertTrue(e.VerifFinale(j, "F4", "F7"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user