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.

57 lines
1.0 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "Schachbrett.h"
  4. #include "Spieler.h"
  5. #include "Dame.h"
  6. #include <stdlib.h>
  7. void test_Dame_positive_horizontal_Bewegung(void) {
  8. char** brett = Schachbrett_erstellen();
  9. int startX = 3;
  10. int startY = 2;
  11. int endX = 3;
  12. int endY = 4;
  13. Player player = PLAYER_WHITE;
  14. TEST_ASSERT_NOT_NULL(brett);
  15. brett[2][3] = 'Q';
  16. print_Schachfeld(brett);
  17. TEST_ASSERT_TRUE(istzugerlaubt_Dame(brett, startX, startY, endX, endY, player));
  18. for (int i = 0; i < 8; i++) {
  19. free(brett[i]);
  20. }
  21. free(brett);
  22. }
  23. void test_Dame_Falsche_Bewegung(void) {
  24. char** brett = Schachbrett_erstellen();
  25. int startX = 3;
  26. int startY = 0;
  27. int endX = 3;
  28. int endY = 4;
  29. Player player = PLAYER_WHITE;
  30. TEST_ASSERT_NOT_NULL(brett);
  31. print_Schachfeld(brett);
  32. TEST_ASSERT_FALSE(istzugerlaubt_Dame( brett, startX, startY, endX, endY, player));
  33. for (int i = 0; i < 8; i++) {
  34. free(brett[i]);
  35. }
  36. free(brett);
  37. }
  38. #endif // TEST