|
@ -43,4 +43,30 @@ class FigureKingTest |
|
|
assertFalse(f.moveAllowed(pos, i, new Figure[64])); |
|
|
assertFalse(f.moveAllowed(pos, i, new Figure[64])); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void checkValidKingMoves() |
|
|
|
|
|
{ |
|
|
|
|
|
Figure f = new FigureKing(); |
|
|
|
|
|
|
|
|
|
|
|
int pos = 45; |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<Integer> possibleMoves = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
possibleMoves.add(pos - Figure.fieldLength - 1); |
|
|
|
|
|
possibleMoves.add(pos - Figure.fieldLength); |
|
|
|
|
|
possibleMoves.add(pos - Figure.fieldLength + 1); |
|
|
|
|
|
|
|
|
|
|
|
possibleMoves.add(pos - 1); |
|
|
|
|
|
possibleMoves.add(pos + 1); |
|
|
|
|
|
|
|
|
|
|
|
possibleMoves.add(pos + Figure.fieldLength - 1); |
|
|
|
|
|
possibleMoves.add(pos + Figure.fieldLength); |
|
|
|
|
|
possibleMoves.add(pos + Figure.fieldLength + 1); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < possibleMoves.size(); i++) |
|
|
|
|
|
{ |
|
|
|
|
|
assertTrue(f.moveAllowed(pos, possibleMoves.get(i), new Figure[64])); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |