Browse Source

figure movement test: white farmer invalid var2

feat-figureMovement
JD 4 years ago
parent
commit
54f0424d7a
  1. 5
      fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java
  2. 7
      fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java

5
fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java

@ -16,12 +16,13 @@ public class Figure
return false;
}
if (dst >= Figure.fieldLength * 7 + 0) // weißer Bauer kein Schritt "runter"
int stepSize = src / fieldLength - dst / fieldLength;
if (stepSize <= 0) // weißer Bauer kein Schritt "runter"
{
return false;
}
int stepSize = src / fieldLength - dst / fieldLength;
if (stepSize > 1) // weißer Bauer nicht mehr als 1 Schritt nach "oben"
{
return false;

7
fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java

@ -62,4 +62,11 @@ class FigureTest
Figure f = new Figure();
assertTrue(f.moveAllowed(Figure.fieldLength * 4 + 4, Figure.fieldLength * 3 + 4, new int[Figure.fieldLength * Figure.fieldLength]));
}
@Test
void whiteFarmerInvalidDestinationDownVar2() // Bauer (w) steht in der Mitte vom Feld und geht 1 nach unten
{
Figure f = new Figure();
assertFalse(f.moveAllowed(Figure.fieldLength * 4 + 4, Figure.fieldLength * 5 + 4, new int[Figure.fieldLength * Figure.fieldLength]));
}
}
Loading…
Cancel
Save