diff --git a/build/test/cache/test_casualQuiz.c b/build/test/cache/test_casualQuiz.c index 1151bcc..d8adf92 100644 --- a/build/test/cache/test_casualQuiz.c +++ b/build/test/cache/test_casualQuiz.c @@ -40,7 +40,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex1(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -48,7 +50,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex1(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(25)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(26)));}} while(0); @@ -68,7 +70,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex2(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -76,7 +80,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex2(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(35)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(37)));}} while(0); @@ -96,7 +100,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -104,7 +110,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(45)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(48)));}} while(0); @@ -122,7 +128,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -130,7 +138,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(54)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(58)));}} while(0); @@ -150,13 +158,15 @@ void test_FcheckaufRichtigkeit_incorrect_input_higher(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); do {if ((testfall != 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(63)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(68)));}} while(0); } @@ -174,13 +184,15 @@ void test_FcheckaufRichtigkeit_incorrect_input_lower(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); do {if ((testfall != 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(71)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(77)));}} while(0); } @@ -212,13 +224,13 @@ void test_FzaehlernachAuswahl(void){ ((void *)0) - ), (UNITY_UINT)(81), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(87), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(82), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(88), UNITY_DISPLAY_STYLE_INT); @@ -252,13 +264,13 @@ void test_FzaehlernachAuswahl_bei1(void){ ((void *)0) - ), (UNITY_UINT)(93), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(99), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(94), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(100), UNITY_DISPLAY_STYLE_INT); @@ -292,13 +304,13 @@ void test_FzaehlernachAuswahl_falsch_bei_0(void){ ((void *)0) - ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(111), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(106), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(112), UNITY_DISPLAY_STYLE_INT); @@ -332,13 +344,13 @@ void test_FzaehlernachAuswahl_falsch_bei_1(void){ ((void *)0) - ), (UNITY_UINT)(117), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(123), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(118), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(124), UNITY_DISPLAY_STYLE_INT); @@ -374,7 +386,7 @@ do {if ((testbool == 0 -)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(126)));}} while(0); +)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(132)));}} while(0); diff --git a/build/test/out/c/casualQuiz.o b/build/test/out/c/casualQuiz.o index 37f5686..abef013 100644 Binary files a/build/test/out/c/casualQuiz.o and b/build/test/out/c/casualQuiz.o differ diff --git a/build/test/out/c/test_casualQuiz.o b/build/test/out/c/test_casualQuiz.o index 7e64bf9..869c937 100644 Binary files a/build/test/out/c/test_casualQuiz.o and b/build/test/out/c/test_casualQuiz.o differ diff --git a/build/test/out/c/test_casualQuiz_runner.o b/build/test/out/c/test_casualQuiz_runner.o index a7d44af..9a8876a 100644 Binary files a/build/test/out/c/test_casualQuiz_runner.o and b/build/test/out/c/test_casualQuiz_runner.o differ diff --git a/build/test/out/test_casualQuiz.out b/build/test/out/test_casualQuiz.out index 4aa6f6d..42289ce 100755 Binary files a/build/test/out/test_casualQuiz.out and b/build/test/out/test_casualQuiz.out differ diff --git a/build/test/preprocess/files/test_casualQuiz.c b/build/test/preprocess/files/test_casualQuiz.c index 1151bcc..d8adf92 100644 --- a/build/test/preprocess/files/test_casualQuiz.c +++ b/build/test/preprocess/files/test_casualQuiz.c @@ -40,7 +40,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex1(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -48,7 +50,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex1(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(25)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(26)));}} while(0); @@ -68,7 +70,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex2(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -76,7 +80,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex2(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(35)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(37)));}} while(0); @@ -96,7 +100,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -104,7 +110,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(45)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(48)));}} while(0); @@ -122,7 +128,9 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); @@ -130,7 +138,7 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(54)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(58)));}} while(0); @@ -150,13 +158,15 @@ void test_FcheckaufRichtigkeit_incorrect_input_higher(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); do {if ((testfall != 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(63)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(68)));}} while(0); } @@ -174,13 +184,15 @@ void test_FcheckaufRichtigkeit_incorrect_input_lower(void){ testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); do {if ((testfall != 1 - )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(71)));}} while(0); + )) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(77)));}} while(0); } @@ -212,13 +224,13 @@ void test_FzaehlernachAuswahl(void){ ((void *)0) - ), (UNITY_UINT)(81), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(87), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(82), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(88), UNITY_DISPLAY_STYLE_INT); @@ -252,13 +264,13 @@ void test_FzaehlernachAuswahl_bei1(void){ ((void *)0) - ), (UNITY_UINT)(93), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(99), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(94), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(100), UNITY_DISPLAY_STYLE_INT); @@ -292,13 +304,13 @@ void test_FzaehlernachAuswahl_falsch_bei_0(void){ ((void *)0) - ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(111), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(106), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(112), UNITY_DISPLAY_STYLE_INT); @@ -332,13 +344,13 @@ void test_FzaehlernachAuswahl_falsch_bei_1(void){ ((void *)0) - ), (UNITY_UINT)(117), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(123), UNITY_DISPLAY_STYLE_INT); UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((answered)), ( ((void *)0) - ), (UNITY_UINT)(118), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(124), UNITY_DISPLAY_STYLE_INT); @@ -374,7 +386,7 @@ do {if ((testbool == 0 -)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(126)));}} while(0); +)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(132)));}} while(0); diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index 69f6df4..650dbc0 100644 --- a/build/test/results/test_casualQuiz.pass +++ b/build/test/results/test_casualQuiz.pass @@ -8,43 +8,43 @@ :message: '' :unity_test_time: 0 - :test: test_FcheckaufRichtigkeit_correct_answer_atIndex2 - :line: 28 + :line: 29 :message: '' :unity_test_time: 0 - :test: test_FcheckaufRichtigkeit_correct_answer_atIndex3 - :line: 38 + :line: 40 :message: '' :unity_test_time: 0 - :test: test_FcheckaufRichtigkeit_correct_answer_atIndex4 - :line: 47 + :line: 50 :message: '' :unity_test_time: 0 - :test: test_FcheckaufRichtigkeit_incorrect_input_higher - :line: 57 + :line: 61 :message: '' :unity_test_time: 0 - :test: test_FcheckaufRichtigkeit_incorrect_input_lower - :line: 65 + :line: 70 :message: '' :unity_test_time: 0 - :test: test_FzaehlernachAuswahl - :line: 73 + :line: 79 :message: '' :unity_test_time: 0 - :test: test_FzaehlernachAuswahl_bei1 - :line: 85 + :line: 91 :message: '' :unity_test_time: 0 - :test: test_FzaehlernachAuswahl_falsch_bei_0 - :line: 97 + :line: 103 :message: '' :unity_test_time: 0 - :test: test_FzaehlernachAuswahl_falsch_bei_1 - :line: 109 + :line: 115 :message: '' :unity_test_time: 0 - :test: test_FtryAgain_butalways_played_is_false - :line: 121 + :line: 127 :message: '' :unity_test_time: 0 :failures: [] @@ -66,4 +66,4 @@ - Wrong Input! - Wrong Input! - It looks like you havent played the program yet, starting it up... -:time: 0.03676419996190816 +:time: 0.015266000060364604 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index f97a5fd..37d2fa8 100644 --- a/build/test/results/test_quizduell.pass +++ b/build/test/results/test_quizduell.pass @@ -11,4 +11,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.014482000027783215 +:time: 0.014835100038908422 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index 823fed0..93c422b 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.015876200050115585 +:time: 0.013974100002087653 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index cce94d0..3c9badc 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.016650600009597838 +:time: 0.015707500046119094 diff --git a/build/test/runners/test_casualQuiz_runner.c b/build/test/runners/test_casualQuiz_runner.c index 4ede39b..86ae5e6 100644 --- a/build/test/runners/test_casualQuiz_runner.c +++ b/build/test/runners/test_casualQuiz_runner.c @@ -86,16 +86,16 @@ int main(void) { UnityBegin("test_casualQuiz.c"); run_test(test_FcheckaufRichtigkeit_correct_answer_atIndex1, "test_FcheckaufRichtigkeit_correct_answer_atIndex1", 18); - run_test(test_FcheckaufRichtigkeit_correct_answer_atIndex2, "test_FcheckaufRichtigkeit_correct_answer_atIndex2", 28); - run_test(test_FcheckaufRichtigkeit_correct_answer_atIndex3, "test_FcheckaufRichtigkeit_correct_answer_atIndex3", 38); - run_test(test_FcheckaufRichtigkeit_correct_answer_atIndex4, "test_FcheckaufRichtigkeit_correct_answer_atIndex4", 47); - run_test(test_FcheckaufRichtigkeit_incorrect_input_higher, "test_FcheckaufRichtigkeit_incorrect_input_higher", 57); - run_test(test_FcheckaufRichtigkeit_incorrect_input_lower, "test_FcheckaufRichtigkeit_incorrect_input_lower", 65); - run_test(test_FzaehlernachAuswahl, "test_FzaehlernachAuswahl", 73); - run_test(test_FzaehlernachAuswahl_bei1, "test_FzaehlernachAuswahl_bei1", 85); - run_test(test_FzaehlernachAuswahl_falsch_bei_0, "test_FzaehlernachAuswahl_falsch_bei_0", 97); - run_test(test_FzaehlernachAuswahl_falsch_bei_1, "test_FzaehlernachAuswahl_falsch_bei_1", 109); - run_test(test_FtryAgain_butalways_played_is_false, "test_FtryAgain_butalways_played_is_false", 121); + run_test(test_FcheckaufRichtigkeit_correct_answer_atIndex2, "test_FcheckaufRichtigkeit_correct_answer_atIndex2", 29); + run_test(test_FcheckaufRichtigkeit_correct_answer_atIndex3, "test_FcheckaufRichtigkeit_correct_answer_atIndex3", 40); + run_test(test_FcheckaufRichtigkeit_correct_answer_atIndex4, "test_FcheckaufRichtigkeit_correct_answer_atIndex4", 50); + run_test(test_FcheckaufRichtigkeit_incorrect_input_higher, "test_FcheckaufRichtigkeit_incorrect_input_higher", 61); + run_test(test_FcheckaufRichtigkeit_incorrect_input_lower, "test_FcheckaufRichtigkeit_incorrect_input_lower", 70); + run_test(test_FzaehlernachAuswahl, "test_FzaehlernachAuswahl", 79); + run_test(test_FzaehlernachAuswahl_bei1, "test_FzaehlernachAuswahl_bei1", 91); + run_test(test_FzaehlernachAuswahl_falsch_bei_0, "test_FzaehlernachAuswahl_falsch_bei_0", 103); + run_test(test_FzaehlernachAuswahl_falsch_bei_1, "test_FzaehlernachAuswahl_falsch_bei_1", 115); + run_test(test_FtryAgain_butalways_played_is_false, "test_FtryAgain_butalways_played_is_false", 127); return UnityEnd(); } diff --git a/src/casualQuiz.c b/src/casualQuiz.c index 573ca20..bee238a 100644 --- a/src/casualQuiz.c +++ b/src/casualQuiz.c @@ -76,14 +76,9 @@ bool activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], in fzeigeAntworten(antworten, i); //Antworten zum gleichen index wie die fragen ausgeben printf("Reminder: Typing 0 lets you stop the game.\nPlease type in your answer 1,2,3 or 4: "); eingabe = feingabeInteger(); //eingabe Funktion - richtig = fcheckaufRichtigkeit(eingabe, richtige_antwort, i); //überprüfung der eingabe anhand des richtige_eingabe arrays und dem index + richtig = fcheckaufRichtigkeit(eingabe, antworten, richtige_antwort, i); //überprüfung der eingabe anhand des richtige_eingabe arrays und dem index fzaehlernachAuswahl(richtig, answeredP, correctP); // zähler werden hochgezählt je nach eingabe - if (richtig == false){ - printf("Would you like to know the right answer?\nInput 1 if oyu want to see it, 0 if not: "); - scanf_s("%d", &ansehen); - if (ansehen == 1) printf("The right answer was: %d) %s\n", richtige_antwort[i],antworten[4 * i + richtige_antwort[i-1]]); - else printf("Continuing...\n"); - } + } return true; @@ -102,7 +97,8 @@ int feingabeInteger() { scanf_s("%d", &eingabe); //reine ingabe, prints sind vorher schon passiert return eingabe; // return der eingabe } -bool fcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i) { +bool fcheckaufRichtigkeit(int eingabe,char* antworten[], int richtige_antwort[], int i) { + int ansehen = 0; switch (eingabe) {//start vom switch case 0:{ //eingabe 0: abbruch funktion wird aufgerufen fabbruch(); @@ -114,7 +110,13 @@ bool fcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i) { printf("Right Answer, well done.\n"); return true; } - else printf("Wrong answer.\n"); //wenn eingabe falsch ist + else { + printf("Wrong answer.\n"); //wenn eingabe falsch ist + printf("Would you like to know the right answer?\nInput 1 if oyu want to see it, 0 if not: "); + scanf_s("%d", &ansehen); + if (ansehen == 1) printf("The right answer was: %d) %s\n", richtige_antwort[i],antworten[4 * i + richtige_antwort[i]-1]); + else printf("Continuing...\n"); + } break; } case 2: { @@ -123,7 +125,13 @@ bool fcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i) { printf("Right Answer, well done.\n"); return true; } - else printf("Wrong answer.\n");//wenn eingabe falsch ist + else { + printf("Wrong answer.\n"); //wenn eingabe falsch ist + printf("Would you like to know the right answer?\nInput 1 if oyu want to see it, 0 if not: "); + scanf_s("%d", &ansehen); + if (ansehen == 1) printf("The right answer was: %d) %s\n", richtige_antwort[i],antworten[4 * i + richtige_antwort[i]-1]); + else printf("Continuing...\n"); + } break; } case 3: { @@ -132,7 +140,13 @@ bool fcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i) { printf("Right Answer, well done.\n"); return true; } - else printf("Wrong answer.\n");//wenn eingabe falsch ist + else { + printf("Wrong answer.\n"); //wenn eingabe falsch ist + printf("Would you like to know the right answer?\nInput 1 if oyu want to see it, 0 if not: "); + scanf_s("%d", &ansehen); + if (ansehen == 1) printf("The right answer was: %d) %s\n", richtige_antwort[i],antworten[4 * i + richtige_antwort[i]-1]); + else printf("Continuing...\n"); + } break; } case 4: { @@ -141,7 +155,13 @@ bool fcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i) { printf("Right Answer, well done.\n"); return true; } - else printf("Wrong answer.\n");// wenn eingabe falsch ist + else { + printf("Wrong answer.\n"); //wenn eingabe falsch ist + printf("Would you like to know the right answer?\nInput 1 if oyu want to see it, 0 if not: "); + scanf_s("%d", &ansehen); + if (ansehen == 1) printf("The right answer was: %d) %s\n", richtige_antwort[i],antworten[4 * i + richtige_antwort[i]-1]); + else printf("Continuing...\n"); + } break; } default: { // eingabe war was anderes als 1,2,3,4 oder 5 diff --git a/src/casualQuiz.h b/src/casualQuiz.h index 488bf67..464f598 100644 --- a/src/casualQuiz.h +++ b/src/casualQuiz.h @@ -6,7 +6,7 @@ bool activePlaying(char* fragen[], char* antworten[], int richtige_antwort[], in void fzeigeFragen(char* fragen[], int index); void fzeigeAntworten(char* antworten[], int index); int feingabeInteger(); -bool fcheckaufRichtigkeit(int eingabe, int richtige_antwort[], int i); +bool fcheckaufRichtigkeit(int eingabe,char* antworten[], int richtige_antwort[], int i); void fzaehlernachAuswahl(bool richtig, int* answeredP, int* correctP); bool ftryAgain(bool already_played); void fabbruch(); diff --git a/test/test_casualQuiz.c b/test/test_casualQuiz.c index 2c58ede..f4db5ac 100644 --- a/test/test_casualQuiz.c +++ b/test/test_casualQuiz.c @@ -20,7 +20,8 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex1(void){ int TESTindex = 0; int TESTrichtige_antwort[]={1}; bool testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); TEST_ASSERT_TRUE(testfall == true); @@ -30,7 +31,8 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex2(void){ int TESTindex = 0; int TESTrichtige_antwort[]={2}; bool testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); TEST_ASSERT_TRUE(testfall == true); @@ -40,7 +42,8 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ int TESTindex = 0; int TESTrichtige_antwort[]={3}; bool testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); TEST_ASSERT_TRUE(testfall == true); @@ -49,7 +52,8 @@ void test_FcheckaufRichtigkeit_correct_answer_atIndex3(void){ int TESTindex = 0; int TESTrichtige_antwort[]={4}; bool testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); TEST_ASSERT_TRUE(testfall == true); @@ -59,7 +63,8 @@ void test_FcheckaufRichtigkeit_incorrect_input_higher(void){ int TESTindex = 0; int TESTrichtige_antwort[]={3}; bool testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); TEST_ASSERT_TRUE(testfall != true); } void test_FcheckaufRichtigkeit_incorrect_input_lower(void){ @@ -67,7 +72,8 @@ void test_FcheckaufRichtigkeit_incorrect_input_lower(void){ int TESTindex = 0; int TESTrichtige_antwort[]={3}; bool testfall; - testfall = fcheckaufRichtigkeit(TESTeingabe, TESTrichtige_antwort, TESTindex); + char* TESTantworten[]= {"The End", "The Termination", "Pizza's ready", "Hotdog Time"}; + testfall = fcheckaufRichtigkeit(TESTeingabe, TESTantworten, TESTrichtige_antwort, TESTindex); TEST_ASSERT_TRUE(testfall != true); } void test_FzaehlernachAuswahl(void){