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.

59 lines
1.1 KiB

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