Browse Source

Test/Add new file, test_Misc.c, Hendrik Voß

remotes/origin/Spracharbeit
fdai7723 11 months ago
parent
commit
fd9f1c94e4
  1. 32
      test/test_Misc.c

32
test/test_Misc.c

@ -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
Loading…
Cancel
Save