diff --git a/And b/And new file mode 100644 index 0000000..e69de29 diff --git a/Shell b/Shell new file mode 100644 index 0000000..e69de29 diff --git a/build/release/dependencies/force_build b/build/release/dependencies/force_build new file mode 100644 index 0000000..e69de29 diff --git a/build/release/dependencies/top.d b/build/release/dependencies/top.d new file mode 100644 index 0000000..02e77a3 --- /dev/null +++ b/build/release/dependencies/top.d @@ -0,0 +1 @@ +build/release/out/c/top.o: src/main/c/Quiz/top.c diff --git a/build/release/out/c/top.o b/build/release/out/c/top.o new file mode 100644 index 0000000..2c44dbf Binary files /dev/null and b/build/release/out/c/top.o differ diff --git a/build/test/cache/defines_dependency.yml b/build/test/cache/defines_dependency.yml index b227090..d5f8321 100644 --- a/build/test/cache/defines_dependency.yml +++ b/build/test/cache/defines_dependency.yml @@ -1,3 +1,5 @@ --- src/main/c/Template/game100.c: - TEST +src/main/c/Calculator/calculator.c: +- TEST diff --git a/build/test/cache/input.yml b/build/test/cache/input.yml index 1bace5f..97834b0 100644 --- a/build/test/cache/input.yml +++ b/build/test/cache/input.yml @@ -77,10 +77,10 @@ :testfail: ".fail" :dependencies: ".d" :unity: - :vendor_path: "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor" + :vendor_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor" :defines: [] :cmock: - :vendor_path: "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor" + :vendor_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor" :defines: [] :includes: [] :mock_prefix: mock_ @@ -99,7 +99,7 @@ :verbosity: 3 :unity_helper: false :cexception: - :vendor_path: "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor" + :vendor_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor" :defines: [] :test_runner: :includes: [] @@ -257,13 +257,13 @@ :arguments: [] :plugins: :load_paths: - - "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/lib/../plugins" + - "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/../plugins" :enabled: - stdout_pretty_tests_report - module_generator :display_raw_test_results: false - :stdout_pretty_tests_report_path: "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/lib/../plugins/stdout_pretty_tests_report" - :module_generator_path: "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/lib/../plugins/module_generator" + :stdout_pretty_tests_report_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/../plugins/stdout_pretty_tests_report" + :module_generator_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/../plugins/module_generator" :gcov: :reports: - HtmlDetailed diff --git a/build/test/cache/test_add.c b/build/test/cache/test_add.c new file mode 100644 index 0000000..6d44467 --- /dev/null +++ b/build/test/cache/test_add.c @@ -0,0 +1,49 @@ +#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_adding_whole_numbers(void){ + + + + double result; + + double b = 3; + + double a = 3.5; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((42.875)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/cache/test_template.c b/build/test/cache/test_template.c index d967090..0380b7b 100644 --- a/build/test/cache/test_template.c +++ b/build/test/cache/test_template.c @@ -1,5 +1,5 @@ #include "src/main/c/Template/game100.h" -#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" diff --git a/build/test/dependencies/calculator.d b/build/test/dependencies/calculator.d new file mode 100644 index 0000000..65603fc --- /dev/null +++ b/build/test/dependencies/calculator.d @@ -0,0 +1 @@ +build/test/out/c/calculator.o: src/main/c/Calculator/calculator.c diff --git a/build/test/dependencies/force_build b/build/test/dependencies/force_build new file mode 100644 index 0000000..e69de29 diff --git a/build/test/dependencies/test_add.d b/build/test/dependencies/test_add.d new file mode 100644 index 0000000..2d698f4 --- /dev/null +++ b/build/test/dependencies/test_add.d @@ -0,0 +1,4 @@ +build/test/out/c/test_add.o: test/Calculator/test_add.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_add_runner.d b/build/test/dependencies/test_add_runner.d new file mode 100644 index 0000000..e3f0886 --- /dev/null +++ b/build/test/dependencies/test_add_runner.d @@ -0,0 +1,3 @@ +build/test/out/c/test_add_runner.o: build/test/runners/test_add_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_template_runner.d b/build/test/dependencies/test_template_runner.d index c4140c0..8073f33 100644 --- a/build/test/dependencies/test_template_runner.d +++ b/build/test/dependencies/test_template_runner.d @@ -1,4 +1,4 @@ build/test/out/c/test_template_runner.o: \ build/test/runners/test_template_runner.c \ - /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ - /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h + /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 new file mode 100644 index 0000000..b3aa454 Binary files /dev/null and b/build/test/out/c/calculator.o differ diff --git a/build/test/out/c/test_add.o b/build/test/out/c/test_add.o new file mode 100644 index 0000000..fbad07a Binary files /dev/null and b/build/test/out/c/test_add.o differ diff --git a/build/test/out/c/test_add_runner.o b/build/test/out/c/test_add_runner.o new file mode 100644 index 0000000..b71ce1f Binary files /dev/null and b/build/test/out/c/test_add_runner.o differ diff --git a/build/test/out/c/test_template_runner.o b/build/test/out/c/test_template_runner.o index 2442d60..3c6beb1 100644 Binary files a/build/test/out/c/test_template_runner.o and b/build/test/out/c/test_template_runner.o differ diff --git a/build/test/out/test_add.out b/build/test/out/test_add.out new file mode 100755 index 0000000..6fb35d3 Binary files /dev/null and b/build/test/out/test_add.out differ diff --git a/build/test/out/test_template.out b/build/test/out/test_template.out index 8156bef..69915c0 100755 Binary files a/build/test/out/test_template.out and b/build/test/out/test_template.out differ diff --git a/build/test/preprocess/files/test_add.c b/build/test/preprocess/files/test_add.c new file mode 100644 index 0000000..6d44467 --- /dev/null +++ b/build/test/preprocess/files/test_add.c @@ -0,0 +1,49 @@ +#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_adding_whole_numbers(void){ + + + + double result; + + double b = 3; + + double a = 3.5; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((42.875)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/files/test_template.c b/build/test/preprocess/files/test_template.c index d967090..0380b7b 100644 --- a/build/test/preprocess/files/test_template.c +++ b/build/test/preprocess/files/test_template.c @@ -1,5 +1,5 @@ #include "src/main/c/Template/game100.h" -#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" diff --git a/build/test/preprocess/includes/test_add.c b/build/test/preprocess/includes/test_add.c new file mode 100644 index 0000000..26256f2 --- /dev/null +++ b/build/test/preprocess/includes/test_add.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/preprocess/includes/test_template.c b/build/test/preprocess/includes/test_template.c index 2f39e86..e60bf2a 100644 --- a/build/test/preprocess/includes/test_template.c +++ b/build/test/preprocess/includes/test_template.c @@ -1,3 +1,3 @@ --- -- "/var/lib/gems/2.7.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.h" - src/main/c/Template/game100.h diff --git a/build/test/results/test_add.pass b/build/test/results/test_add.pass new file mode 100644 index 0000000..534e901 --- /dev/null +++ b/build/test/results/test_add.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Calculator + :file: test_add.c +:successes: +- :test: test_adding_whole_numbers + :line: 13 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.006848459015600383 diff --git a/build/test/results/test_template.pass b/build/test/results/test_template.pass index ac2a353..6bdd5e9 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.002492974977940321 +:time: 0.00312035801471211 diff --git a/build/test/runners/test_add_runner.c b/build/test/runners/test_add_runner.c new file mode 100644 index 0000000..b5d375c --- /dev/null +++ b/build/test/runners/test_add_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_adding_whole_numbers(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_add.c"); + run_test(test_adding_whole_numbers, "test_adding_whole_numbers", 13); + + return UnityEnd(); +} diff --git a/src/main/c/Calculator/calculator.c b/src/main/c/Calculator/calculator.c index abf70e0..95d3980 100644 --- a/src/main/c/Calculator/calculator.c +++ b/src/main/c/Calculator/calculator.c @@ -10,9 +10,9 @@ int getIntInput(const char *message); double factorial(double num); double permutation(int n, int r); double combination(int n, int r); -double pow(double num1, int num2); +double pow(double num1, double num2); - int main() { + int calculator() { int choice; double num1, num2, result; @@ -85,29 +85,29 @@ double pow(double num1, int num2); case 5: return pow(num1, num2); case 6: - return fmod(num1, num2); + return 0;// fmod(num1, num2); case 7: - return log(num1); + return 0;// log(num1); case 8: return pow(num1, num2); case 9: - return sqrt(num1); + return 0;// sqrt(num1); case 10: return num1 * num1; case 11: return num1 * num1 * num1; case 12: - return cbrt(num1); + return 0;// cbrt(num1); case 13: return factorial(num1); case 14: return pow(num1, num2); case 15: - return sin(num1 * M_PI / 180.0); + return 0;// sin(num1 * M_PI / 180.0); case 16: - return cos(num1 * M_PI / 180.0); + return 0;// cos(num1 * M_PI / 180.0); case 17: - return tan(num1 * M_PI / 180.0); + return 0;// tan(num1 * M_PI / 180.0); case 18: return permutation((int)num1, (int)num2); @@ -149,10 +149,10 @@ int getIntInput(const char *message) { return input; } -double pow(double num1, int num2){ +double pow(double num1, double num2){ double product = 1; - for(int i = 0; i < num2; ){ + for(int i = 0; i < num2; i++){ product *= num1; } return product; -} \ No newline at end of file +} diff --git a/src/main/c/Calculator/calculator.h b/src/main/c/Calculator/calculator.h new file mode 100644 index 0000000..8d0213a --- /dev/null +++ b/src/main/c/Calculator/calculator.h @@ -0,0 +1,8 @@ +#ifndef CALCULATOR_H +#define CALCULATOR_H + +int calculator(); +double pow(double num1, double num2); +double factorial(double num); + +#endif diff --git a/test/Calculator/test_add.c b/test/Calculator/test_add.c new file mode 100644 index 0000000..8eee0b1 --- /dev/null +++ b/test/Calculator/test_add.c @@ -0,0 +1,26 @@ +#ifdef TEST +#include "unity.h" +#include "../../src/main/c/Calculator/calculator.h" + + +void setUp(void){ + //Wenn Funktion Vorraussetzungen braucht +} +void tearDown(void){ +} + + +void test_adding_whole_numbers(void){ + /* arrange */ + double result; + double b = 3; + double a = 3.5; + + /* act */ + result = pow(a, b); + + /* assert */ + TEST_ASSERT_EQUAL_INT(42.875, result);//3 * 3 * 3 = 27 +} + +#endif // TEST