Browse Source

added test for invalid movement of black farmer

feat-figureMovement
JD 4 years ago
parent
commit
7734e50a43
  1. 22
      fh.fd.ci.client/src/test/java/de/fd/fh/FigureFarmerTest.java

22
fh.fd.ci.client/src/test/java/de/fd/fh/FigureFarmerTest.java

@ -38,17 +38,29 @@ class FigureFarmerTest
} }
@ParameterizedTest @ParameterizedTest
// row (src), col (src), row (dst), col (dst)
// color (0 white/1 black), row (src), col (src), row (dst), col (dst)
@CsvSource({ @CsvSource({
"6, 0, 7, 0", // a2 -> a1
"4, 4, 5, 4" // e4 -> e3
"0, 6, 0, 7, 0", // white: a2 -> a1
"0, 4, 4, 5, 4", // white: e4 -> e3
"1, 1, 0, 0, 0" // black: a7 -> a8
}) })
void farmerInvalidDestinationDown(int srcRow, int srcCol, int dstRow, int dstCol) // statt nach "oben" wird nach "unten" gegangen
void farmerInvalidDestinationDown(int color, int srcRow, int srcCol, int dstRow, int dstCol) // statt nach "oben" wird nach "unten" gegangen
{ {
int src = Figure.fieldLength * srcRow + srcCol; int src = Figure.fieldLength * srcRow + srcCol;
int dst = Figure.fieldLength * dstRow + dstCol; int dst = Figure.fieldLength * dstRow + dstCol;
Figure f = new FigureFarmer(FigureFarmer.Color.White);
Figure f = null;
if (color == 0)
{
f = new FigureFarmer(FigureFarmer.Color.White);
}
else if (color == 1)
{
f = new FigureFarmer(FigureFarmer.Color.Black);
}
assertFalse(f.moveAllowed(src, dst, field)); assertFalse(f.moveAllowed(src, dst, field));
} }

Loading…
Cancel
Save