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.
54 lines
1.1 KiB
54 lines
1.1 KiB
package de.fd.fh;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
class FigureBishopTest
|
|
{
|
|
Figure[] field = new Figure[Figure.fieldLength * Figure.fieldLength];
|
|
|
|
@Test
|
|
void checkInvalidMovesBishopUpward()
|
|
{
|
|
Figure f = new FigureBishop();
|
|
|
|
int src = Figure.fieldLength * 5 + 5;
|
|
int dst = src - Figure.fieldLength;
|
|
|
|
assertFalse(f.moveAllowed(src, dst, field));
|
|
}
|
|
|
|
@Test
|
|
void checkInvalidMovesBishopRight()
|
|
{
|
|
Figure f = new FigureBishop();
|
|
|
|
int src = Figure.fieldLength * 5 + 5;
|
|
int dst = src + 1;
|
|
|
|
assertFalse(f.moveAllowed(src, dst, field));
|
|
}
|
|
|
|
@Test
|
|
void checkInvalidMovesBishopRight2()
|
|
{
|
|
Figure f = new FigureBishop();
|
|
|
|
int src = Figure.fieldLength * 5 + 5;
|
|
int dst = src + 6;
|
|
|
|
assertFalse(f.moveAllowed(src, dst, field));
|
|
}
|
|
|
|
@Test
|
|
void checkInvalidMovesBishopRight3()
|
|
{
|
|
Figure f = new FigureBishop();
|
|
|
|
int src = Figure.fieldLength * 5 + 5;
|
|
int dst = src + 10;
|
|
|
|
assertFalse(f.moveAllowed(src, dst, field));
|
|
}
|
|
}
|