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.

71 lines
1.1 KiB

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