Browse Source

Unittest5

remotes/origin/Kevin
Kevin Schellberg 11 months ago
parent
commit
76ed85c139
  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. 12
      test/test_quizduell.c

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

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

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

2
build/test/results/test_casualQuiz.pass

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

10
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

2
build/test/results/test_timequiz.pass

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

2
build/test/results/test_wwm.pass

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

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

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