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.

81 lines
1.4 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "Schachbrett.h"
  4. #include "Spieler.h"
  5. #include "Bauer.h"
  6. #include <stdlib.h>
  7. void setUp(void) {
  8. }
  9. void tearDown(void) {
  10. }
  11. void test_Bauer_X_Bewegung(void) {
  12. char** brett = Schachbrett_erstellen();
  13. int startX = 1;
  14. int startY = 1;
  15. int endX = 2;
  16. int endY = 1;
  17. Player player = PLAYER_WHITE;
  18. TEST_ASSERT_NOT_NULL(brett);
  19. TEST_ASSERT_FALSE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player));
  20. for (int i = 0; i < 8; i++) {
  21. free(brett[i]);
  22. }
  23. free(brett);
  24. }
  25. void test_Bauer_Y_Bewegung(void) {
  26. char** brett = Schachbrett_erstellen();
  27. int startX = 1;
  28. int startY = 1;
  29. int endX = 1;
  30. int endY = 2;
  31. Player player = PLAYER_WHITE;
  32. TEST_ASSERT_NOT_NULL(brett);
  33. TEST_ASSERT_TRUE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player));
  34. for (int i = 0; i < 8; i++) {
  35. free(brett[i]);
  36. }
  37. free(brett);
  38. }
  39. void test_Bauer_Start_Bewegung(void) {
  40. char** brett = Schachbrett_erstellen();
  41. int startX = 2;
  42. int startY = 1;
  43. int endX = 2;
  44. int endY = 3;
  45. Player player = PLAYER_WHITE;
  46. TEST_ASSERT_NOT_NULL(brett);
  47. TEST_ASSERT_TRUE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player));
  48. for (int i = 0; i < 8; i++) {
  49. free(brett[i]);
  50. }
  51. free(brett);
  52. }
  53. #endif // TEST