Browse Source

Unittest3

remotes/origin/Kevin
Kevin Schellberg 11 months ago
parent
commit
40d4a9e5e4
  1. 70
      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. 70
      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. 20
      test/test_quizduell.c

70
build/test/cache/test_quizduell.c

@ -57,3 +57,73 @@ void test_erstelleFrage(void) {
), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_CHAR); ), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_CHAR);
} }
void test_CookingFragen(void) {
Kategorie kategorien[3];
kategorien[1].fragen = (QuizFrage*)malloc(3 * sizeof(QuizFrage));
kategorien[1].fragen[0] = erstelleFrage("Which Ingredient is used traditionally for Pesto?", "Tomatoes", "Basil", "Spinach", "Oregano", 'B');
kategorien[1].fragen[1] = erstelleFrage("Which meal is known for its usage of rice?", "Lasagna", "Sushi", "Pizza", "Hamburger", 'B');
kategorien[1].fragen[2] = erstelleFrage("Which color has a ripe banana?", "Red", "Green", "Yellow", "Orange", 'C');
kategorien[1].anzahlFragen = 3;
kategorien[1].joker = 1;
UnityAssertEqualString((const char*)(("Which Ingredient is used traditionally for Pesto?")), (const char*)((kategorien[1].fragen[0].frage)), (
((void *)0)
), (UNITY_UINT)(34));
UnityAssertEqualString((const char*)(("Tomatoes")), (const char*)((kategorien[1].fragen[0].antwortA)), (
((void *)0)
), (UNITY_UINT)(35));
UnityAssertEqualString((const char*)(("Basil")), (const char*)((kategorien[1].fragen[0].antwortB)), (
((void *)0)
), (UNITY_UINT)(36));
UnityAssertEqualString((const char*)(("Spinach")), (const char*)((kategorien[1].fragen[0].antwortC)), (
((void *)0)
), (UNITY_UINT)(37));
UnityAssertEqualString((const char*)(("Oregano")), (const char*)((kategorien[1].fragen[0].antwortD)), (
((void *)0)
), (UNITY_UINT)(38));
UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('B')), (UNITY_INT)(UNITY_INT8 )((kategorien[1].fragen[0].korrekteAntwort)), (
((void *)0)
), (UNITY_UINT)(39), UNITY_DISPLAY_STYLE_CHAR);
free(kategorien[1].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

70
build/test/preprocess/files/test_quizduell.c

@ -57,3 +57,73 @@ void test_erstelleFrage(void) {
), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_CHAR); ), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_CHAR);
} }
void test_CookingFragen(void) {
Kategorie kategorien[3];
kategorien[1].fragen = (QuizFrage*)malloc(3 * sizeof(QuizFrage));
kategorien[1].fragen[0] = erstelleFrage("Which Ingredient is used traditionally for Pesto?", "Tomatoes", "Basil", "Spinach", "Oregano", 'B');
kategorien[1].fragen[1] = erstelleFrage("Which meal is known for its usage of rice?", "Lasagna", "Sushi", "Pizza", "Hamburger", 'B');
kategorien[1].fragen[2] = erstelleFrage("Which color has a ripe banana?", "Red", "Green", "Yellow", "Orange", 'C');
kategorien[1].anzahlFragen = 3;
kategorien[1].joker = 1;
UnityAssertEqualString((const char*)(("Which Ingredient is used traditionally for Pesto?")), (const char*)((kategorien[1].fragen[0].frage)), (
((void *)0)
), (UNITY_UINT)(34));
UnityAssertEqualString((const char*)(("Tomatoes")), (const char*)((kategorien[1].fragen[0].antwortA)), (
((void *)0)
), (UNITY_UINT)(35));
UnityAssertEqualString((const char*)(("Basil")), (const char*)((kategorien[1].fragen[0].antwortB)), (
((void *)0)
), (UNITY_UINT)(36));
UnityAssertEqualString((const char*)(("Spinach")), (const char*)((kategorien[1].fragen[0].antwortC)), (
((void *)0)
), (UNITY_UINT)(37));
UnityAssertEqualString((const char*)(("Oregano")), (const char*)((kategorien[1].fragen[0].antwortD)), (
((void *)0)
), (UNITY_UINT)(38));
UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('B')), (UNITY_INT)(UNITY_INT8 )((kategorien[1].fragen[0].korrekteAntwort)), (
((void *)0)
), (UNITY_UINT)(39), UNITY_DISPLAY_STYLE_CHAR);
free(kategorien[1].fragen);
}

2
build/test/results/test_casualQuiz.pass

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

10
build/test/results/test_quizduell.pass

@ -7,12 +7,16 @@
:line: 11 :line: 11
:message: '' :message: ''
:unity_test_time: 0 :unity_test_time: 0
- :test: test_CookingFragen
:line: 22
:message: ''
:unity_test_time: 0
:failures: [] :failures: []
:ignores: [] :ignores: []
:counts: :counts:
:total: 1
:passed: 1
:total: 2
:passed: 2
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.01654910000070231
:time: 0.03265889999966021

2
build/test/results/test_timequiz.pass

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

2
build/test/results/test_wwm.pass

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

2
build/test/runners/test_quizduell_runner.c

@ -11,6 +11,7 @@ char* GlobalOrderError;
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_erstelleFrage(void); extern void test_erstelleFrage(void);
extern void test_CookingFragen(void);
/*=======Mock Management=====*/ /*=======Mock Management=====*/
@ -76,6 +77,7 @@ int main(void)
{ {
UnityBegin("test_quizduell.c"); UnityBegin("test_quizduell.c");
run_test(test_erstelleFrage, "test_erstelleFrage", 11); run_test(test_erstelleFrage, "test_erstelleFrage", 11);
run_test(test_CookingFragen, "test_CookingFragen", 22);
return UnityEnd(); return UnityEnd();
} }

20
test/test_quizduell.c

@ -41,5 +41,25 @@ void test_CookingFragen(void) {
free(kategorien[1].fragen); free(kategorien[1].fragen);
} }
void test_MountainsFragen(void) {
Kategorie kategorien[MAX_CATEGORIES];
kategorien[0].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * 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 = MAX_QUESTIONS_PER_CATEGORY;
kategorien[0].joker = 1;
TEST_ASSERT_EQUAL_STRING("Whats the height of the Zugspitze?", kategorien[0].fragen[0].frage);
TEST_ASSERT_EQUAL_STRING("2482 Meter", kategorien[0].fragen[0].antwortA);
TEST_ASSERT_EQUAL_STRING("2867 Meter", kategorien[0].fragen[0].antwortB);
TEST_ASSERT_EQUAL_STRING("2962 Meter", kategorien[0].fragen[0].antwortC);
TEST_ASSERT_EQUAL_STRING("3173 Meter", kategorien[0].fragen[0].antwortD);
TEST_ASSERT_EQUAL_CHAR('C', kategorien[0].fragen[0].korrekteAntwort);
free(kategorien[0].fragen);
}
#endif //TEST #endif //TEST
Loading…
Cancel
Save