|
@ -0,0 +1,32 @@ |
|
|
|
|
|
#ifdef TEST |
|
|
|
|
|
#include "unity.h" |
|
|
|
|
|
#include "Schachbrett.h" |
|
|
|
|
|
#include "Spieler.h" |
|
|
|
|
|
#include "Misc.h" |
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
#include <assert.h> |
|
|
|
|
|
|
|
|
|
|
|
void test_king_alive() { |
|
|
|
|
|
char** brett = malloc(8 * sizeof(char*)); |
|
|
|
|
|
for(int i = 0; i < 8; i++) { |
|
|
|
|
|
brett[i] = malloc(8 * sizeof(char)); |
|
|
|
|
|
for(int j = 0; j < 8; j++) { |
|
|
|
|
|
brett[i][j] = '.'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Testfall 1: Beide Könige sind auf dem Brett |
|
|
|
|
|
brett[0][0] = 'K'; |
|
|
|
|
|
brett[7][7] = 'k'; |
|
|
|
|
|
assert(king_alive(brett) == true); |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < 8; i++) { |
|
|
|
|
|
free(brett[i]); |
|
|
|
|
|
} |
|
|
|
|
|
free(brett); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TEST MISC |