From fd9f1c94e4696956e0f7b3761cb29297e7a37a03 Mon Sep 17 00:00:00 2001 From: fdai7723 Date: Wed, 7 Feb 2024 19:41:07 +0000 Subject: [PATCH] =?UTF-8?q?Test/Add=20new=20file,=20test=5FMisc.c,=20Hendr?= =?UTF-8?q?ik=20Vo=C3=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test_Misc.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/test_Misc.c diff --git a/test/test_Misc.c b/test/test_Misc.c new file mode 100644 index 0000000..6ea2fad --- /dev/null +++ b/test/test_Misc.c @@ -0,0 +1,32 @@ +#ifdef TEST +#include "unity.h" +#include "Schachbrett.h" +#include "Spieler.h" +#include "Misc.h" +#include +#include +#include + +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