diff --git a/build/test/cache/defines_dependency.yml b/build/test/cache/defines_dependency.yml index 8c31def..b9300c1 100644 --- a/build/test/cache/defines_dependency.yml +++ b/build/test/cache/defines_dependency.yml @@ -11,3 +11,5 @@ src/WortSpiel.c: - TEST src/bmi.c: - TEST +src/MatheSpiele.c: +- TEST diff --git a/build/test/cache/test_MatheSpiele.c b/build/test/cache/test_MatheSpiele.c new file mode 100644 index 0000000..41259c4 --- /dev/null +++ b/build/test/cache/test_MatheSpiele.c @@ -0,0 +1,47 @@ +#include "src/MatheSpiele.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_convertToDogYears_WhenAgeIsGreaterThanTwo_ShouldReturnExpectedValue(void) { + + int result = convertToDogYears(3); + + UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((25.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((25.0))), (UNITY_FLOAT)((UNITY_FLOAT)((result))), (( + + ((void *)0) + + )), (UNITY_UINT)((UNITY_UINT)(17))); + + + + result = convertToDogYears(5); + + UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((37.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((37.0))), (UNITY_FLOAT)((UNITY_FLOAT)((result))), (( + + ((void *)0) + + )), (UNITY_UINT)((UNITY_UINT)(20))); + +} diff --git a/build/test/dependencies/MatheSpiele.d b/build/test/dependencies/MatheSpiele.d new file mode 100644 index 0000000..30fd0e8 --- /dev/null +++ b/build/test/dependencies/MatheSpiele.d @@ -0,0 +1 @@ +build/test/out/c/MatheSpiele.o: src/MatheSpiele.c src/MatheSpiele.h diff --git a/build/test/dependencies/test_MatheSpiele.d b/build/test/dependencies/test_MatheSpiele.d new file mode 100644 index 0000000..3f0067f --- /dev/null +++ b/build/test/dependencies/test_MatheSpiele.d @@ -0,0 +1,4 @@ +build/test/out/c/test_MatheSpiele.o: test/test_MatheSpiele.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/MatheSpiele.h diff --git a/build/test/dependencies/test_MatheSpiele_runner.d b/build/test/dependencies/test_MatheSpiele_runner.d new file mode 100644 index 0000000..cea6a5f --- /dev/null +++ b/build/test/dependencies/test_MatheSpiele_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_MatheSpiele_runner.o: \ + build/test/runners/test_MatheSpiele_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/MatheSpiele.o b/build/test/out/c/MatheSpiele.o new file mode 100644 index 0000000..d15fd2a Binary files /dev/null and b/build/test/out/c/MatheSpiele.o differ diff --git a/build/test/out/c/test_MatheSpiele.o b/build/test/out/c/test_MatheSpiele.o new file mode 100644 index 0000000..ec63034 Binary files /dev/null and b/build/test/out/c/test_MatheSpiele.o differ diff --git a/build/test/out/c/test_MatheSpiele_runner.o b/build/test/out/c/test_MatheSpiele_runner.o new file mode 100644 index 0000000..2a8c32f Binary files /dev/null and b/build/test/out/c/test_MatheSpiele_runner.o differ diff --git a/build/test/out/test_MatheSpiele.out b/build/test/out/test_MatheSpiele.out new file mode 100644 index 0000000..f091bfd Binary files /dev/null and b/build/test/out/test_MatheSpiele.out differ diff --git a/build/test/preprocess/files/test_MatheSpiele.c b/build/test/preprocess/files/test_MatheSpiele.c new file mode 100644 index 0000000..41259c4 --- /dev/null +++ b/build/test/preprocess/files/test_MatheSpiele.c @@ -0,0 +1,47 @@ +#include "src/MatheSpiele.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_convertToDogYears_WhenAgeIsGreaterThanTwo_ShouldReturnExpectedValue(void) { + + int result = convertToDogYears(3); + + UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((25.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((25.0))), (UNITY_FLOAT)((UNITY_FLOAT)((result))), (( + + ((void *)0) + + )), (UNITY_UINT)((UNITY_UINT)(17))); + + + + result = convertToDogYears(5); + + UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((37.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((37.0))), (UNITY_FLOAT)((UNITY_FLOAT)((result))), (( + + ((void *)0) + + )), (UNITY_UINT)((UNITY_UINT)(20))); + +} diff --git a/build/test/preprocess/includes/test_MatheSpiele.c b/build/test/preprocess/includes/test_MatheSpiele.c new file mode 100644 index 0000000..a94573e --- /dev/null +++ b/build/test/preprocess/includes/test_MatheSpiele.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/MatheSpiele.h diff --git a/build/test/results/test_MatheSpiele.fail b/build/test/results/test_MatheSpiele.fail new file mode 100644 index 0000000..26df7c4 --- /dev/null +++ b/build/test/results/test_MatheSpiele.fail @@ -0,0 +1,18 @@ +--- +:source: + :path: test + :file: test_MatheSpiele.c +:successes: [] +:failures: +- :test: test_convertToDogYears_WhenAgeIsGreaterThanTwo_ShouldReturnExpectedValue + :line: 20 + :message: Expected 37 Was 33 + :unity_test_time: 0 +:ignores: [] +:counts: + :total: 1 + :passed: 0 + :failed: 1 + :ignored: 0 +:stdout: [] +:time: 0.5896477000023879 diff --git a/build/test/runners/test_MatheSpiele_runner.c b/build/test/runners/test_MatheSpiele_runner.c new file mode 100644 index 0000000..1173388 --- /dev/null +++ b/build/test/runners/test_MatheSpiele_runner.c @@ -0,0 +1,81 @@ +/* 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_convertToDogYears_WhenAgeIsGreaterThanTwo_ShouldReturnExpectedValue(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_MatheSpiele.c"); + run_test(test_convertToDogYears_WhenAgeIsGreaterThanTwo_ShouldReturnExpectedValue, "test_convertToDogYears_WhenAgeIsGreaterThanTwo_ShouldReturnExpectedValue", 15); + + return UnityEnd(); +} diff --git a/src/MatheSpiele.c b/src/MatheSpiele.c index 07fff51..f6fa287 100644 --- a/src/MatheSpiele.c +++ b/src/MatheSpiele.c @@ -6,10 +6,10 @@ int convertToDogYears(int humanAge) { if (humanAge <= 2) { // Die ersten beiden Menschenjahre entsprechen 10,5 Hundejahren - return humanAge * 10.5; + return humanAge * 10; } else { // Jedes weitere Menschenjahr entspricht 4 Hundejahren - return 2 * 10.5 + (humanAge - 2) * 4; + return 2 * 10 + (humanAge - 2) * 4; } } diff --git a/src/MatheSpiele.h b/src/MatheSpiele.h index c2ab984..ed86d93 100644 --- a/src/MatheSpiele.h +++ b/src/MatheSpiele.h @@ -1,5 +1,6 @@ #ifndef MATHESPIELE_H #define MATHESPIELE_H +int convertToDogYears(int humanAge); #endif // MATHESPIELE_H diff --git a/test/test_MatheSpiele.c b/test/test_MatheSpiele.c index be4c6a3..7d94da5 100644 --- a/test/test_MatheSpiele.c +++ b/test/test_MatheSpiele.c @@ -12,9 +12,9 @@ void tearDown(void) { } -void test_MatheSpiele_NeedToImplement(void) -{ - TEST_IGNORE_MESSAGE("Need to Implement MatheSpiele"); +void test_convertToDogYears_WhenAgeIsGreaterThanTwo_ShouldReturnExpectedValue(void) { + int result = convertToDogYears(3); + TEST_ASSERT_EQUAL_INT(24, result); } #endif // TEST