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.

42 lines
915 B

  1. package de.fd.fh;
  2. import org.junit.jupiter.api.Test;
  3. import static org.junit.jupiter.api.Assertions.*;
  4. class FigureBishopTest
  5. {
  6. Figure[] field = new Figure[Figure.fieldLength * Figure.fieldLength];
  7. @Test
  8. void checkInvalidMovesBishopUpward()
  9. {
  10. Figure f = new FigureBishop();
  11. int src = Figure.fieldLength * 5 + 5;
  12. int dst = src - Figure.fieldLength;
  13. assertFalse(f.moveAllowed(src, dst, field));
  14. }
  15. @Test
  16. void checkInvalidMovesBishopRight()
  17. {
  18. Figure f = new FigureBishop();
  19. int src = Figure.fieldLength * 5 + 5;
  20. int dst = src + 1;
  21. assertFalse(f.moveAllowed(src, dst, field));
  22. }
  23. @Test
  24. void checkInvalidMovesBishopRight2()
  25. {
  26. Figure f = new FigureBishop();
  27. int src = Figure.fieldLength * 5 + 5;
  28. int dst = src + 6;
  29. assertFalse(f.moveAllowed(src, dst, field));
  30. }
  31. }