diff --git a/build/test/cache/defines_dependency.yml b/build/test/cache/defines_dependency.yml index d7ae090..8c31def 100644 --- a/build/test/cache/defines_dependency.yml +++ b/build/test/cache/defines_dependency.yml @@ -9,3 +9,5 @@ src/SchereSteinPapier.c: - TEST src/WortSpiel.c: - TEST +src/bmi.c: +- TEST diff --git a/build/test/cache/test_bmi.c b/build/test/cache/test_bmi.c new file mode 100644 index 0000000..7b4baff --- /dev/null +++ b/build/test/cache/test_bmi.c @@ -0,0 +1,59 @@ +#include "src/bmi.h" +#include "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +void setUp(void) + +{ + +} + + + +void tearDown(void) + +{ + +} + + + +void test_berechnung_BMI(void) + +{ + +float result = calcBMI(2, 100); + +float expected = 25; + +UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), ( + +((void *)0) + +), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_INT); + +} + + + +void test_ausgabe_ergebnis(void) + +{ + +const char *result = retResult(25); + +char expected[] = "Normalgewicht"; + +UnityAssertEqualString((const char*)((expected)), (const char*)((result)), ( + +((void *)0) + +), (UNITY_UINT)(26)); + +} diff --git a/build/test/dependencies/bmi.d b/build/test/dependencies/bmi.d new file mode 100644 index 0000000..80d9078 --- /dev/null +++ b/build/test/dependencies/bmi.d @@ -0,0 +1 @@ +build/test/out/c/bmi.o: src/bmi.c src/bmi.h diff --git a/build/test/dependencies/test_bmi.d b/build/test/dependencies/test_bmi.d new file mode 100644 index 0000000..9d3326f --- /dev/null +++ b/build/test/dependencies/test_bmi.d @@ -0,0 +1,4 @@ +build/test/out/c/test_bmi.o: test/test_bmi.c \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/bmi.h diff --git a/build/test/dependencies/test_bmi_runner.d b/build/test/dependencies/test_bmi_runner.d new file mode 100644 index 0000000..ccaa851 --- /dev/null +++ b/build/test/dependencies/test_bmi_runner.d @@ -0,0 +1,3 @@ +build/test/out/c/test_bmi_runner.o: build/test/runners/test_bmi_runner.c \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/out/c/WortSpiel.o b/build/test/out/c/WortSpiel.o index 77fbdcf..6775c8f 100644 Binary files a/build/test/out/c/WortSpiel.o and b/build/test/out/c/WortSpiel.o differ diff --git a/build/test/out/c/bmi.o b/build/test/out/c/bmi.o new file mode 100644 index 0000000..747edf2 Binary files /dev/null and b/build/test/out/c/bmi.o differ diff --git a/build/test/out/c/test_bmi.o b/build/test/out/c/test_bmi.o new file mode 100644 index 0000000..562389c Binary files /dev/null and b/build/test/out/c/test_bmi.o differ diff --git a/build/test/out/c/test_bmi_runner.o b/build/test/out/c/test_bmi_runner.o new file mode 100644 index 0000000..21d207e Binary files /dev/null and b/build/test/out/c/test_bmi_runner.o differ diff --git a/build/test/out/test_WortSpiel.out b/build/test/out/test_WortSpiel.out index 9975f14..46f9f99 100644 Binary files a/build/test/out/test_WortSpiel.out and b/build/test/out/test_WortSpiel.out differ diff --git a/build/test/out/test_bmi.out b/build/test/out/test_bmi.out new file mode 100644 index 0000000..8264ae6 Binary files /dev/null and b/build/test/out/test_bmi.out differ diff --git a/build/test/preprocess/files/test_bmi.c b/build/test/preprocess/files/test_bmi.c new file mode 100644 index 0000000..7b4baff --- /dev/null +++ b/build/test/preprocess/files/test_bmi.c @@ -0,0 +1,59 @@ +#include "src/bmi.h" +#include "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +void setUp(void) + +{ + +} + + + +void tearDown(void) + +{ + +} + + + +void test_berechnung_BMI(void) + +{ + +float result = calcBMI(2, 100); + +float expected = 25; + +UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), ( + +((void *)0) + +), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_INT); + +} + + + +void test_ausgabe_ergebnis(void) + +{ + +const char *result = retResult(25); + +char expected[] = "Normalgewicht"; + +UnityAssertEqualString((const char*)((expected)), (const char*)((result)), ( + +((void *)0) + +), (UNITY_UINT)(26)); + +} diff --git a/build/test/preprocess/includes/test_bmi.c b/build/test/preprocess/includes/test_bmi.c new file mode 100644 index 0000000..495072d --- /dev/null +++ b/build/test/preprocess/includes/test_bmi.c @@ -0,0 +1,3 @@ +--- +- C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h +- src/bmi.h diff --git a/build/test/results/test_SchereSteinPapier.pass b/build/test/results/test_SchereSteinPapier.pass index 2e37765..b746d06 100644 --- a/build/test/results/test_SchereSteinPapier.pass +++ b/build/test/results/test_SchereSteinPapier.pass @@ -19,4 +19,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.04579279999961727 +:time: 0.05505930000072112 diff --git a/build/test/results/test_WortSpiel.pass b/build/test/results/test_WortSpiel.pass index 8af2c88..4b784b9 100644 --- a/build/test/results/test_WortSpiel.pass +++ b/build/test/results/test_WortSpiel.pass @@ -59,4 +59,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.8378995999992185 +:time: 0.5986981999994896 diff --git a/build/test/results/test_ageinseconds.pass b/build/test/results/test_ageinseconds.pass index 601e23f..06ea858 100644 --- a/build/test/results/test_ageinseconds.pass +++ b/build/test/results/test_ageinseconds.pass @@ -23,4 +23,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.04312009999921429 +:time: 0.050159799997345544 diff --git a/build/test/results/test_bmi.pass b/build/test/results/test_bmi.pass new file mode 100644 index 0000000..d418c1f --- /dev/null +++ b/build/test/results/test_bmi.pass @@ -0,0 +1,22 @@ +--- +:source: + :path: test + :file: test_bmi.c +:successes: +- :test: test_berechnung_BMI + :line: 15 + :message: '' + :unity_test_time: 0 +- :test: test_ausgabe_ergebnis + :line: 22 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 2 + :passed: 2 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.3213505999992776 diff --git a/build/test/results/test_minirechner.pass b/build/test/results/test_minirechner.pass index dc1f5bc..6081f80 100644 --- a/build/test/results/test_minirechner.pass +++ b/build/test/results/test_minirechner.pass @@ -83,4 +83,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.04265739999937068 +:time: 0.049012799998308765 diff --git a/build/test/results/test_zahlenraten.pass b/build/test/results/test_zahlenraten.pass index bd03a75..175080b 100644 --- a/build/test/results/test_zahlenraten.pass +++ b/build/test/results/test_zahlenraten.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0429972000001726 +:time: 0.04845479999858071 diff --git a/build/test/runners/test_bmi_runner.c b/build/test/runners/test_bmi_runner.c new file mode 100644 index 0000000..57947ef --- /dev/null +++ b/build/test/runners/test_bmi_runner.c @@ -0,0 +1,83 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +/*=======Automagically Detected Files To Include=====*/ +#include "unity.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +/*=======External Functions This Runner Calls=====*/ +extern void setUp(void); +extern void tearDown(void); +extern void test_berechnung_BMI(void); +extern void test_ausgabe_ergebnis(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} + +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + +/*=======MAIN=====*/ +int main(void) +{ + UnityBegin("test_bmi.c"); + run_test(test_berechnung_BMI, "test_berechnung_BMI", 15); + run_test(test_ausgabe_ergebnis, "test_ausgabe_ergebnis", 22); + + return UnityEnd(); +} diff --git a/src/menue.c b/src/menue.c index c2e0b10..913e885 100644 --- a/src/menue.c +++ b/src/menue.c @@ -6,6 +6,7 @@ int run_magiceightball(); void run_zahlenraten(); int run_scheresteinpapier(); int run_bmi(); +int run_wortspiel(); void trenner () { // Die laenge der Abtrenner kann hier fuer alle 3 angepasst werden @@ -18,7 +19,7 @@ int main() { while (eingabe != 0) { trenner(); - printf("\nWelches Programm wollen Sie starten?\n<1> Minirechner \n<2> AlterinSekunden\n<3> MagicEightBall\n<4> Zahlenraten\n<5> SchereSteinPapier\n<6> BMI-Rechner\nZum Abbrechen 0 eingeben.\n"); + printf("\nWelches Programm wollen Sie starten?\n<1> Minirechner \n<2> AlterinSekunden\n<3> MagicEightBall\n<4> Zahlenraten\n<5> SchereSteinPapier\n<6> BMI-Rechner\n<7> Wortspiel\nZum Abbrechen 0 eingeben.\n"); trenner(); printf("\nEingabe: "); scanf("%d", &eingabe); @@ -53,6 +54,10 @@ int main() { case 6: run_bmi(); + case 7; + run_wortspiel(); + break; + default: printf("Bitte verwenden sie eine der gegebenen Ziffern"); }