diff --git a/build/test/cache/test_quizduell.c b/build/test/cache/test_quizduell.c index 5c13c63..22ae955 100644 --- a/build/test/cache/test_quizduell.c +++ b/build/test/cache/test_quizduell.c @@ -193,3 +193,69 @@ void test_MountainsFragen(void) { free(kategorien[0].fragen); } + +void test_createCategory2WithQuestions(void) { + + Kategorie kategorien[3]; + + + + kategorien[2].fragen = (QuizFrage*)malloc(3 * 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 = 3; + + kategorien[2].joker = 1; + + + + UnityAssertEqualString((const char*)(("In which sport is the term 'home run' used?")), (const char*)((kategorien[2].fragen[0].frage)), ( + + ((void *)0) + + ), (UNITY_UINT)(77)); + + UnityAssertEqualString((const char*)(("Soccer/Football")), (const char*)((kategorien[2].fragen[0].antwortA)), ( + + ((void *)0) + + ), (UNITY_UINT)(78)); + + UnityAssertEqualString((const char*)(("Baseball")), (const char*)((kategorien[2].fragen[0].antwortB)), ( + + ((void *)0) + + ), (UNITY_UINT)(79)); + + UnityAssertEqualString((const char*)(("Tennis")), (const char*)((kategorien[2].fragen[0].antwortC)), ( + + ((void *)0) + + ), (UNITY_UINT)(80)); + + UnityAssertEqualString((const char*)(("Golf")), (const char*)((kategorien[2].fragen[0].antwortD)), ( + + ((void *)0) + + ), (UNITY_UINT)(81)); + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('B')), (UNITY_INT)(UNITY_INT8 )((kategorien[2].fragen[0].korrekteAntwort)), ( + + ((void *)0) + + ), (UNITY_UINT)(82), UNITY_DISPLAY_STYLE_CHAR); + + + + free(kategorien[2].fragen); + +} diff --git a/build/test/out/c/test_quizduell.o b/build/test/out/c/test_quizduell.o index 606172b..8c2c0b2 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 92e82e1..984d908 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 2463d7d..cef7df9 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 5c13c63..22ae955 100644 --- a/build/test/preprocess/files/test_quizduell.c +++ b/build/test/preprocess/files/test_quizduell.c @@ -193,3 +193,69 @@ void test_MountainsFragen(void) { free(kategorien[0].fragen); } + +void test_createCategory2WithQuestions(void) { + + Kategorie kategorien[3]; + + + + kategorien[2].fragen = (QuizFrage*)malloc(3 * 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 = 3; + + kategorien[2].joker = 1; + + + + UnityAssertEqualString((const char*)(("In which sport is the term 'home run' used?")), (const char*)((kategorien[2].fragen[0].frage)), ( + + ((void *)0) + + ), (UNITY_UINT)(77)); + + UnityAssertEqualString((const char*)(("Soccer/Football")), (const char*)((kategorien[2].fragen[0].antwortA)), ( + + ((void *)0) + + ), (UNITY_UINT)(78)); + + UnityAssertEqualString((const char*)(("Baseball")), (const char*)((kategorien[2].fragen[0].antwortB)), ( + + ((void *)0) + + ), (UNITY_UINT)(79)); + + UnityAssertEqualString((const char*)(("Tennis")), (const char*)((kategorien[2].fragen[0].antwortC)), ( + + ((void *)0) + + ), (UNITY_UINT)(80)); + + UnityAssertEqualString((const char*)(("Golf")), (const char*)((kategorien[2].fragen[0].antwortD)), ( + + ((void *)0) + + ), (UNITY_UINT)(81)); + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('B')), (UNITY_INT)(UNITY_INT8 )((kategorien[2].fragen[0].korrekteAntwort)), ( + + ((void *)0) + + ), (UNITY_UINT)(82), UNITY_DISPLAY_STYLE_CHAR); + + + + free(kategorien[2].fragen); + +} diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index 78816d6..f596fdb 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.0162979999986419 +:time: 0.017894000000524102 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index e85f8af..c9070e7 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -15,12 +15,16 @@ :line: 44 :message: '' :unity_test_time: 0 +- :test: test_createCategory2WithQuestions + :line: 65 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 3 - :passed: 3 + :total: 4 + :passed: 4 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.03225860000020475 +:time: 0.03097669999988284 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 9b3b91c..9132c70 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.01628539999910572 +:time: 0.01692929999990156 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index e966d0d..2652f96 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.015815200000361074 +:time: 0.016848700000991812 diff --git a/build/test/runners/test_quizduell_runner.c b/build/test/runners/test_quizduell_runner.c index 28ce2e4..d86c5ed 100644 --- a/build/test/runners/test_quizduell_runner.c +++ b/build/test/runners/test_quizduell_runner.c @@ -13,6 +13,7 @@ extern void tearDown(void); extern void test_erstelleFrage(void); extern void test_CookingFragen(void); extern void test_MountainsFragen(void); +extern void test_createCategory2WithQuestions(void); /*=======Mock Management=====*/ @@ -80,6 +81,7 @@ int main(void) run_test(test_erstelleFrage, "test_erstelleFrage", 11); run_test(test_CookingFragen, "test_CookingFragen", 22); run_test(test_MountainsFragen, "test_MountainsFragen", 44); + run_test(test_createCategory2WithQuestions, "test_createCategory2WithQuestions", 65); return UnityEnd(); } diff --git a/test/test_quizduell.c b/test/test_quizduell.c index d296d07..a4b659b 100644 --- a/test/test_quizduell.c +++ b/test/test_quizduell.c @@ -83,5 +83,17 @@ void test_createCategory2WithQuestions(void) { free(kategorien[2].fragen); } +void test_befreieKategorie(void) { + Kategorie testKategorie; + testKategorie.fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage)); + testKategorie.anzahlFragen = 3; + testKategorie.joker = 1; + + befreieKategorie(&testKategorie); + + TEST_ASSERT_NULL(testKategorie.fragen); + TEST_ASSERT_EQUAL_INT(0, testKategorie.anzahlFragen); + TEST_ASSERT_EQUAL_INT(0, testKategorie.joker); +} #endif //TEST \ No newline at end of file