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.

58 lines
1.0 KiB

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