|
|
@ -103,4 +103,40 @@ void test_pruefeAntwort_WrongAnswer(void) { |
|
|
|
QuizFrage frage = erstelleFrage("Test Question", "Option A", "Option B", "Option C", "Option D", 'A'); |
|
|
|
TEST_ASSERT_EQUAL_INT(0, pruefeAntwort(frage, 'B')); |
|
|
|
} |
|
|
|
void test_sportsCategoryInitialization(void) { |
|
|
|
Kategorie kategorien[MAX_CATEGORIES]; |
|
|
|
|
|
|
|
kategorien[2].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); |
|
|
|
|
|
|
|
kategorien[2].fragen[0] = erstelleFrage("In which sport is the term 'home run' used?", "Soccer/Football", "Baseball", "Tennis", "Golf", 'B'); |
|
|
|
kategorien[2].fragen[1] = erstelleFrage("How many players are there normally on the pitch in a soccer/football team?", "9", "11", "7", "5", 'B'); |
|
|
|
kategorien[2].fragen[2] = erstelleFrage("What sport is played on a pitch and has a 'wicket'?", "Rugby", "Cricket", "American Football", "Hockey", 'B'); |
|
|
|
kategorien[2].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY; |
|
|
|
kategorien[2].joker = 1; |
|
|
|
|
|
|
|
TEST_ASSERT_NOT_NULL(kategorien[2].fragen); |
|
|
|
TEST_ASSERT_EQUAL_STRING("In which sport is the term 'home run' used?", kategorien[2].fragen[0].frage); |
|
|
|
TEST_ASSERT_EQUAL_STRING("Soccer/Football", kategorien[2].fragen[0].antwortA); |
|
|
|
TEST_ASSERT_EQUAL_STRING("Baseball", kategorien[2].fragen[0].antwortB); |
|
|
|
TEST_ASSERT_EQUAL_STRING("Tennis", kategorien[2].fragen[0].antwortC); |
|
|
|
TEST_ASSERT_EQUAL_STRING("Golf", kategorien[2].fragen[0].antwortD); |
|
|
|
TEST_ASSERT_EQUAL('B', kategorien[2].fragen[0].korrekteAntwort); |
|
|
|
TEST_ASSERT_EQUAL_STRING("How many players are there normally on the pitch in a soccer/football team?", kategorien[2].fragen[1].frage); |
|
|
|
TEST_ASSERT_EQUAL_STRING("9", kategorien[2].fragen[1].antwortA); |
|
|
|
TEST_ASSERT_EQUAL_STRING("11", kategorien[2].fragen[1].antwortB); |
|
|
|
TEST_ASSERT_EQUAL_STRING("7", kategorien[2].fragen[1].antwortC); |
|
|
|
TEST_ASSERT_EQUAL_STRING("5", kategorien[2].fragen[1].antwortD); |
|
|
|
TEST_ASSERT_EQUAL('B', kategorien[2].fragen[1].korrekteAntwort); |
|
|
|
TEST_ASSERT_EQUAL_STRING("What sport is played on a pitch and has a 'wicket'?", kategorien[2].fragen[2].frage); |
|
|
|
TEST_ASSERT_EQUAL_STRING("Rugby", kategorien[2].fragen[2].antwortA); |
|
|
|
TEST_ASSERT_EQUAL_STRING("Cricket", kategorien[2].fragen[2].antwortB); |
|
|
|
TEST_ASSERT_EQUAL_STRING("American Football", kategorien[2].fragen[2].antwortC); |
|
|
|
TEST_ASSERT_EQUAL_STRING("Hockey", kategorien[2].fragen[2].antwortD); |
|
|
|
TEST_ASSERT_EQUAL('B', kategorien[2].fragen[2].korrekteAntwort); |
|
|
|
TEST_ASSERT_EQUAL(MAX_QUESTIONS_PER_CATEGORY, kategorien[2].anzahlFragen); |
|
|
|
TEST_ASSERT_EQUAL(1, kategorien[2].joker); |
|
|
|
|
|
|
|
free(kategorien[2].fragen); |
|
|
|
kategorien[2].fragen = NULL; |
|
|
|
} |
|
|
|
#endif //TEST |