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.

48 lines
905 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include <stdlib.h>
  4. #include "Schachbrett.h"
  5. void setUp(void) {
  6. }
  7. void tearDown(void) {
  8. }
  9. void test_Schachbrett_erstellen(void) {
  10. char** brett = Schachbrett_erstellen();
  11. TEST_ASSERT_NOT_NULL(brett);
  12. // Testen von ein Paar Positionen
  13. TEST_ASSERT_EQUAL('R', brett[0][0]);
  14. TEST_ASSERT_EQUAL('p', brett[6][0]);
  15. TEST_ASSERT_EQUAL(' ', brett[4][4]);
  16. for (int i = 0; i < 8; i++) {
  17. free(brett[i]);
  18. }
  19. free(brett);
  20. }
  21. void test_Schachbrett_clearen(void) {
  22. char** brett = Schachbrett_erstellen();
  23. TEST_ASSERT_NOT_NULL(brett);
  24. clear_Schachbrett(brett);
  25. for(int i = 0; i < 8 ; i++){
  26. for(int j = 0; j < 8 ; j++){
  27. TEST_ASSERT_EQUAL(' ', brett[i][j]);
  28. }
  29. }
  30. print_Schachfeld(brett);
  31. for (int i = 0; i < 8; i++) {
  32. free(brett[i]);
  33. }
  34. free(brett);
  35. }
  36. #endif // TEST