Browse Source

Unittest4

remotes/origin/Kevin
Kevin Schellberg 11 months ago
parent
commit
554d3adf89
  1. 66
      build/test/cache/test_quizduell.c
  2. BIN
      build/test/out/c/test_quizduell.o
  3. BIN
      build/test/out/c/test_quizduell_runner.o
  4. BIN
      build/test/out/test_quizduell.out
  5. 66
      build/test/preprocess/files/test_quizduell.c
  6. 2
      build/test/results/test_casualQuiz.pass
  7. 10
      build/test/results/test_quizduell.pass
  8. 2
      build/test/results/test_timequiz.pass
  9. 2
      build/test/results/test_wwm.pass
  10. 2
      build/test/runners/test_quizduell_runner.c
  11. 22
      test/test_quizduell.c

66
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);
}

BIN
build/test/out/c/test_quizduell.o

BIN
build/test/out/c/test_quizduell_runner.o

BIN
build/test/out/test_quizduell.out

66
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);
}

2
build/test/results/test_casualQuiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.01786770000035176
:time: 0.0162979999986419

10
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

2
build/test/results/test_timequiz.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.019886199999746168
:time: 0.01628539999910572

2
build/test/results/test_wwm.pass

@ -11,4 +11,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.01826220000111789
:time: 0.015815200000361074

2
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();
}

22
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
Loading…
Cancel
Save