You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package de.fd.fh;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Array; import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.*;
class FigureKingTest { // K = Position (19), x = gültig (10, 11, 12, 18, 20, 26, 27, 28), rest nicht
// x x x
// x K x
// x x x
@Test void checkInvalidKingMoves() { Figure f = new FigureKing();
int pos = 19;
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 < 64; i++) { if (possibleMoves.contains(i)) { continue; }
assertFalse(f.moveAllowed(pos, i, new Figure[64])); } } }
|