diff --git a/build/test/cache/test_quizduell.c b/build/test/cache/test_quizduell.c index c368f4e..9db6d81 100644 --- a/build/test/cache/test_quizduell.c +++ b/build/test/cache/test_quizduell.c @@ -307,3 +307,15 @@ void test_pruefeAntwort_CorrectAnswer(void) { ), (UNITY_UINT)(100), UNITY_DISPLAY_STYLE_INT); } + +void test_pruefeAntwort_WrongAnswer(void) { + + QuizFrage frage = erstelleFrage("Test Question", "Option A", "Option B", "Option C", "Option D", 'A'); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((pruefeAntwort(frage, 'B'))), ( + + ((void *)0) + + ), (UNITY_UINT)(104), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/out/c/test_quizduell.o b/build/test/out/c/test_quizduell.o index 03646e3..6317176 100644 Binary files a/build/test/out/c/test_quizduell.o and b/build/test/out/c/test_quizduell.o differ diff --git a/build/test/out/c/test_quizduell_runner.o b/build/test/out/c/test_quizduell_runner.o index c6cd6d5..89550da 100644 Binary files a/build/test/out/c/test_quizduell_runner.o and b/build/test/out/c/test_quizduell_runner.o differ diff --git a/build/test/out/test_quizduell.out b/build/test/out/test_quizduell.out index d794fbd..1132a6b 100755 Binary files a/build/test/out/test_quizduell.out and b/build/test/out/test_quizduell.out differ diff --git a/build/test/preprocess/files/test_quizduell.c b/build/test/preprocess/files/test_quizduell.c index c368f4e..9db6d81 100644 --- a/build/test/preprocess/files/test_quizduell.c +++ b/build/test/preprocess/files/test_quizduell.c @@ -307,3 +307,15 @@ void test_pruefeAntwort_CorrectAnswer(void) { ), (UNITY_UINT)(100), UNITY_DISPLAY_STYLE_INT); } + +void test_pruefeAntwort_WrongAnswer(void) { + + QuizFrage frage = erstelleFrage("Test Question", "Option A", "Option B", "Option C", "Option D", 'A'); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((pruefeAntwort(frage, 'B'))), ( + + ((void *)0) + + ), (UNITY_UINT)(104), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index e97b617..74b5aa1 100644 --- a/build/test/results/test_casualQuiz.pass +++ b/build/test/results/test_casualQuiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.01634360000025481 +:time: 0.016587400001299102 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index 6d65d10..b3fb1d7 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -27,12 +27,16 @@ :line: 98 :message: '' :unity_test_time: 0 +- :test: test_pruefeAntwort_WrongAnswer + :line: 102 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 6 - :passed: 6 + :total: 7 + :passed: 7 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.030828099999780534 +:time: 0.01651020000099379 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 5e8f14b..1090843 100644 --- a/build/test/results/test_timequiz.pass +++ b/build/test/results/test_timequiz.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.016310499999235617 +:time: 0.016081800000392832 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index 7ef11ae..77f7bcd 100644 --- a/build/test/results/test_wwm.pass +++ b/build/test/results/test_wwm.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.01756539999951201 +:time: 0.016533899999558344 diff --git a/build/test/runners/test_quizduell_runner.c b/build/test/runners/test_quizduell_runner.c index 8ea615a..10ec3ac 100644 --- a/build/test/runners/test_quizduell_runner.c +++ b/build/test/runners/test_quizduell_runner.c @@ -16,6 +16,7 @@ extern void test_MountainsFragen(void); extern void test_createCategory2WithQuestions(void); extern void test_befreieKategorie(void); extern void test_pruefeAntwort_CorrectAnswer(void); +extern void test_pruefeAntwort_WrongAnswer(void); /*=======Mock Management=====*/ @@ -86,6 +87,7 @@ int main(void) run_test(test_createCategory2WithQuestions, "test_createCategory2WithQuestions", 65); run_test(test_befreieKategorie, "test_befreieKategorie", 86); run_test(test_pruefeAntwort_CorrectAnswer, "test_pruefeAntwort_CorrectAnswer", 98); + run_test(test_pruefeAntwort_WrongAnswer, "test_pruefeAntwort_WrongAnswer", 102); return UnityEnd(); } diff --git a/test/test_quizduell.c b/test/test_quizduell.c index 093d19e..5639d1e 100644 --- a/test/test_quizduell.c +++ b/test/test_quizduell.c @@ -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 \ No newline at end of file