diff --git a/build/test/cache/test_quizduell.c b/build/test/cache/test_quizduell.c index 2f553a6..5c13c63 100644 --- a/build/test/cache/test_quizduell.c +++ b/build/test/cache/test_quizduell.c @@ -127,3 +127,69 @@ void test_CookingFragen(void) { free(kategorien[1].fragen); } + +void test_MountainsFragen(void) { + + Kategorie kategorien[3]; + + + + kategorien[0].fragen = (QuizFrage*)malloc(3 * sizeof(QuizFrage)); + + + + kategorien[0].fragen[0] = erstelleFrage("Whats the height of the Zugspitze?", "2482 Meter", "2867 Meter", "2962 Meter", "3173 Meter", 'C'); + + kategorien[0].fragen[1] = erstelleFrage("In which Federal State is the Zugspitze?", "Bayern", "Baden-Wuerttemberg", "Hessen", "Thueringen", 'A'); + + kategorien[0].fragen[2] = erstelleFrage("Which Mountain is the highest following after the Zugspitze?", "Grossglockner", "Watzmann", "Feldberg", "Meissner", 'B'); + + + + kategorien[0].anzahlFragen = 3; + + kategorien[0].joker = 1; + + + + UnityAssertEqualString((const char*)(("Whats the height of the Zugspitze?")), (const char*)((kategorien[0].fragen[0].frage)), ( + + ((void *)0) + + ), (UNITY_UINT)(56)); + + UnityAssertEqualString((const char*)(("2482 Meter")), (const char*)((kategorien[0].fragen[0].antwortA)), ( + + ((void *)0) + + ), (UNITY_UINT)(57)); + + UnityAssertEqualString((const char*)(("2867 Meter")), (const char*)((kategorien[0].fragen[0].antwortB)), ( + + ((void *)0) + + ), (UNITY_UINT)(58)); + + UnityAssertEqualString((const char*)(("2962 Meter")), (const char*)((kategorien[0].fragen[0].antwortC)), ( + + ((void *)0) + + ), (UNITY_UINT)(59)); + + UnityAssertEqualString((const char*)(("3173 Meter")), (const char*)((kategorien[0].fragen[0].antwortD)), ( + + ((void *)0) + + ), (UNITY_UINT)(60)); + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('C')), (UNITY_INT)(UNITY_INT8 )((kategorien[0].fragen[0].korrekteAntwort)), ( + + ((void *)0) + + ), (UNITY_UINT)(61), UNITY_DISPLAY_STYLE_CHAR); + + + + free(kategorien[0].fragen); + +} diff --git a/build/test/out/c/test_quizduell.o b/build/test/out/c/test_quizduell.o index 187589e..606172b 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 a15810b..92e82e1 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 6667da4..2463d7d 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 2f553a6..5c13c63 100644 --- a/build/test/preprocess/files/test_quizduell.c +++ b/build/test/preprocess/files/test_quizduell.c @@ -127,3 +127,69 @@ void test_CookingFragen(void) { free(kategorien[1].fragen); } + +void test_MountainsFragen(void) { + + Kategorie kategorien[3]; + + + + kategorien[0].fragen = (QuizFrage*)malloc(3 * sizeof(QuizFrage)); + + + + kategorien[0].fragen[0] = erstelleFrage("Whats the height of the Zugspitze?", "2482 Meter", "2867 Meter", "2962 Meter", "3173 Meter", 'C'); + + kategorien[0].fragen[1] = erstelleFrage("In which Federal State is the Zugspitze?", "Bayern", "Baden-Wuerttemberg", "Hessen", "Thueringen", 'A'); + + kategorien[0].fragen[2] = erstelleFrage("Which Mountain is the highest following after the Zugspitze?", "Grossglockner", "Watzmann", "Feldberg", "Meissner", 'B'); + + + + kategorien[0].anzahlFragen = 3; + + kategorien[0].joker = 1; + + + + UnityAssertEqualString((const char*)(("Whats the height of the Zugspitze?")), (const char*)((kategorien[0].fragen[0].frage)), ( + + ((void *)0) + + ), (UNITY_UINT)(56)); + + UnityAssertEqualString((const char*)(("2482 Meter")), (const char*)((kategorien[0].fragen[0].antwortA)), ( + + ((void *)0) + + ), (UNITY_UINT)(57)); + + UnityAssertEqualString((const char*)(("2867 Meter")), (const char*)((kategorien[0].fragen[0].antwortB)), ( + + ((void *)0) + + ), (UNITY_UINT)(58)); + + UnityAssertEqualString((const char*)(("2962 Meter")), (const char*)((kategorien[0].fragen[0].antwortC)), ( + + ((void *)0) + + ), (UNITY_UINT)(59)); + + UnityAssertEqualString((const char*)(("3173 Meter")), (const char*)((kategorien[0].fragen[0].antwortD)), ( + + ((void *)0) + + ), (UNITY_UINT)(60)); + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('C')), (UNITY_INT)(UNITY_INT8 )((kategorien[0].fragen[0].korrekteAntwort)), ( + + ((void *)0) + + ), (UNITY_UINT)(61), UNITY_DISPLAY_STYLE_CHAR); + + + + free(kategorien[0].fragen); + +} diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index a7f3f9a..78816d6 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.01786770000035176 +:time: 0.0162979999986419 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index 614e6e8..e85f8af 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -11,12 +11,16 @@ :line: 22 :message: '' :unity_test_time: 0 +- :test: test_MountainsFragen + :line: 44 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 2 - :passed: 2 + :total: 3 + :passed: 3 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.03265889999966021 +:time: 0.03225860000020475 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 914fec7..9b3b91c 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.019886199999746168 +:time: 0.01628539999910572 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index ea9e6fa..e966d0d 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.01826220000111789 +:time: 0.015815200000361074 diff --git a/build/test/runners/test_quizduell_runner.c b/build/test/runners/test_quizduell_runner.c index 14e5da2..28ce2e4 100644 --- a/build/test/runners/test_quizduell_runner.c +++ b/build/test/runners/test_quizduell_runner.c @@ -12,6 +12,7 @@ extern void setUp(void); extern void tearDown(void); extern void test_erstelleFrage(void); extern void test_CookingFragen(void); +extern void test_MountainsFragen(void); /*=======Mock Management=====*/ @@ -78,6 +79,7 @@ int main(void) UnityBegin("test_quizduell.c"); run_test(test_erstelleFrage, "test_erstelleFrage", 11); run_test(test_CookingFragen, "test_CookingFragen", 22); + run_test(test_MountainsFragen, "test_MountainsFragen", 44); return UnityEnd(); } diff --git a/test/test_quizduell.c b/test/test_quizduell.c index 36e8d2d..d296d07 100644 --- a/test/test_quizduell.c +++ b/test/test_quizduell.c @@ -62,4 +62,26 @@ void test_MountainsFragen(void) { free(kategorien[0].fragen); } +void test_createCategory2WithQuestions(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_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_CHAR('B', kategorien[2].fragen[0].korrekteAntwort); + + free(kategorien[2].fragen); +} + #endif //TEST \ No newline at end of file