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.

39 lines
1.0 KiB

  1. package de.fd.fh;
  2. import org.junit.jupiter.api.Test;
  3. import static org.hamcrest.MatcherAssert.assertThat;
  4. import static org.junit.jupiter.api.Assertions.*;
  5. class GameTest
  6. {
  7. @Test
  8. void newGameInitializationCorrectField()
  9. {
  10. Game g = new Game();
  11. g.initNewGame();
  12. assertEquals(Figure.fieldLength * Figure.fieldLength, g.mField.length);
  13. }
  14. // prüft, ob Figuren nach Initialisierung nur an vorgesehenden Positionen stehen
  15. @Test
  16. void newGameInitializationFigurePositions()
  17. {
  18. Game g = new Game();
  19. g.initNewGame();
  20. for (int i = 0; i < Figure.fieldLength; i++) // row
  21. {
  22. if (i == Game.whiteRowOther
  23. || i == Game.whiteRowFarmer
  24. || i == Game.blackRowOther
  25. || i == Game.blackRowFarmer)
  26. {
  27. for (int j = 0; j < Figure.fieldLength; j++) // col
  28. {
  29. assertNotEquals(null, g.mField[i * Figure.fieldLength + j]);
  30. }
  31. }
  32. }
  33. }
  34. }