run all tests again
This commit is contained in:
1 parent
88b0b8f3fb
commit
da9cbb74ae
2 files changed
+57
-57
No files matched your search
+2
-2
@@ -50,8 +50,8 @@ graphicalGame.o: $(codefolder)/graphicalGame.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
TEST_BIN = runTests
|
TEST_BIN = runTests
|
||||||
|
|
||||||
test: input.o $(codefolder)/unit_tests.c $(unityfolder)/unity.c
|
test: input.o game.o $(codefolder)/unit_tests.c $(unityfolder)/unity.c
|
||||||
$(CC) -Wall -I$(unityfolder) -o $(TEST_BIN) input.o $(codefolder)/unit_tests.c $(unityfolder)/unity.c
|
$(CC) -Wall -I$(unityfolder) -o $(TEST_BIN) input.o game.o $(codefolder)/unit_tests.c $(unityfolder)/unity.c
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Clean
|
# Clean
|
||||||
# --------------------------
|
# --------------------------
|
||||||
|
|||||||
+55
-55
@@ -66,69 +66,69 @@ void test_readWords_empty_file(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------- Tests für game.c ----------
|
// ---------- Tests für game.c ----------
|
||||||
// void test_createWordSalad_all_fit(void) {
|
void test_createWordSalad_all_fit(void) {
|
||||||
// char words[3][MAX_WORD_LEN] = {"CAT", "DOG", "MOUSE"};
|
char words[3][MAX_WORD_LEN] = {"CAT", "DOG", "MOUSE"};
|
||||||
// char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
||||||
|
|
||||||
// int placed = createWordSalad(salad, 20, words, 3);
|
int placed = createWordSalad(salad, 20, words, 3);
|
||||||
|
|
||||||
// TEST_ASSERT_EQUAL_INT(3, placed);
|
TEST_ASSERT_EQUAL_INT(3, placed);
|
||||||
|
|
||||||
// // Sicherstellen, dass alle Felder gefüllt sind
|
// Sicherstellen, dass alle Felder gefüllt sind
|
||||||
// for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
// for (int j = 0; j < 20; j++) {
|
for (int j = 0; j < 20; j++) {
|
||||||
// TEST_ASSERT_GREATER_OR_EQUAL('A', salad[i][j]);
|
TEST_ASSERT_GREATER_OR_EQUAL('A', salad[i][j]);
|
||||||
// TEST_ASSERT_LESS_OR_EQUAL('Z', salad[i][j]);
|
TEST_ASSERT_LESS_OR_EQUAL('Z', salad[i][j]);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// void test_createWordSalad_too_small(void) {
|
void test_createWordSalad_too_small(void) {
|
||||||
// char words[2][MAX_WORD_LEN] = {"ELEPHANT", "GIRAFFE"};
|
char words[2][MAX_WORD_LEN] = {"ELEPHANT", "GIRAFFE"};
|
||||||
// char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
||||||
|
|
||||||
// int placed = createWordSalad(salad, 5, words, 2);
|
int placed = createWordSalad(salad, 5, words, 2);
|
||||||
|
|
||||||
// TEST_ASSERT_GREATER_OR_EQUAL(0, placed);
|
TEST_ASSERT_GREATER_OR_EQUAL(0, placed);
|
||||||
// TEST_ASSERT_LESS_OR_EQUAL(2, placed);
|
TEST_ASSERT_LESS_OR_EQUAL(2, placed);
|
||||||
|
|
||||||
// // Feld muss vollständig gefüllt sein
|
// Feld muss vollständig gefüllt sein
|
||||||
// for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
// for (int j = 0; j < 5; j++) {
|
for (int j = 0; j < 5; j++) {
|
||||||
// TEST_ASSERT_GREATER_OR_EQUAL('A', salad[i][j]);
|
TEST_ASSERT_GREATER_OR_EQUAL('A', salad[i][j]);
|
||||||
// TEST_ASSERT_LESS_OR_EQUAL('Z', salad[i][j]);
|
TEST_ASSERT_LESS_OR_EQUAL('Z', salad[i][j]);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// void test_createWordSalad_allWordsPlaced() {
|
void test_createWordSalad_allWordsPlaced() {
|
||||||
// char words[3][MAX_WORD_LEN] = {"CAT", "DOG", "MOUSE"};
|
char words[3][MAX_WORD_LEN] = {"CAT", "DOG", "MOUSE"};
|
||||||
// char saladHoriz[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
char saladHoriz[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
||||||
// char saladVert[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
char saladVert[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
||||||
|
|
||||||
// int placed = createWordSalad(saladHoriz, 20, words, 3);
|
int placed = createWordSalad(saladHoriz, 20, words, 3);
|
||||||
// for(int i = 0; i < MAX_SEARCH_FIELD_LEN; i++)
|
for(int i = 0; i < MAX_SEARCH_FIELD_LEN; i++)
|
||||||
// {
|
{
|
||||||
// for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
||||||
// {
|
{
|
||||||
// saladVert[j][i] = saladHoriz[i][j];
|
saladVert[j][i] = saladHoriz[i][j];
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// for(int i = 0; i < 3; i++) {
|
for(int i = 0; i < 3; i++) {
|
||||||
// const char* word = words[i];
|
const char* word = words[i];
|
||||||
// int wordFound = 0;
|
int wordFound = 0;
|
||||||
// for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
||||||
// {
|
{
|
||||||
// const char* row = saladHoriz[j];
|
const char* row = saladHoriz[j];
|
||||||
// const char* col = saladVert[j];
|
const char* col = saladVert[j];
|
||||||
// wordFound |= strstr(row, word) || strstr(col, word);
|
wordFound |= strstr(row, word) || strstr(col, word);
|
||||||
// }
|
}
|
||||||
// TEST_ASSERT_TRUE_MESSAGE(wordFound, "Not all words were placed.");
|
TEST_ASSERT_TRUE_MESSAGE(wordFound, "Not all words were placed.");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// TEST_ASSERT_EQUAL_INT(3, placed);
|
TEST_ASSERT_EQUAL_INT(3, placed);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ---------- Test Setup und TearDown Funktionen ----------
|
// ---------- Test Setup und TearDown Funktionen ----------
|
||||||
|
|
||||||
@@ -162,9 +162,9 @@ int main(void) {
|
|||||||
RUN_TEST(test_readWords_simple);
|
RUN_TEST(test_readWords_simple);
|
||||||
RUN_TEST(test_readWords_with_delimiters);
|
RUN_TEST(test_readWords_with_delimiters);
|
||||||
RUN_TEST(test_readWords_empty_file);
|
RUN_TEST(test_readWords_empty_file);
|
||||||
//RUN_TEST(test_createWordSalad_all_fit);
|
RUN_TEST(test_createWordSalad_all_fit);
|
||||||
//RUN_TEST(test_createWordSalad_too_small);
|
RUN_TEST(test_createWordSalad_too_small);
|
||||||
//RUN_TEST(test_createWordSalad_allWordsPlaced);
|
RUN_TEST(test_createWordSalad_allWordsPlaced);
|
||||||
|
|
||||||
int result = UNITY_END(); // Test-Ergebnisse
|
int result = UNITY_END(); // Test-Ergebnisse
|
||||||
print_test_result(result);
|
print_test_result(result);
|
||||||
|
|||||||
Reference in new issue
Block a user