From e0316435639fa287a3ab7e4d606e05bd25200e62 Mon Sep 17 00:00:00 2001 From: Pascal Schneider Date: Tue, 6 Feb 2024 21:34:01 +0100 Subject: [PATCH] =?UTF-8?q?refactoring:=20const=20in=20jede=20Datei=20hinz?= =?UTF-8?q?ugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/test/cache/test_timequiz.c | 20 ++++++++++---------- build/test/out/c/test_timequiz.o | Bin 10955 -> 10951 bytes build/test/out/c/timequiz.o | Bin 16711 -> 16707 bytes build/test/out/test_casualQuiz.out | Bin 101213 -> 101213 bytes build/test/out/test_quizduell.out | Bin 101212 -> 101212 bytes build/test/out/test_timequiz.out | Bin 127109 -> 127109 bytes build/test/out/test_wwm.out | Bin 101188 -> 101188 bytes build/test/preprocess/files/test_timequiz.c | 20 ++++++++++---------- build/test/results/test_casualQuiz.pass | 2 +- build/test/results/test_quizduell.pass | 2 +- build/test/results/test_timequiz.pass | 2 +- build/test/results/test_wwm.pass | 2 +- src/timequiz.c | 10 +++++----- test/test_timequiz.c | 20 ++++++++++---------- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/build/test/cache/test_timequiz.c b/build/test/cache/test_timequiz.c index 591ce84..37a3916 100644 --- a/build/test/cache/test_timequiz.c +++ b/build/test/cache/test_timequiz.c @@ -34,9 +34,9 @@ void test_getRandomQuestionIndex(void) { void test_displayQuestion(void) { - char* question = "Test Question"; + const char* question = "Test Question"; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; int correctIndex = 0; @@ -66,7 +66,7 @@ void test_processUserAnswer_correct(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; @@ -98,7 +98,7 @@ void test_processUserAnswer_wrong(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; @@ -128,7 +128,7 @@ void test_processUserAnswer_correctAnswer_index3(void) { int totalCorrectAnswers = 0; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; processUserAnswer(4, 3, &score, &totalCorrectAnswers, answers); @@ -154,7 +154,7 @@ void test_processUserAnswer_correctAnswer_index0(void) { int totalCorrectAnswers = 0; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; processUserAnswer(1, 0, &score, &totalCorrectAnswers, answers); @@ -180,7 +180,7 @@ void test_processUserAnswer_wrongAnswer_index3(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; @@ -210,7 +210,7 @@ void test_processUserAnswer_correctAnswer_index1(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 1; @@ -240,7 +240,7 @@ void test_processUserAnswer_correctAnswer_index2(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 2; @@ -270,7 +270,7 @@ void test_processUserAnswer_wrongAnswer_index1(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 2; diff --git a/build/test/out/c/test_timequiz.o b/build/test/out/c/test_timequiz.o index 4ac1e7034f4d4ec8b6444f0283097314087ddfb1..e0c610b5c6d94cfbb05272d31f9824c61b2320cc 100644 GIT binary patch delta 1131 zcmZ9KTSydP6vw|a?uUu93G2C@QEOl^(=-Q{GA}w|1IwXOT~UQ_Q2jj~f*N>^aj26U140zz4XBY%5QXp| zRSNL~)WKm|y;v^k&}BxXS1x#bTP^}nQE^A=ozafg?%uv=Ye#p>PBB+COg*j%~hEL=<_f$)JUAtYaI$fVzxT>9ITgg2D5B?17tMH^`Rch2zvOM8jm1=bv ztfgT>R?nwo4=x1D$ap#!C?%szMyj%_(-nmw3{4ZG0HT^G|prt?4cKl?CctAZ<*G)T1UU5?VDv<-Xc>A%}cOinzbd4zuVfi A#sB~S delta 1089 zcmZwFUr1A76aet=T)p$&F57Cmck0x1%)g|;B1ivThpfa1Hp3!xIHOTaV@?Q!g=G(; zht@&yAyO!;C@Q!?AOyWcNEn2@1icthQ4cNZp@OJ$cfIGSaryY&^XEI?ciHpgi=>*q zKo%`g3Tb;#3Z7{q#`+qDt8plJ;wRH8WOs7wBr= z>JQMmGuTM$wP0hfmX~Fz+b^|Sj||qbXG&Htt%{&q!?~O{}vvSYKIxSaI3u9UoM28 zbyyKafKvMJNkx+KAx J`Jlb7`X7+%uk!!^ diff --git a/build/test/out/c/timequiz.o b/build/test/out/c/timequiz.o index e4b377d737970111b5ec7ddb3b0719dc58c04b77..8fc0f2e3d6878c6c8f8a11749473cea51dea02c8 100644 GIT binary patch delta 1391 zcmYL|UuauZ9LLY^o}Ig!F748#vEAsOG_kpvNv#9dR>j&%ox<2;q{Rwq$(CDm=P*hXONC63c_G@gFX1T3Hl;3Hc+uo{?0ww@jTpozUTM% z{LaZwC*g;a5GuUUM#Or`3nii84Vv(&H+>AA_bxpSFYq4d3#}T2OvMSw@<$*E5ncq7 z&1VQ%<;!T@t`Sm0b(vp4>(~4`n9$2Znh8;VmzL~>hCdx&*J3TRh2q?tTP#___Y&>= zjt?>J7Jo3=tA{Be5a#)0I8RM{Lzd%AJC;4M;2g7Tvi60JMqH=l4}sc}id^e%MlxZfYgs7`!#Py8E!=qM z0#??%2-_Ff_e$Btp3MjPut=qOak5FAqoYuCD)adl4;--^w^&{vjr*Im9g!Xv)Y`C; zv3T2oHWDHbTW3MS#)wR4$bK4o`1n9Ke9NC6NWuy~G0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7X{ZJz5!o%%aF#Wtst+fMt{@|w4~GoDJF>lkJiOnVGF0Q%nQ1mV-a zM2pi%Tk*|jnUjt^_rA|Crg_tR;Hx_|Z`Kd}x}VmP_i=+-hI z9eix+G#k`5$~B;7w?=)34kbJ0ymgtj# zrW&MK{DzfNG^VN-)aa{fM_!GvYVJ1K%|`m4B6YXizf9cXz)E}L5t6UQHVAa!Q%)iZ z!5|`Gdr{gBN_1SJ(-M7yNMziTwuch^ExnuZt%|tah_G4%%jE?`bVQzxL48Z^Z delta 25 hcmcaRjqUCn+CSE&!mb3~2xW diff --git a/build/test/out/test_quizduell.out b/build/test/out/test_quizduell.out index 58ae35503a403746acea9f22b298a574f392524d..42e05d507bcf67268f642007000334535da5936b 100644 GIT binary patch delta 25 hcmcaJjqT1fwh0}~C#M~n*zL=7?tbH~t+yDPx&Wx<4Lkq< delta 25 hcmcaJjqT1fwh0}~JF5;(?Dl2ad${q|)?18CT>zxI4B`L) diff --git a/build/test/out/test_timequiz.out b/build/test/out/test_timequiz.out index b13c3d41f883235328a8715bfef197297b4f6147..b5d13af389046f2ae7499af27a58f55274d4e18d 100644 GIT binary patch delta 1628 zcmZuxZA@EL7(VYk+}mCXEd|OLgHb+)n^szMAm9fxK{gy8L%__L1shss$2VN)vI^AIWyMu*)KnLjRpsnOUmEKWWhyZxG-T|0 z9AY$dIpJAANOgn`YM<$67ndeprW6rqAl&9~wlr8fD%^Ib%hB9~gt#z-H~=y=m9!&E znIjZ~Vyl}Ru8tzBqXBW9oT2>V>8Ig+k~v)h0_mLI#pwldaXOu6nsH=y`c)VvaWiuG z#hF?#kzoZ)%~;_&d2&|HRLs^wI=QZZ`?LFjkn}k@bAL9OlskFSJQoW(@_`b(I`=yC z6K-B+?3ph~7Da@F)=lTJdbT+yy#>$E>I~G-C-b&#U5sOO*4u5HB|1^0*hO>;*)ZUH zW#P~+2>34iv%nd`Yiy3XI+vr-P8-XOC49yqv_ejU$7%g+&Xg913r=H#+Suq{@!&q&L?*&X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OUJMC2?M zv>mt)iDe5CNh3_8LSrsNRg{2dyWfk3g=euMNlRmZr_k66L(O6tx>_TcB+W^Z1`+1? z@1^Pbc@23^PcI-2#szKZI85dKAZS;%h!hFvj9o5+Q8DuAT43apX0@9|EH-!u^$~iC zANYGps6+3=Cu@v8EHwSl){FSek-Sc}r!A13f7rlPO)>Vp-S7omH2|4?RVuNhGx z>&3ijs*7d4)E4uc{SA40R~ZG&L@u$e%9tB=t-)s0yV2TeB4iUmw_<%(;iXzfhz7lN z4TSnr#ek^R9wNj#c{TS8JD$;GgQ8T{Z_NQ+rCN7L?h(PQCdXS1gxEy1Xp1VK(+pko zLe~p)Nr|4)N zc7L5aNMJ=_CI4uo5H|5^BgGE!Ibp;D_w+@TJnwD@u5^BIcfJgs$d3{nvz~Jx3}nw1 zx1UHn_xyPN{9gspK?()7Q)9s`Wuy`{S1C)!Kg)51D)V!t1?oIC+U$T|Q$US)a^Nw1 zwdX)KzHCm&E>@culU(W2H1T5~#N1|P+114U$5Uc@^iY!lU(1jP)Tq}9>uiu7iOqtK zr|o;WgE1xV7E^E2hm;Oxp)*n1q}ORCV@H^M1G84L)X2U<7=W_K#@R3n8lx?yjqS)Zwh0}~X44N%?Dl1Pex>o&)?18OT>zW43~&Gd delta 25 hcmX>yjqS)Zwh0}~d#esk?Dl2K-O+e!>n+BtE&!c63_}0_ diff --git a/build/test/preprocess/files/test_timequiz.c b/build/test/preprocess/files/test_timequiz.c index 591ce84..37a3916 100644 --- a/build/test/preprocess/files/test_timequiz.c +++ b/build/test/preprocess/files/test_timequiz.c @@ -34,9 +34,9 @@ void test_getRandomQuestionIndex(void) { void test_displayQuestion(void) { - char* question = "Test Question"; + const char* question = "Test Question"; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; int correctIndex = 0; @@ -66,7 +66,7 @@ void test_processUserAnswer_correct(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; @@ -98,7 +98,7 @@ void test_processUserAnswer_wrong(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; @@ -128,7 +128,7 @@ void test_processUserAnswer_correctAnswer_index3(void) { int totalCorrectAnswers = 0; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; processUserAnswer(4, 3, &score, &totalCorrectAnswers, answers); @@ -154,7 +154,7 @@ void test_processUserAnswer_correctAnswer_index0(void) { int totalCorrectAnswers = 0; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; processUserAnswer(1, 0, &score, &totalCorrectAnswers, answers); @@ -180,7 +180,7 @@ void test_processUserAnswer_wrongAnswer_index3(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; @@ -210,7 +210,7 @@ void test_processUserAnswer_correctAnswer_index1(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 1; @@ -240,7 +240,7 @@ void test_processUserAnswer_correctAnswer_index2(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 2; @@ -270,7 +270,7 @@ void test_processUserAnswer_wrongAnswer_index1(void) { int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 2; diff --git a/build/test/results/test_casualQuiz.pass b/build/test/results/test_casualQuiz.pass index e81deb7..bdc3b0b 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: 1.3471671999996033 +:time: 0.014675799999167793 diff --git a/build/test/results/test_quizduell.pass b/build/test/results/test_quizduell.pass index b43957d..995a820 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: 1.0948776999994152 +:time: 0.014967400000386988 diff --git a/build/test/results/test_timequiz.pass b/build/test/results/test_timequiz.pass index f80cc93..3d0394f 100644 --- a/build/test/results/test_timequiz.pass +++ b/build/test/results/test_timequiz.pass @@ -74,4 +74,4 @@ - Correct! - Correct! - 'Wrong! The correct answer is: 3. Berlin' -:time: 0.9529290000009496 +:time: 0.8400412000009965 diff --git a/build/test/results/test_wwm.pass b/build/test/results/test_wwm.pass index 1036db0..2aeb34a 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.7791643000000477 +:time: 0.015467199998965953 diff --git a/src/timequiz.c b/src/timequiz.c index dfbdf00..64c9d9c 100644 --- a/src/timequiz.c +++ b/src/timequiz.c @@ -12,9 +12,9 @@ void timequiz(); int getRandomQuestionIndex(int askedQuestions[], int totalQuestions); -void displayQuestion(char* question, char* answers[], int correctIndex); +void displayQuestion(const char* question,const char* answers[], int correctIndex); -void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers, char* answers[]); +void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers,const char* answers[]); int isValidAnswer(int userAnswer); @@ -115,7 +115,7 @@ void timequiz() { for (int i = 0; i < sizeof(questions) / sizeof(questions[0]); i++) { int j = rand() % 4; - char* temp = answers[i][0]; + const char* temp = answers[i][0]; answers[i][0] = answers[i][j]; answers[i][j] = temp; @@ -181,14 +181,14 @@ int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { return questionIndex; } //Frage anzeigen -void displayQuestion(char* question, char* answers[], int correctIndex) { +void displayQuestion(const char* question,const char* answers[], int correctIndex) { printf("\nQuestion: %s\n", question); for (int i = 0; i < 4; i++) { printf("%d. %s\n", i + 1, answers[i]); } } //User-Eingabe Verarbeitung -void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers, char* answers[]) { +void processUserAnswer(int userAnswer, int correctIndex, int* score, int* totalCorrectAnswers,const char* answers[]) { if (userAnswer == correctIndex + 1) { printf("Correct!\n"); (*score)++; diff --git a/test/test_timequiz.c b/test/test_timequiz.c index 71cb2b1..1483093 100644 --- a/test/test_timequiz.c +++ b/test/test_timequiz.c @@ -17,8 +17,8 @@ void test_getRandomQuestionIndex(void) { } void test_displayQuestion(void) { - char* question = "Test Question"; - char* answers[] = {"A", "B", "C", "D"}; + const char* question = "Test Question"; + const char* answers[] = {"A", "B", "C", "D"}; int correctIndex = 0; printf("\nExpected Output:\n"); printf("Question: %s\n", question); @@ -33,7 +33,7 @@ void test_displayQuestion(void) { void test_processUserAnswer_correct(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; int userAnswer = 1; @@ -45,7 +45,7 @@ void test_processUserAnswer_correct(void) { void test_processUserAnswer_wrong(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; int userAnswer = 2; // Assuming user selects the second option processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers); @@ -56,7 +56,7 @@ void test_processUserAnswer_wrong(void) { void test_processUserAnswer_correctAnswer_index3(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; processUserAnswer(4, 3, &score, &totalCorrectAnswers, answers); TEST_ASSERT_EQUAL_INT(1, score); TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); @@ -65,7 +65,7 @@ void test_processUserAnswer_correctAnswer_index3(void) { void test_processUserAnswer_correctAnswer_index0(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"A", "B", "C", "D"}; + const char* answers[] = {"A", "B", "C", "D"}; processUserAnswer(1, 0, &score, &totalCorrectAnswers, answers); TEST_ASSERT_EQUAL_INT(1, score); TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); @@ -74,7 +74,7 @@ void test_processUserAnswer_correctAnswer_index0(void) { void test_processUserAnswer_wrongAnswer_index3(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 0; int userAnswer = 4; // Assuming user selects the fourth option processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers); @@ -85,7 +85,7 @@ void test_processUserAnswer_wrongAnswer_index3(void) { void test_processUserAnswer_correctAnswer_index1(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 1; int userAnswer = 2; // Assuming user selects the second option processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers); @@ -96,7 +96,7 @@ void test_processUserAnswer_correctAnswer_index1(void) { void test_processUserAnswer_correctAnswer_index2(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 2; int userAnswer = 3; // Assuming user selects the third option processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers); @@ -107,7 +107,7 @@ void test_processUserAnswer_correctAnswer_index2(void) { void test_processUserAnswer_wrongAnswer_index1(void) { int score = 0; int totalCorrectAnswers = 0; - char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + const char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; int correctIndex = 2; int userAnswer = 2; // Assuming user selects the second option processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers);