diff --git a/build/test/cache/test_factorial.c b/build/test/cache/test_factorial.c new file mode 100644 index 0000000..debbcbf --- /dev/null +++ b/build/test/cache/test_factorial.c @@ -0,0 +1,47 @@ +#include "src/main/c/Calculator/calculator.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_factorial_4(void){ + + + + double result; + + double a = 4; + + + + + + result = factorial(a); + + + + + + UnityAssertEqualNumber((UNITY_INT)((24)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/cache/test_pow.c b/build/test/cache/test_pow.c new file mode 100644 index 0000000..fe4db9b --- /dev/null +++ b/build/test/cache/test_pow.c @@ -0,0 +1,79 @@ +#include "build/temp/../../src/main/c/Calculator/calculator.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_pow_N_N(void){ + + + + double result; + + double b = 3; + + double a = 3; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((27)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + +} + + + +void test_pow_Z_N(void){ + + + + double result; + + double b = 3; + + double a = -3; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((-27)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(36), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/dependencies/test_factorial.d b/build/test/dependencies/test_factorial.d new file mode 100644 index 0000000..11420b1 --- /dev/null +++ b/build/test/dependencies/test_factorial.d @@ -0,0 +1,4 @@ +build/test/out/c/test_factorial.o: test/Calculator/test_factorial.c \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/main/c/Calculator/calculator.h diff --git a/build/test/dependencies/test_factorial_runner.d b/build/test/dependencies/test_factorial_runner.d new file mode 100644 index 0000000..961d380 --- /dev/null +++ b/build/test/dependencies/test_factorial_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_factorial_runner.o: \ + build/test/runners/test_factorial_runner.c \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/test_pow.d b/build/test/dependencies/test_pow.d new file mode 100644 index 0000000..d76ecae --- /dev/null +++ b/build/test/dependencies/test_pow.d @@ -0,0 +1,4 @@ +build/test/out/c/test_pow.o: test/Calculator/test_pow.c \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + test/Calculator/../../src/main/c/Calculator/calculator.h diff --git a/build/test/dependencies/test_pow_runner.d b/build/test/dependencies/test_pow_runner.d new file mode 100644 index 0000000..d2634ed --- /dev/null +++ b/build/test/dependencies/test_pow_runner.d @@ -0,0 +1,3 @@ +build/test/out/c/test_pow_runner.o: build/test/runners/test_pow_runner.c \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/out/c/test_factorial.o b/build/test/out/c/test_factorial.o new file mode 100644 index 0000000..ebb50e0 Binary files /dev/null and b/build/test/out/c/test_factorial.o differ diff --git a/build/test/out/c/test_factorial_runner.o b/build/test/out/c/test_factorial_runner.o new file mode 100644 index 0000000..121ea18 Binary files /dev/null and b/build/test/out/c/test_factorial_runner.o differ diff --git a/build/test/out/c/test_pow.o b/build/test/out/c/test_pow.o new file mode 100644 index 0000000..1a52535 Binary files /dev/null and b/build/test/out/c/test_pow.o differ diff --git a/build/test/out/c/test_pow_runner.o b/build/test/out/c/test_pow_runner.o new file mode 100644 index 0000000..7fec983 Binary files /dev/null and b/build/test/out/c/test_pow_runner.o differ diff --git a/build/test/out/test_factorial.out b/build/test/out/test_factorial.out new file mode 100755 index 0000000..b7a6cec Binary files /dev/null and b/build/test/out/test_factorial.out differ diff --git a/build/test/out/test_pow.out b/build/test/out/test_pow.out new file mode 100755 index 0000000..1572d74 Binary files /dev/null and b/build/test/out/test_pow.out differ diff --git a/build/test/preprocess/files/test_factorial.c b/build/test/preprocess/files/test_factorial.c new file mode 100644 index 0000000..debbcbf --- /dev/null +++ b/build/test/preprocess/files/test_factorial.c @@ -0,0 +1,47 @@ +#include "src/main/c/Calculator/calculator.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_factorial_4(void){ + + + + double result; + + double a = 4; + + + + + + result = factorial(a); + + + + + + UnityAssertEqualNumber((UNITY_INT)((24)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/files/test_pow.c b/build/test/preprocess/files/test_pow.c new file mode 100644 index 0000000..fe4db9b --- /dev/null +++ b/build/test/preprocess/files/test_pow.c @@ -0,0 +1,79 @@ +#include "build/temp/../../src/main/c/Calculator/calculator.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_pow_N_N(void){ + + + + double result; + + double b = 3; + + double a = 3; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((27)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + +} + + + +void test_pow_Z_N(void){ + + + + double result; + + double b = 3; + + double a = -3; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((-27)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(36), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/includes/test_factorial.c b/build/test/preprocess/includes/test_factorial.c new file mode 100644 index 0000000..f2efae7 --- /dev/null +++ b/build/test/preprocess/includes/test_factorial.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- src/main/c/Calculator/calculator.h diff --git a/build/test/preprocess/includes/test_pow.c b/build/test/preprocess/includes/test_pow.c new file mode 100644 index 0000000..26256f2 --- /dev/null +++ b/build/test/preprocess/includes/test_pow.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- build/temp/../../src/main/c/Calculator/calculator.h diff --git a/build/test/results/test_factorial.pass b/build/test/results/test_factorial.pass new file mode 100644 index 0000000..ede2338 --- /dev/null +++ b/build/test/results/test_factorial.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Calculator + :file: test_factorial.c +:successes: +- :test: test_factorial_4 + :line: 13 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.0060175769904162735 diff --git a/build/test/results/test_pow.pass b/build/test/results/test_pow.pass new file mode 100644 index 0000000..d103a0d --- /dev/null +++ b/build/test/results/test_pow.pass @@ -0,0 +1,22 @@ +--- +:source: + :path: test/Calculator + :file: test_pow.c +:successes: +- :test: test_pow_N_N + :line: 13 + :message: '' + :unity_test_time: 0 +- :test: test_pow_Z_N + :line: 26 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 2 + :passed: 2 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.0062921050121076405 diff --git a/build/test/results/test_template.pass b/build/test/results/test_template.pass index 493caaa..28bc252 100644 --- a/build/test/results/test_template.pass +++ b/build/test/results/test_template.pass @@ -19,4 +19,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.004427945998031646 +:time: 0.002953332004835829 diff --git a/build/test/runners/test_factorial_runner.c b/build/test/runners/test_factorial_runner.c new file mode 100644 index 0000000..3e02547 --- /dev/null +++ b/build/test/runners/test_factorial_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_factorial_4(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_factorial.c"); + run_test(test_factorial_4, "test_factorial_4", 13); + + return UnityEnd(); +} diff --git a/build/test/runners/test_pow_runner.c b/build/test/runners/test_pow_runner.c new file mode 100644 index 0000000..83a9119 --- /dev/null +++ b/build/test/runners/test_pow_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_pow_N_N(void); +extern void test_pow_Z_N(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_pow.c"); + run_test(test_pow_N_N, "test_pow_N_N", 13); + run_test(test_pow_Z_N, "test_pow_Z_N", 26); + + return UnityEnd(); +} diff --git a/test/Calculator/test_factorial.c b/test/Calculator/test_factorial.c new file mode 100644 index 0000000..28814dc --- /dev/null +++ b/test/Calculator/test_factorial.c @@ -0,0 +1,25 @@ +#ifdef TEST +#include "unity.h" +#include "calculator.h" + + +void setUp(void){ + //Wenn Funktion Vorraussetzungen braucht +} +void tearDown(void){ +} + + +void test_factorial_4(void){ + /* arrange */ + double result; + double a = 4; + + /* act */ + result = factorial(a); + + /* assert */ + TEST_ASSERT_EQUAL_INT(24, result);//1 * 2 * 3 * 4 = 24 +} + +#endif diff --git a/test/Calculator/test_add.c b/test/Calculator/test_pow.c similarity index 100% rename from test/Calculator/test_add.c rename to test/Calculator/test_pow.c