diff --git a/build/test/cache/test_ceil.c b/build/test/cache/test_ceil.c new file mode 100644 index 0000000..2fb1b1c --- /dev/null +++ b/build/test/cache/test_ceil.c @@ -0,0 +1,49 @@ +#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_ceil(void){ + + + +int result; + +double a =2.34; + + + + + + + +result = ceil(a); + + + + + +UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( + +((void *)0) + +), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/cache/test_exp.c b/build/test/cache/test_exp.c new file mode 100644 index 0000000..9186a3b --- /dev/null +++ b/build/test/cache/test_exp.c @@ -0,0 +1,35 @@ +#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 test_exp(void) { + + + + double result; + + double a =1; + + double exponent = exp(a); + + + + result = exponent; + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(16), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/cache/test_sin.c b/build/test/cache/test_sin.c new file mode 100644 index 0000000..7e09eae --- /dev/null +++ b/build/test/cache/test_sin.c @@ -0,0 +1,53 @@ +#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_sin(void){ + + + + double num1=20; + + double result; + + double sine = num1 * + + 3.14159265358979323846 + + /180.0; + + + + + + result = sine; + + + + + + UnityAssertEqualNumber((UNITY_INT)((0.34)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + + } diff --git a/build/test/dependencies/test_ceil.d b/build/test/dependencies/test_ceil.d new file mode 100644 index 0000000..6f1cf77 --- /dev/null +++ b/build/test/dependencies/test_ceil.d @@ -0,0 +1,4 @@ +build/test/out/c/test_ceil.o: test/Calculator/test_ceil.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_ceil_runner.d b/build/test/dependencies/test_ceil_runner.d new file mode 100644 index 0000000..f737952 --- /dev/null +++ b/build/test/dependencies/test_ceil_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_ceil_runner.o: \ + build/test/runners/test_ceil_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_exp.d b/build/test/dependencies/test_exp.d new file mode 100644 index 0000000..f128702 --- /dev/null +++ b/build/test/dependencies/test_exp.d @@ -0,0 +1,4 @@ +build/test/out/c/test_exp.o: test/Calculator/test_exp.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_exp_runner.d b/build/test/dependencies/test_exp_runner.d new file mode 100644 index 0000000..b2a46b6 --- /dev/null +++ b/build/test/dependencies/test_exp_runner.d @@ -0,0 +1,3 @@ +build/test/out/c/test_exp_runner.o: build/test/runners/test_exp_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_sin.d b/build/test/dependencies/test_sin.d new file mode 100644 index 0000000..274ce9c --- /dev/null +++ b/build/test/dependencies/test_sin.d @@ -0,0 +1,4 @@ +build/test/out/c/test_sin.o: test/Calculator/test_sin.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_sin_runner.d b/build/test/dependencies/test_sin_runner.d new file mode 100644 index 0000000..e4b2277 --- /dev/null +++ b/build/test/dependencies/test_sin_runner.d @@ -0,0 +1,3 @@ +build/test/out/c/test_sin_runner.o: build/test/runners/test_sin_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/calculator.o b/build/test/out/c/calculator.o index e40528b..09d576e 100644 Binary files a/build/test/out/c/calculator.o and b/build/test/out/c/calculator.o differ diff --git a/build/test/out/c/test_ceil.o b/build/test/out/c/test_ceil.o new file mode 100644 index 0000000..09b405f Binary files /dev/null and b/build/test/out/c/test_ceil.o differ diff --git a/build/test/out/c/test_ceil_runner.o b/build/test/out/c/test_ceil_runner.o new file mode 100644 index 0000000..d3794fe Binary files /dev/null and b/build/test/out/c/test_ceil_runner.o differ diff --git a/build/test/out/c/test_exp.o b/build/test/out/c/test_exp.o new file mode 100644 index 0000000..9901d7c Binary files /dev/null and b/build/test/out/c/test_exp.o differ diff --git a/build/test/out/c/test_exp_runner.o b/build/test/out/c/test_exp_runner.o new file mode 100644 index 0000000..aba7074 Binary files /dev/null and b/build/test/out/c/test_exp_runner.o differ diff --git a/build/test/out/c/test_sin.o b/build/test/out/c/test_sin.o new file mode 100644 index 0000000..68b0f29 Binary files /dev/null and b/build/test/out/c/test_sin.o differ diff --git a/build/test/out/c/test_sin_runner.o b/build/test/out/c/test_sin_runner.o new file mode 100644 index 0000000..4a08535 Binary files /dev/null and b/build/test/out/c/test_sin_runner.o differ diff --git a/build/test/out/test_cbrt.out b/build/test/out/test_cbrt.out index 80f91dc..fbd0b0f 100755 Binary files a/build/test/out/test_cbrt.out and b/build/test/out/test_cbrt.out differ diff --git a/build/test/out/test_ceil.out b/build/test/out/test_ceil.out new file mode 100755 index 0000000..5eeb363 Binary files /dev/null and b/build/test/out/test_ceil.out differ diff --git a/build/test/out/test_divide.out b/build/test/out/test_divide.out index 74178ad..3de8cac 100755 Binary files a/build/test/out/test_divide.out and b/build/test/out/test_divide.out differ diff --git a/build/test/out/test_exp.out b/build/test/out/test_exp.out new file mode 100755 index 0000000..7d815b7 Binary files /dev/null and b/build/test/out/test_exp.out differ diff --git a/build/test/out/test_factorial.out b/build/test/out/test_factorial.out index 38854ff..c6ce908 100755 Binary files a/build/test/out/test_factorial.out and b/build/test/out/test_factorial.out differ diff --git a/build/test/out/test_log.out b/build/test/out/test_log.out index 5f870cf..03e1bb1 100755 Binary files a/build/test/out/test_log.out and b/build/test/out/test_log.out differ diff --git a/build/test/out/test_mod.out b/build/test/out/test_mod.out index cb79470..992a86e 100755 Binary files a/build/test/out/test_mod.out and b/build/test/out/test_mod.out differ diff --git a/build/test/out/test_pow.out b/build/test/out/test_pow.out index c0c356f..77f31bc 100755 Binary files a/build/test/out/test_pow.out and b/build/test/out/test_pow.out differ diff --git a/build/test/out/test_sin.out b/build/test/out/test_sin.out new file mode 100755 index 0000000..d2ad1e5 Binary files /dev/null and b/build/test/out/test_sin.out differ diff --git a/build/test/out/test_sqrt.out b/build/test/out/test_sqrt.out index b0ea718..48f9445 100755 Binary files a/build/test/out/test_sqrt.out and b/build/test/out/test_sqrt.out differ diff --git a/build/test/out/test_subtract.out b/build/test/out/test_subtract.out index b88257c..6ecef9f 100755 Binary files a/build/test/out/test_subtract.out and b/build/test/out/test_subtract.out differ diff --git a/build/test/preprocess/files/test_ceil.c b/build/test/preprocess/files/test_ceil.c new file mode 100644 index 0000000..2fb1b1c --- /dev/null +++ b/build/test/preprocess/files/test_ceil.c @@ -0,0 +1,49 @@ +#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_ceil(void){ + + + +int result; + +double a =2.34; + + + + + + + +result = ceil(a); + + + + + +UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( + +((void *)0) + +), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/files/test_exp.c b/build/test/preprocess/files/test_exp.c new file mode 100644 index 0000000..9186a3b --- /dev/null +++ b/build/test/preprocess/files/test_exp.c @@ -0,0 +1,35 @@ +#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 test_exp(void) { + + + + double result; + + double a =1; + + double exponent = exp(a); + + + + result = exponent; + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(16), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/files/test_sin.c b/build/test/preprocess/files/test_sin.c new file mode 100644 index 0000000..7e09eae --- /dev/null +++ b/build/test/preprocess/files/test_sin.c @@ -0,0 +1,53 @@ +#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_sin(void){ + + + + double num1=20; + + double result; + + double sine = num1 * + + 3.14159265358979323846 + + /180.0; + + + + + + result = sine; + + + + + + UnityAssertEqualNumber((UNITY_INT)((0.34)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + + } diff --git a/build/test/preprocess/includes/test_ceil.c b/build/test/preprocess/includes/test_ceil.c new file mode 100644 index 0000000..f2efae7 --- /dev/null +++ b/build/test/preprocess/includes/test_ceil.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_exp.c b/build/test/preprocess/includes/test_exp.c new file mode 100644 index 0000000..f2efae7 --- /dev/null +++ b/build/test/preprocess/includes/test_exp.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_sin.c b/build/test/preprocess/includes/test_sin.c new file mode 100644 index 0000000..f2efae7 --- /dev/null +++ b/build/test/preprocess/includes/test_sin.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/results/test_add.pass b/build/test/results/test_add.pass index 183d0f1..2bafd71 100644 --- a/build/test/results/test_add.pass +++ b/build/test/results/test_add.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.001341750001301989 +:time: 0.004256184998666868 diff --git a/build/test/results/test_cbrt.pass b/build/test/results/test_cbrt.pass index 3cdfbbf..d241b05 100644 --- a/build/test/results/test_cbrt.pass +++ b/build/test/results/test_cbrt.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.003224601998226717 +:time: 0.004384817002573982 diff --git a/build/test/results/test_ceil.pass b/build/test/results/test_ceil.pass new file mode 100644 index 0000000..def1a80 --- /dev/null +++ b/build/test/results/test_ceil.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Calculator + :file: test_ceil.c +:successes: +- :test: test_ceil + :line: 13 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.004406218999065459 diff --git a/build/test/results/test_divide.pass b/build/test/results/test_divide.pass index 572c1f8..98aea0f 100644 --- a/build/test/results/test_divide.pass +++ b/build/test/results/test_divide.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0032165549928322434 +:time: 0.004329051997046918 diff --git a/build/test/results/test_exp.pass b/build/test/results/test_exp.pass new file mode 100644 index 0000000..9a0e272 --- /dev/null +++ b/build/test/results/test_exp.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Calculator + :file: test_exp.c +:successes: +- :test: test_exp + :line: 8 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.006756123999366537 diff --git a/build/test/results/test_factorial.pass b/build/test/results/test_factorial.pass index f83a2cc..890eaea 100644 --- a/build/test/results/test_factorial.pass +++ b/build/test/results/test_factorial.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0032816580205690116 +:time: 0.0043980109912808985 diff --git a/build/test/results/test_log.pass b/build/test/results/test_log.pass index 43a709b..1553735 100644 --- a/build/test/results/test_log.pass +++ b/build/test/results/test_log.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.003215620992705226 +:time: 0.0046040110173635185 diff --git a/build/test/results/test_mod.pass b/build/test/results/test_mod.pass index 3fc4e25..4f7bac4 100644 --- a/build/test/results/test_mod.pass +++ b/build/test/results/test_mod.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.003226413013180718 +:time: 0.004433333990164101 diff --git a/build/test/results/test_multiply.pass b/build/test/results/test_multiply.pass index ba83e9d..20f23b1 100644 --- a/build/test/results/test_multiply.pass +++ b/build/test/results/test_multiply.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.00324131001252681 +:time: 0.004367012996226549 diff --git a/build/test/results/test_pow.pass b/build/test/results/test_pow.pass index ece0fb8..15cce76 100644 --- a/build/test/results/test_pow.pass +++ b/build/test/results/test_pow.pass @@ -19,4 +19,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0032054850016720593 +:time: 0.004291344986995682 diff --git a/build/test/results/test_sin.pass b/build/test/results/test_sin.pass new file mode 100644 index 0000000..da55b6d --- /dev/null +++ b/build/test/results/test_sin.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Calculator + :file: test_sin.c +:successes: +- :test: test_sin + :line: 13 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.004392857023049146 diff --git a/build/test/results/test_sqrt.pass b/build/test/results/test_sqrt.pass index ba299e8..804498f 100644 --- a/build/test/results/test_sqrt.pass +++ b/build/test/results/test_sqrt.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0031778719858266413 +:time: 0.004461465985514224 diff --git a/build/test/results/test_subtract.pass b/build/test/results/test_subtract.pass index b972628..15d7a16 100644 --- a/build/test/results/test_subtract.pass +++ b/build/test/results/test_subtract.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.006584955001017079 +:time: 0.004360714985523373 diff --git a/build/test/runners/test_ceil_runner.c b/build/test/runners/test_ceil_runner.c new file mode 100644 index 0000000..6a321fe --- /dev/null +++ b/build/test/runners/test_ceil_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_ceil(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_ceil.c"); + run_test(test_ceil, "test_ceil", 13); + + return UnityEnd(); +} diff --git a/build/test/runners/test_exp_runner.c b/build/test/runners/test_exp_runner.c new file mode 100644 index 0000000..53b2381 --- /dev/null +++ b/build/test/runners/test_exp_runner.c @@ -0,0 +1,87 @@ +/* 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_exp(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Setup (stub)=====*/ +void setUp(void) {} + +/*=======Teardown (stub)=====*/ +void tearDown(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_exp.c"); + run_test(test_exp, "test_exp", 8); + + return UnityEnd(); +} diff --git a/build/test/runners/test_sin_runner.c b/build/test/runners/test_sin_runner.c new file mode 100644 index 0000000..5c33ed1 --- /dev/null +++ b/build/test/runners/test_sin_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_sin(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_sin.c"); + run_test(test_sin, "test_sin", 13); + + return UnityEnd(); +} diff --git a/src/main/c/Calculator/calculator.c b/src/main/c/Calculator/calculator.c index 5be62fa..39a7999 100644 --- a/src/main/c/Calculator/calculator.c +++ b/src/main/c/Calculator/calculator.c @@ -13,13 +13,16 @@ double permutation(int n, int r); double combination(int n, int r); double pow(double num1, double num2); int mod(int num1,int num2); -double log(num1); +double log(double num1); double sqrt(double num1); -double cbrt(num1); +double cbrt(double num1); int multiply (int num1,int num2); double divide (double num1, double num2); int add (int num1, int num2); int subtract(int num1, int num2); +double exp(double num1); +double ceil(double num1); + int calculator() { int choice; @@ -79,7 +82,10 @@ int subtract(int num1, int num2); printf("17. Tangent\n"); printf("18. Permutation\n"); printf("19. Combination\n"); - printf("20. Exit\n"); + printf("20. Ceil\n"); + printf("21. Exponent\n"); +// + printf("21. Exit\n"); } double performOperation(int choice, double num1, double num2) { switch (choice) { @@ -122,6 +128,10 @@ int subtract(int num1, int num2); return permutation((int)num1, (int)num2); case 19: return combination((int)num1, (int)num2); + case 20: + return 0; ceil(num1); + case 21: + return 0; exp(num1); default: return 0.0; } @@ -197,3 +207,11 @@ int subtract(int num1, int num2){ int subtraction = num1 - num2; return subtraction; } +double exp(double num1){ + double result = num1; + return result; +} +double ceil(double num1){ + double result = num1; + return result; +} diff --git a/src/main/c/Calculator/calculator.h b/src/main/c/Calculator/calculator.h index 9e34df5..9ce5ddb 100644 --- a/src/main/c/Calculator/calculator.h +++ b/src/main/c/Calculator/calculator.h @@ -12,4 +12,6 @@ int multiply(int num1,int num2); double divide(double num1,double num2); int add(int num1 ,int num2); int subtract(int num1, int num2); +double exp(double num1); +double ceil(double num1); #endif diff --git a/test/Calculator/test_ceil.c b/test/Calculator/test_ceil.c new file mode 100644 index 0000000..1c90c96 --- /dev/null +++ b/test/Calculator/test_ceil.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_ceil(void){ + /* arrange */ +int result; +double a =2.34; + + + /* act */ +result = ceil(a); + + /* assert */ +TEST_ASSERT_EQUAL_INT(2, result);//5 / 5 + 5 = 6 +} +#endif // TEST diff --git a/test/Calculator/test_exp.c b/test/Calculator/test_exp.c new file mode 100644 index 0000000..528de5e --- /dev/null +++ b/test/Calculator/test_exp.c @@ -0,0 +1,19 @@ + + #ifdef TEST + #include "unity.h" + #include "calculator.h" + + + + void test_exp(void) { + /* arrange */ + double result; + double a =1; + double exponent = exp(a); + /* act */ + result = exponent; + /* assert */ + TEST_ASSERT_EQUAL_INT(1, result);//5 / 5 + 5 = 6 +} + + #endif // TEST diff --git a/test/Calculator/test_sin.c b/test/Calculator/test_sin.c new file mode 100644 index 0000000..de2f22a --- /dev/null +++ b/test/Calculator/test_sin.c @@ -0,0 +1,26 @@ + #ifdef TEST + #include "unity.h" + #include "calculator.h" + + + void setUp(void){ + //Wenn Funktion Vorraussetzungen braucht + } + void tearDown(void){ + } + + + void test_sin(void){ + /* arrange */ + double num1=20; + double result; + double sine = num1 * M_PI /180.0; + + /* act */ + result = sine; + + /* assert */ + TEST_ASSERT_EQUAL_INT(0.34, result);//5 / 5 + 5 = 6 + } + + #endif // TEST