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.
50 lines
1.1 KiB
50 lines
1.1 KiB
#ifdef TEST
|
|
#include "unity.h"
|
|
#include <stdlib.h>
|
|
#include "PuzzleI.h"
|
|
#include "Spieler.h"
|
|
#include "Koenig.h"
|
|
#include "Turm.h"
|
|
|
|
|
|
void setUp(void) {
|
|
}
|
|
|
|
void tearDown(void) {
|
|
}
|
|
|
|
void test_puzzlebrett_erstellen(void) {
|
|
char** brett = Puzzlebrett_erstellen();
|
|
|
|
print_Puzzlebrett(brett);
|
|
|
|
}
|
|
|
|
void test_loesung_abchecken_kein_Koenig(void) {
|
|
char** brett = Puzzlebrett_erstellen();
|
|
// König entfernen
|
|
brett[7][1] = ' ';
|
|
TEST_ASSERT_FALSE(loesung_abchecken(brett));
|
|
Puzzlebrettspeicher_freigeben(brett);
|
|
}
|
|
|
|
void test_loesung_abchecken_nicht_bedroht(void) {
|
|
char** brett = Puzzlebrett_erstellen();
|
|
// König nicht bedroht
|
|
brett[7][4] = ' ';
|
|
print_Puzzlebrett(brett);
|
|
TEST_ASSERT_FALSE(loesung_abchecken(brett));
|
|
Puzzlebrettspeicher_freigeben(brett);
|
|
}
|
|
|
|
void test_loesung_abchecken_bedroht(void) {
|
|
char** brett = Puzzlebrett_erstellen();
|
|
// König bedroht
|
|
brett[7][4] = 'R';
|
|
brett[0][4] = ' ';
|
|
print_Puzzlebrett(brett);
|
|
TEST_ASSERT_TRUE(loesung_abchecken(brett));
|
|
Puzzlebrettspeicher_freigeben(brett);
|
|
}
|
|
|
|
#endif // TEST
|