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.
48 lines
905 B
48 lines
905 B
#ifdef TEST
|
|
#include "unity.h"
|
|
#include <stdlib.h>
|
|
#include "Schachbrett.h"
|
|
|
|
void setUp(void) {
|
|
}
|
|
|
|
void tearDown(void) {
|
|
}
|
|
|
|
void test_Schachbrett_erstellen(void) {
|
|
char** brett = Schachbrett_erstellen();
|
|
|
|
TEST_ASSERT_NOT_NULL(brett);
|
|
|
|
// Testen von ein Paar Positionen
|
|
TEST_ASSERT_EQUAL('R', brett[0][0]);
|
|
TEST_ASSERT_EQUAL('p', brett[6][0]);
|
|
TEST_ASSERT_EQUAL(' ', brett[4][4]);
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
free(brett[i]);
|
|
}
|
|
free(brett);
|
|
}
|
|
|
|
void test_Schachbrett_clearen(void) {
|
|
char** brett = Schachbrett_erstellen();
|
|
|
|
TEST_ASSERT_NOT_NULL(brett);
|
|
|
|
clear_Schachbrett(brett);
|
|
|
|
for(int i = 0; i < 8 ; i++){
|
|
for(int j = 0; j < 8 ; j++){
|
|
TEST_ASSERT_EQUAL(' ', brett[i][j]);
|
|
}
|
|
}
|
|
|
|
print_Schachfeld(brett);
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
free(brett[i]);
|
|
}
|
|
free(brett);
|
|
}
|
|
#endif // TEST
|