Browse Source
IMPORTANT FIXES: ADDED ALL HEADER FILES FOR THE DIFFRENT .C FILES AND ALSO IMPROVED THE YAML FILE -- COMPILING WORKS NOW!
remotes/origin/kabrel
IMPORTANT FIXES: ADDED ALL HEADER FILES FOR THE DIFFRENT .C FILES AND ALSO IMPROVED THE YAML FILE -- COMPILING WORKS NOW!
remotes/origin/kabrel
fdai7782
11 months ago
42 changed files with 1652 additions and 79 deletions
-
16.vscode/c_cpp_properties.json
-
8.vscode/settings.json
-
1Unity
-
0build-project.sh
-
16project.yml
-
2src/main/c/BasicMode.c
-
1src/main/c/ConvertMode.c
-
51src/main/c/main_calculator.c
-
13src/main/c/main_calculator.h
-
2src/main/c/programmingMode.c
-
8src/main/c/programmingMode.h
-
1src/main/c/scientificMode.c
-
3src/main/c/testForNumber.c
-
7src/main/c/testForNumber.h
-
4src/main/c/testForOperator.c
-
7src/main/c/testForOperator.h
-
35src/test/c/test_calculator.c
-
9target/test/cache/defines_dependency.yml
-
243target/test/cache/input.yml
-
502target/test/cache/test_calculator.c
-
6target/test/dependencies/cmock.d
-
0target/test/dependencies/force_build
-
2target/test/dependencies/main_calculator.d
-
2target/test/dependencies/programmingMode.d
-
2target/test/dependencies/testForNumber.d
-
2target/test/dependencies/testForOperator.d
-
5target/test/dependencies/test_calculator.d
-
4target/test/dependencies/test_calculator_runner.d
-
4target/test/dependencies/unity.d
-
BINtarget/test/out/c/cmock.o
-
BINtarget/test/out/c/main_calculator.o
-
BINtarget/test/out/c/programmingMode.o
-
BINtarget/test/out/c/testForNumber.o
-
BINtarget/test/out/c/testForOperator.o
-
BINtarget/test/out/c/test_calculator.o
-
BINtarget/test/out/c/test_calculator_runner.o
-
BINtarget/test/out/c/unity.o
-
BINtarget/test/out/test_calculator.out
-
502target/test/preprocess/files/test_calculator.c
-
6target/test/preprocess/includes/test_calculator.c
-
130target/test/results/test_calculator.pass
-
137target/test/runners/test_calculator_runner.c
@ -0,0 +1,16 @@ |
|||||
|
{ |
||||
|
"configurations": [ |
||||
|
{ |
||||
|
"name": "Linux", |
||||
|
"includePath": [ |
||||
|
"${workspaceFolder}/**" |
||||
|
], |
||||
|
"defines": [], |
||||
|
"compilerPath": "/usr/bin/gcc", |
||||
|
"cStandard": "c17", |
||||
|
"cppStandard": "c++98", |
||||
|
"intelliSenseMode": "linux-gcc-x64" |
||||
|
} |
||||
|
], |
||||
|
"version": 4 |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
{ |
||||
|
"C_Cpp.errorSquiggles": "disabled", |
||||
|
"files.associations": { |
||||
|
"testforoperator.h": "c", |
||||
|
"testfornumber.h": "c", |
||||
|
"programmingmode.h": "c" |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
#ifndef PROGRAMMINGMODE |
||||
|
#define PROGRAMMINGMODE |
||||
|
|
||||
|
// to test some calculations |
||||
|
int performOperation(int num1, char operatorType, int num2); |
||||
|
|
||||
|
|
||||
|
#endif // PROGRAMMINGMODE |
@ -0,0 +1,7 @@ |
|||||
|
#ifndef TESTFORNUMBER |
||||
|
#define TESTFORNUMBER |
||||
|
|
||||
|
// get input and check if its a number |
||||
|
double testForNumber(); |
||||
|
|
||||
|
#endif // TESTFORNUMBER |
@ -0,0 +1,7 @@ |
|||||
|
#ifndef TESTFOROPERATOR |
||||
|
#define TESTFOROPERATOR |
||||
|
|
||||
|
// get input and check if its a operator |
||||
|
char testForOperator(); |
||||
|
|
||||
|
#endif // TESTFOROPERATOR |
@ -0,0 +1,9 @@ |
|||||
|
--- |
||||
|
src/main/c/main_calculator.c: |
||||
|
- TEST |
||||
|
src/main/c/testForOperator.c: |
||||
|
- TEST |
||||
|
src/main/c/testForNumber.c: |
||||
|
- TEST |
||||
|
src/main/c/programmingMode.c: |
||||
|
- TEST |
@ -0,0 +1,243 @@ |
|||||
|
--- |
||||
|
:project: |
||||
|
:use_exceptions: false |
||||
|
:use_mocks: true |
||||
|
:compile_threads: 1 |
||||
|
:test_threads: 1 |
||||
|
:use_test_preprocessor: true |
||||
|
:use_preprocessor_directives: false |
||||
|
:use_deep_dependencies: false |
||||
|
:generate_deep_dependencies: true |
||||
|
:auto_link_deep_dependencies: false |
||||
|
:test_file_prefix: test_ |
||||
|
:options_paths: [] |
||||
|
:release_build: false |
||||
|
:use_auxiliary_dependencies: true |
||||
|
:build_root: target |
||||
|
:which_ceedling: gem |
||||
|
:ceedling_version: 0.31.1 |
||||
|
:default_tasks: |
||||
|
- test:all |
||||
|
:release_build: |
||||
|
:use_assembly: false |
||||
|
:artifacts: [] |
||||
|
:paths: |
||||
|
:test: |
||||
|
- "+:src/test/c/**" |
||||
|
- "-:src/test/c/support" |
||||
|
:source: |
||||
|
- "+:src/main/c/**" |
||||
|
:support: |
||||
|
- src/test/c/support |
||||
|
:include: [] |
||||
|
:libraries: [] |
||||
|
:test_toolchain_include: [] |
||||
|
:release_toolchain_include: [] |
||||
|
:files: |
||||
|
:test: [] |
||||
|
:source: [] |
||||
|
:assembly: [] |
||||
|
:support: [] |
||||
|
:include: [] |
||||
|
:environment: |
||||
|
- :rake_columns: '120' |
||||
|
:defines: |
||||
|
:test: |
||||
|
- &1 [] |
||||
|
- TEST |
||||
|
:test_preprocess: |
||||
|
- *1 |
||||
|
- TEST |
||||
|
:release: [] |
||||
|
:release_preprocess: [] |
||||
|
:use_test_definition: false |
||||
|
:common: [] |
||||
|
:libraries: |
||||
|
:flag: "-l${1}" |
||||
|
:path_flag: "-L ${1}" |
||||
|
:test: [] |
||||
|
:test_preprocess: [] |
||||
|
:release: [] |
||||
|
:release_preprocess: [] |
||||
|
:placement: :end |
||||
|
:system: |
||||
|
- m |
||||
|
:flags: {} |
||||
|
:extension: |
||||
|
:header: ".h" |
||||
|
:source: ".c" |
||||
|
:assembly: ".s" |
||||
|
:object: ".o" |
||||
|
:libraries: |
||||
|
- ".a" |
||||
|
- ".so" |
||||
|
:executable: ".out" |
||||
|
:map: ".map" |
||||
|
:list: ".lst" |
||||
|
:testpass: ".pass" |
||||
|
:testfail: ".fail" |
||||
|
:dependencies: ".d" |
||||
|
:unity: |
||||
|
:vendor_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor" |
||||
|
:defines: [] |
||||
|
:cmock: |
||||
|
:vendor_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor" |
||||
|
:defines: [] |
||||
|
:includes: [] |
||||
|
:mock_prefix: mock_ |
||||
|
:when_no_prototypes: :warn |
||||
|
:enforce_strict_ordering: true |
||||
|
:plugins: |
||||
|
- :ignore |
||||
|
- :callback |
||||
|
:treat_as: |
||||
|
uint8: HEX8 |
||||
|
uint16: HEX16 |
||||
|
uint32: UINT32 |
||||
|
int8: INT8 |
||||
|
bool: UINT8 |
||||
|
:mock_path: target/test/mocks |
||||
|
:verbosity: 3 |
||||
|
:unity_helper: false |
||||
|
:cexception: |
||||
|
:vendor_path: "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor" |
||||
|
:defines: [] |
||||
|
:test_runner: |
||||
|
:includes: [] |
||||
|
:file_suffix: _runner |
||||
|
:tools: |
||||
|
:test_compiler: |
||||
|
:executable: gcc |
||||
|
:name: default_test_compiler |
||||
|
:stderr_redirect: :none |
||||
|
:background_exec: :none |
||||
|
:optional: false |
||||
|
:arguments: |
||||
|
- '' |
||||
|
- '' |
||||
|
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
||||
|
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
||||
|
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
||||
|
- "-DGNU_COMPILER" |
||||
|
- "-g" |
||||
|
- '' |
||||
|
- -c "${1}" |
||||
|
- -o "${2}" |
||||
|
- "-MMD" |
||||
|
- -MF "${4}" |
||||
|
:test_fixture: |
||||
|
:executable: "${1}" |
||||
|
:name: default_test_fixture |
||||
|
:stderr_redirect: :auto |
||||
|
:background_exec: :none |
||||
|
:optional: false |
||||
|
:arguments: [] |
||||
|
:test_linker: |
||||
|
:executable: gcc |
||||
|
:name: default_test_linker |
||||
|
:stderr_redirect: :none |
||||
|
:background_exec: :none |
||||
|
:optional: false |
||||
|
:arguments: |
||||
|
- '' |
||||
|
- '' |
||||
|
- '' |
||||
|
- '"${1}"' |
||||
|
- "${5}" |
||||
|
- -o "${2}" |
||||
|
- '' |
||||
|
- "${4}" |
||||
|
- '' |
||||
|
:test_file_preprocessor: |
||||
|
:executable: gcc |
||||
|
:name: default_test_file_preprocessor |
||||
|
:stderr_redirect: :none |
||||
|
:background_exec: :none |
||||
|
:optional: false |
||||
|
:arguments: |
||||
|
- '' |
||||
|
- '' |
||||
|
- "-E" |
||||
|
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
||||
|
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
||||
|
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
||||
|
- "-D$": DEFINES_TEST_PREPROCESS |
||||
|
- "-DGNU_COMPILER" |
||||
|
- '"${1}"' |
||||
|
- -o "${2}" |
||||
|
:test_file_preprocessor_directives: |
||||
|
:executable: gcc |
||||
|
:name: default_test_file_preprocessor_directives |
||||
|
:stderr_redirect: :none |
||||
|
:background_exec: :none |
||||
|
:optional: false |
||||
|
:arguments: |
||||
|
- "-E" |
||||
|
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
||||
|
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
||||
|
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
||||
|
- "-D$": DEFINES_TEST_PREPROCESS |
||||
|
- "-DGNU_COMPILER" |
||||
|
- "-fdirectives-only" |
||||
|
- '"${1}"' |
||||
|
- -o "${2}" |
||||
|
:test_includes_preprocessor: |
||||
|
:executable: gcc |
||||
|
:name: default_test_includes_preprocessor |
||||
|
:stderr_redirect: :none |
||||
|
:background_exec: :none |
||||
|
:optional: false |
||||
|
:arguments: |
||||
|
- '' |
||||
|
- '' |
||||
|
- "-E" |
||||
|
- "-MM" |
||||
|
- "-MG" |
||||
|
- -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR |
||||
|
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE |
||||
|
- "-D$": COLLECTION_DEFINES_TEST_AND_VENDOR |
||||
|
- "-D$": DEFINES_TEST_PREPROCESS |
||||
|
- "-DGNU_COMPILER" |
||||
|
- '"${1}"' |
||||
|
:test_compiler: |
||||
|
:arguments: [] |
||||
|
:test_linker: |
||||
|
:arguments: [] |
||||
|
:test_fixture: |
||||
|
:arguments: [] |
||||
|
:link_objects: [] |
||||
|
:test_includes_preprocessor: |
||||
|
:arguments: [] |
||||
|
:test_file_preprocessor: |
||||
|
:arguments: [] |
||||
|
:test_file_preprocessor_directives: |
||||
|
:arguments: [] |
||||
|
:test_dependencies_generator: |
||||
|
:arguments: [] |
||||
|
:release_compiler: |
||||
|
:arguments: [] |
||||
|
:release_linker: |
||||
|
:arguments: [] |
||||
|
:release_assembler: |
||||
|
:arguments: [] |
||||
|
:release_dependencies_generator: |
||||
|
:arguments: [] |
||||
|
:plugins: |
||||
|
:load_paths: |
||||
|
- "/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/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 |
||||
|
:gcovr: |
||||
|
:html_medium_threshold: 75 |
||||
|
:html_high_threshold: 90 |
||||
|
:module_generator: |
||||
|
:project_root: "./" |
||||
|
:source_root: src/ |
||||
|
:test_root: test/ |
@ -0,0 +1,502 @@ |
|||||
|
#include "src/main/c/programmingMode.h" |
||||
|
#include "src/main/c/testForNumber.h" |
||||
|
#include "src/main/c/testForOperator.h" |
||||
|
#include "src/main/c/main_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_addition(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = add(1, 2); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((3)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_minus(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = minus(3, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(25), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_multiply(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = multiply(1, 2); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(31), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_divide(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = divide(4, 2); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(37), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
|
||||
|
|
||||
|
double result1 = divide(4, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result1)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(40), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConMeter(void) { |
||||
|
|
||||
|
double result = ConMeter(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.5)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(45), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConMeterToFoot(void) { |
||||
|
|
||||
|
double result = ConMeterToFoot(5, 1, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((16.4042)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(50), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
void test_ConKilometerToMiles(void) { |
||||
|
|
||||
|
double result = ConKilometerToMiles(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((8.04672)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConGram(void) { |
||||
|
|
||||
|
double result = ConGram(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(59), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConGramToPounds(void) { |
||||
|
|
||||
|
double result = ConGramToPounds(5, 0, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((11.0231)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(64), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConTemp(void) { |
||||
|
|
||||
|
double result = ConTemp(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((41)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(69), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConSpeed(void) { |
||||
|
|
||||
|
double result = ConSpeed(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((3.10686)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(74), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConLiter(void) { |
||||
|
|
||||
|
double result = ConLiter(5, 1, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((5000)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(79), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConLiterToGallon(void) { |
||||
|
|
||||
|
double result = ConLiterToGallon(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((1.32086)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(84), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConData(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(89), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConArea(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.05)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(94), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConVolume(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(99), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConClock(void) { |
||||
|
|
||||
|
double result = ConClock(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((5)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(104), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConTime(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(109), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_squareRootFunction(void) { |
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((2.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((2.0))), (UNITY_FLOAT)((UNITY_FLOAT)((squareRootFunction(4.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(115))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_sineFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((0.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((0.0))), (UNITY_FLOAT)((UNITY_FLOAT)((sineFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(121))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_cosineFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((1.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((1.0))), (UNITY_FLOAT)((UNITY_FLOAT)((cosineFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(127))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_tangentFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((0.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((0.0))), (UNITY_FLOAT)((UNITY_FLOAT)((tangentFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(133))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_logarithmFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((1.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((1.0))), (UNITY_FLOAT)((UNITY_FLOAT)((logarithmFunction(10.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(139))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_naturalLogarithmFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((0.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((0.0))), (UNITY_FLOAT)((UNITY_FLOAT)((naturalLogarithmFunction(1.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(145))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_logarithmBase2Function(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((3.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((3.0))), (UNITY_FLOAT)((UNITY_FLOAT)((logarithmBase2Function(8.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(151))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_exponentialFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((1.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((1.0))), (UNITY_FLOAT)((UNITY_FLOAT)((exponentialFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(157))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_performOperation_Subtraction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
int result; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
result = performOperation(10, '-', 3); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((7)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(169), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_performOperation_Multiplication(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
int result; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
result = performOperation(4, '*', 6); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((24)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(181), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_performOperation_Division(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
int result; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
result = performOperation(8, '/', 2); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((4)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(193), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
target/test/out/c/cmock.o: \ |
||||
|
/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock.c \ |
||||
|
/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock.h \ |
||||
|
/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/cmock/src/cmock_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 |
@ -0,0 +1,2 @@ |
|||||
|
target/test/out/c/main_calculator.o: src/main/c/main_calculator.c \ |
||||
|
src/main/c/main_calculator.h |
@ -0,0 +1,2 @@ |
|||||
|
target/test/out/c/programmingMode.o: src/main/c/programmingMode.c \ |
||||
|
src/main/c/programmingMode.h |
@ -0,0 +1,2 @@ |
|||||
|
target/test/out/c/testForNumber.o: src/main/c/testForNumber.c \ |
||||
|
src/main/c/testForNumber.h |
@ -0,0 +1,2 @@ |
|||||
|
target/test/out/c/testForOperator.o: src/main/c/testForOperator.c \ |
||||
|
src/main/c/testForOperator.h |
@ -0,0 +1,5 @@ |
|||||
|
target/test/out/c/test_calculator.o: src/test/c/test_calculator.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/main_calculator.h src/main/c/testForOperator.h \ |
||||
|
src/main/c/testForNumber.h src/main/c/programmingMode.h |
@ -0,0 +1,4 @@ |
|||||
|
target/test/out/c/test_calculator_runner.o: \ |
||||
|
target/test/runners/test_calculator_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 |
@ -0,0 +1,4 @@ |
|||||
|
target/test/out/c/unity.o: \ |
||||
|
/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.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 |
@ -0,0 +1,502 @@ |
|||||
|
#include "src/main/c/programmingMode.h" |
||||
|
#include "src/main/c/testForNumber.h" |
||||
|
#include "src/main/c/testForOperator.h" |
||||
|
#include "src/main/c/main_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_addition(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = add(1, 2); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((3)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_minus(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = minus(3, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(25), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_multiply(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = multiply(1, 2); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(31), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_divide(void) |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
double result = divide(4, 2); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(37), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
|
||||
|
|
||||
|
double result1 = divide(4, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result1)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(40), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConMeter(void) { |
||||
|
|
||||
|
double result = ConMeter(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.5)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(45), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConMeterToFoot(void) { |
||||
|
|
||||
|
double result = ConMeterToFoot(5, 1, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((16.4042)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(50), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
void test_ConKilometerToMiles(void) { |
||||
|
|
||||
|
double result = ConKilometerToMiles(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((8.04672)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConGram(void) { |
||||
|
|
||||
|
double result = ConGram(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(59), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConGramToPounds(void) { |
||||
|
|
||||
|
double result = ConGramToPounds(5, 0, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((11.0231)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(64), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConTemp(void) { |
||||
|
|
||||
|
double result = ConTemp(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((41)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(69), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConSpeed(void) { |
||||
|
|
||||
|
double result = ConSpeed(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((3.10686)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(74), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConLiter(void) { |
||||
|
|
||||
|
double result = ConLiter(5, 1, 0); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((5000)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(79), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConLiterToGallon(void) { |
||||
|
|
||||
|
double result = ConLiterToGallon(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((1.32086)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(84), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConData(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(89), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConArea(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.05)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(94), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConVolume(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(99), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConClock(void) { |
||||
|
|
||||
|
double result = ConClock(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((5)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(104), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_ConTime(void) { |
||||
|
|
||||
|
double result = ConData(5, 0, 1); |
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((0.005)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(109), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_squareRootFunction(void) { |
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((2.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((2.0))), (UNITY_FLOAT)((UNITY_FLOAT)((squareRootFunction(4.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(115))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_sineFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((0.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((0.0))), (UNITY_FLOAT)((UNITY_FLOAT)((sineFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(121))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_cosineFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((1.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((1.0))), (UNITY_FLOAT)((UNITY_FLOAT)((cosineFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(127))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_tangentFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((0.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((0.0))), (UNITY_FLOAT)((UNITY_FLOAT)((tangentFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(133))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_logarithmFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((1.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((1.0))), (UNITY_FLOAT)((UNITY_FLOAT)((logarithmFunction(10.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(139))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_naturalLogarithmFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((0.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((0.0))), (UNITY_FLOAT)((UNITY_FLOAT)((naturalLogarithmFunction(1.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(145))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_logarithmBase2Function(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((3.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((3.0))), (UNITY_FLOAT)((UNITY_FLOAT)((logarithmBase2Function(8.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(151))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_exponentialFunction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertFloatsWithin((UNITY_FLOAT)((UNITY_FLOAT)((1.0)) * (UNITY_FLOAT)(0.00001f)), (UNITY_FLOAT)((UNITY_FLOAT)((1.0))), (UNITY_FLOAT)((UNITY_FLOAT)((exponentialFunction(0.0)))), (( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
)), (UNITY_UINT)((UNITY_UINT)(157))); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_performOperation_Subtraction(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
int result; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
result = performOperation(10, '-', 3); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((7)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(169), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_performOperation_Multiplication(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
int result; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
result = performOperation(4, '*', 6); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((24)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(181), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
void test_performOperation_Division(void) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
int result; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
result = performOperation(8, '/', 2); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
UnityAssertEqualNumber((UNITY_INT)((4)), (UNITY_INT)((result)), ( |
||||
|
|
||||
|
((void *)0) |
||||
|
|
||||
|
), (UNITY_UINT)(193), UNITY_DISPLAY_STYLE_INT); |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
--- |
||||
|
- "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
||||
|
- src/main/c/main_calculator.h |
||||
|
- src/main/c/testForOperator.h |
||||
|
- src/main/c/testForNumber.h |
||||
|
- src/main/c/programmingMode.h |
@ -0,0 +1,130 @@ |
|||||
|
--- |
||||
|
:source: |
||||
|
:path: src/test/c |
||||
|
:file: test_calculator.c |
||||
|
:successes: |
||||
|
- :test: test_addition |
||||
|
:line: 16 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_minus |
||||
|
:line: 22 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_multiply |
||||
|
:line: 28 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_divide |
||||
|
:line: 34 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConMeter |
||||
|
:line: 43 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConMeterToFoot |
||||
|
:line: 48 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConKilometerToMiles |
||||
|
:line: 52 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConGram |
||||
|
:line: 57 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConGramToPounds |
||||
|
:line: 62 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConTemp |
||||
|
:line: 67 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConSpeed |
||||
|
:line: 72 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConLiter |
||||
|
:line: 77 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConLiterToGallon |
||||
|
:line: 82 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConData |
||||
|
:line: 87 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConArea |
||||
|
:line: 92 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConVolume |
||||
|
:line: 97 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConClock |
||||
|
:line: 102 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_ConTime |
||||
|
:line: 107 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_squareRootFunction |
||||
|
:line: 114 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_sineFunction |
||||
|
:line: 119 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_cosineFunction |
||||
|
:line: 125 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_tangentFunction |
||||
|
:line: 131 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_logarithmFunction |
||||
|
:line: 137 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_naturalLogarithmFunction |
||||
|
:line: 143 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_logarithmBase2Function |
||||
|
:line: 149 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_exponentialFunction |
||||
|
:line: 155 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_performOperation_Subtraction |
||||
|
:line: 161 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_performOperation_Multiplication |
||||
|
:line: 173 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
- :test: test_performOperation_Division |
||||
|
:line: 185 |
||||
|
:message: '' |
||||
|
:unity_test_time: 0 |
||||
|
:failures: [] |
||||
|
:ignores: [] |
||||
|
:counts: |
||||
|
:total: 29 |
||||
|
:passed: 29 |
||||
|
:failed: 0 |
||||
|
:ignored: 0 |
||||
|
:stdout: [] |
||||
|
:time: 0.001314320999881602 |
@ -0,0 +1,137 @@ |
|||||
|
/* 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_addition(void); |
||||
|
extern void test_minus(void); |
||||
|
extern void test_multiply(void); |
||||
|
extern void test_divide(void); |
||||
|
extern void test_ConMeter(void); |
||||
|
extern void test_ConMeterToFoot(void); |
||||
|
extern void test_ConKilometerToMiles(void); |
||||
|
extern void test_ConGram(void); |
||||
|
extern void test_ConGramToPounds(void); |
||||
|
extern void test_ConTemp(void); |
||||
|
extern void test_ConSpeed(void); |
||||
|
extern void test_ConLiter(void); |
||||
|
extern void test_ConLiterToGallon(void); |
||||
|
extern void test_ConData(void); |
||||
|
extern void test_ConArea(void); |
||||
|
extern void test_ConVolume(void); |
||||
|
extern void test_ConClock(void); |
||||
|
extern void test_ConTime(void); |
||||
|
extern void test_squareRootFunction(void); |
||||
|
extern void test_sineFunction(void); |
||||
|
extern void test_cosineFunction(void); |
||||
|
extern void test_tangentFunction(void); |
||||
|
extern void test_logarithmFunction(void); |
||||
|
extern void test_naturalLogarithmFunction(void); |
||||
|
extern void test_logarithmBase2Function(void); |
||||
|
extern void test_exponentialFunction(void); |
||||
|
extern void test_performOperation_Subtraction(void); |
||||
|
extern void test_performOperation_Multiplication(void); |
||||
|
extern void test_performOperation_Division(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_calculator.c"); |
||||
|
run_test(test_addition, "test_addition", 16); |
||||
|
run_test(test_minus, "test_minus", 22); |
||||
|
run_test(test_multiply, "test_multiply", 28); |
||||
|
run_test(test_divide, "test_divide", 34); |
||||
|
run_test(test_ConMeter, "test_ConMeter", 43); |
||||
|
run_test(test_ConMeterToFoot, "test_ConMeterToFoot", 48); |
||||
|
run_test(test_ConKilometerToMiles, "test_ConKilometerToMiles", 52); |
||||
|
run_test(test_ConGram, "test_ConGram", 57); |
||||
|
run_test(test_ConGramToPounds, "test_ConGramToPounds", 62); |
||||
|
run_test(test_ConTemp, "test_ConTemp", 67); |
||||
|
run_test(test_ConSpeed, "test_ConSpeed", 72); |
||||
|
run_test(test_ConLiter, "test_ConLiter", 77); |
||||
|
run_test(test_ConLiterToGallon, "test_ConLiterToGallon", 82); |
||||
|
run_test(test_ConData, "test_ConData", 87); |
||||
|
run_test(test_ConArea, "test_ConArea", 92); |
||||
|
run_test(test_ConVolume, "test_ConVolume", 97); |
||||
|
run_test(test_ConClock, "test_ConClock", 102); |
||||
|
run_test(test_ConTime, "test_ConTime", 107); |
||||
|
run_test(test_squareRootFunction, "test_squareRootFunction", 114); |
||||
|
run_test(test_sineFunction, "test_sineFunction", 119); |
||||
|
run_test(test_cosineFunction, "test_cosineFunction", 125); |
||||
|
run_test(test_tangentFunction, "test_tangentFunction", 131); |
||||
|
run_test(test_logarithmFunction, "test_logarithmFunction", 137); |
||||
|
run_test(test_naturalLogarithmFunction, "test_naturalLogarithmFunction", 143); |
||||
|
run_test(test_logarithmBase2Function, "test_logarithmBase2Function", 149); |
||||
|
run_test(test_exponentialFunction, "test_exponentialFunction", 155); |
||||
|
run_test(test_performOperation_Subtraction, "test_performOperation_Subtraction", 161); |
||||
|
run_test(test_performOperation_Multiplication, "test_performOperation_Multiplication", 173); |
||||
|
run_test(test_performOperation_Division, "test_performOperation_Division", 185); |
||||
|
|
||||
|
return UnityEnd(); |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue