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.

32 lines
632 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "Schachbrett.h"
  4. #include "Spieler.h"
  5. #include "Misc.h"
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include <assert.h>
  9. void test_king_alive() {
  10. char** brett = malloc(8 * sizeof(char*));
  11. for(int i = 0; i < 8; i++) {
  12. brett[i] = malloc(8 * sizeof(char));
  13. for(int j = 0; j < 8; j++) {
  14. brett[i][j] = '.';
  15. }
  16. }
  17. // Testfall 1: Beide Könige sind auf dem Brett
  18. brett[0][0] = 'K';
  19. brett[7][7] = 'k';
  20. assert(king_alive(brett) == true);
  21. for(int i = 0; i < 8; i++) {
  22. free(brett[i]);
  23. }
  24. free(brett);
  25. }
  26. #endif // TEST MISC