|
@ -10,19 +10,30 @@ class FigureFarmerTest |
|
|
{ |
|
|
{ |
|
|
Figure[] field = new Figure[Figure.fieldLength * Figure.fieldLength]; |
|
|
Figure[] field = new Figure[Figure.fieldLength * Figure.fieldLength]; |
|
|
|
|
|
|
|
|
// weißer Bauer |
|
|
|
|
|
@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, 5, 0", // a2 -> a3 |
|
|
|
|
|
"4, 4, 3, 4" // e4 -> e5 |
|
|
|
|
|
|
|
|
"0, 6, 0, 5, 0", // white: a2 -> a3 |
|
|
|
|
|
"0, 4, 4, 3, 4", // white: e4 -> e5 |
|
|
|
|
|
|
|
|
|
|
|
"1, 1, 0, 2, 0" // black: a1 -> a2 |
|
|
}) |
|
|
}) |
|
|
void whiteFarmerValidDestination(int srcRow, int srcCol, int dstRow, int dstCol) |
|
|
|
|
|
|
|
|
void whiteFarmerValidDestination(int color, int srcRow, int srcCol, int dstRow, int dstCol) |
|
|
{ |
|
|
{ |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
assertTrue(f.moveAllowed(src, dst, field)); |
|
|
assertTrue(f.moveAllowed(src, dst, field)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|