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
fdai7782 11 months ago
parent
commit
7e96f4ed54
  1. 16
      .vscode/c_cpp_properties.json
  2. 8
      .vscode/settings.json
  3. 1
      Unity
  4. 0
      build-project.sh
  5. 16
      project.yml
  6. 2
      src/main/c/BasicMode.c
  7. 1
      src/main/c/ConvertMode.c
  8. 51
      src/main/c/main_calculator.c
  9. 13
      src/main/c/main_calculator.h
  10. 2
      src/main/c/programmingMode.c
  11. 8
      src/main/c/programmingMode.h
  12. 1
      src/main/c/scientificMode.c
  13. 3
      src/main/c/testForNumber.c
  14. 7
      src/main/c/testForNumber.h
  15. 4
      src/main/c/testForOperator.c
  16. 7
      src/main/c/testForOperator.h
  17. 35
      src/test/c/test_calculator.c
  18. 9
      target/test/cache/defines_dependency.yml
  19. 243
      target/test/cache/input.yml
  20. 502
      target/test/cache/test_calculator.c
  21. 6
      target/test/dependencies/cmock.d
  22. 0
      target/test/dependencies/force_build
  23. 2
      target/test/dependencies/main_calculator.d
  24. 2
      target/test/dependencies/programmingMode.d
  25. 2
      target/test/dependencies/testForNumber.d
  26. 2
      target/test/dependencies/testForOperator.d
  27. 5
      target/test/dependencies/test_calculator.d
  28. 4
      target/test/dependencies/test_calculator_runner.d
  29. 4
      target/test/dependencies/unity.d
  30. BIN
      target/test/out/c/cmock.o
  31. BIN
      target/test/out/c/main_calculator.o
  32. BIN
      target/test/out/c/programmingMode.o
  33. BIN
      target/test/out/c/testForNumber.o
  34. BIN
      target/test/out/c/testForOperator.o
  35. BIN
      target/test/out/c/test_calculator.o
  36. BIN
      target/test/out/c/test_calculator_runner.o
  37. BIN
      target/test/out/c/unity.o
  38. BIN
      target/test/out/test_calculator.out
  39. 502
      target/test/preprocess/files/test_calculator.c
  40. 6
      target/test/preprocess/includes/test_calculator.c
  41. 130
      target/test/results/test_calculator.pass
  42. 137
      target/test/runners/test_calculator_runner.c

16
.vscode/c_cpp_properties.json

@ -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
}

8
.vscode/settings.json

@ -0,0 +1,8 @@
{
"C_Cpp.errorSquiggles": "disabled",
"files.associations": {
"testforoperator.h": "c",
"testfornumber.h": "c",
"programmingmode.h": "c"
}
}

1
Unity

@ -0,0 +1 @@
Subproject commit 134496c6c0c34b463d58daef1904a12abdc5c8e0

0
build-project.sh

16
project.yml

@ -91,15 +91,15 @@
:system:
- m # Example: add 'm' to use the math library
:test:
- stdio
- string
- stdlib
- m # Example: add 'm' to use the math library in tests
#- stdio
#- string
#- stdlib
#- m # Example: add 'm' to use the math library in tests
:release:
- stdio
- string
- stdlib
- m # Example: add 'm' to use the math library in release builds
#- stdio
#- string
#- stdlib
#- m # Example: add 'm' to use the math library in release builds
:plugins:
:load_paths:

2
src/main/c/BasicMode.c

@ -3,7 +3,7 @@
#include <stdlib.h>
#include <math.h>
#include "calculator.h"
void BasicMode() {

1
src/main/c/ConvertMode.c

@ -4,7 +4,6 @@
#include <math.h>
#include <stdbool.h>
#include "calculator.h"
// Unit converter mode
int choice, startingUnit, endingUnit;

51
src/main/c/main_calculator.c

@ -3,7 +3,7 @@
#include <stdlib.h>
#include <math.h>
#include "calculator.h"
#include "main_calculator.h"
double add(double a, double b) {
@ -487,7 +487,7 @@ double ConGramToPounds(double weight, int startingUnit, int endingUnit) {
switch (endingUnit)
{
case 0: //pounds to kg
return weight *= 0, 453592;
return weight *= 453.592;
break;
case 1: //pounds to pounds
@ -510,11 +510,11 @@ double ConTemp(double temp, int startingUnit, int endingUnit) {
switch (endingUnit)
{
case 0: //celsius to fahrenheit
return temp = (temp - 32) * 0, 55555555;
return temp = (temp - 32) * 0,55555555;
break;
case 1: //celsius to celsius
return temp;
return (temp * 9 / 5) + 32;
break;
default:
@ -552,7 +552,7 @@ double ConSpeed(double speed, int startingUnit, int endingUnit) {
break;
case 1: //kmh to mph
return speed * 0.621371;
return speed / 1.60934;
break;
default:
@ -590,7 +590,7 @@ double ConLiter(double liter, int startingUnit, int endingUnit) {
break;
case 1: //ml to l
return liter / 1000;
return ( liter / 1000 );
break;
default:
@ -628,7 +628,7 @@ double ConLiterToGallon(double fluid, int startingUnit, int endingUnit) {
break;
case 1: //l to gallon
return fluid * 0.264172;
return fluid / 3.785;
break;
default:
@ -960,7 +960,7 @@ double ConClock(double time, int startingUnit, int endingUnit) {
case 1: //24 to 12
if (time > 12) {
return time -12;
return time - 12;
}
else {
@ -1003,31 +1003,31 @@ double ConTime(double time, int startingUnit, int endingUnit) {
break;
case 1: //s
return time / 1000;
return (double) time / 1000;
break;
case 2: //min
return time / (1000 * 60);
return (double) time / (1000 * 60);
break;
case 3: //h
return time / (1000 * 60 * 60);
return (double) time / (1000 * 60 * 60);
break;
case 4: //d
return time / (1000 * 60 * 60 * 24);
return (double) time / (1000 * 60 * 60 * 24);
break;
case 5: //w
return time / (1000 * 60 * 60 * 24 * 7);
return (double) time / (1000 * 60 * 60 * 24 * 7);
break;
case 6: //mon
return time / (1000 * 60 * 60 * 24 * 7 * 30);
return time / (1000.0 * 60.0 * 60.0 * 24.0 * 7.0 * 30.0);
break;
case 7: //y
return time / (1000 * 60 * 60 * 24 * 7 * 30 * 12);
return time / (1000.0 * 60.0 * 60.0 * 24.0 * 7.0 * 30.0 * 12.0);
break;
default:
@ -1310,27 +1310,6 @@ double ConTime(double time, int startingUnit, int endingUnit) {
}
//..
// graphMode
void graphMode() {
double x, y;
printf("Enter the range for x (start end step): ");
double x_start, x_end, x_step;
scanf("%lf %lf %lf", &x_start, &x_end, &x_step);
printf("\nGraph for the function y = sin(x):\n");
printf(" x\t| y\n");
printf("--------------\n");
for (x = x_start; x <= x_end; x += x_step) {
y = sin(x);
printf("%.2lf\t| %.2lf\n", x, y);
}
}
// change mode
int mode(int userChoice){

13
src/main/c/calculator.h → src/main/c/main_calculator.h

@ -1,5 +1,5 @@
#ifndef CALCULATOR
#define CALCULATOR
#ifndef MAIN_CALCULATOR
#define MAIN_CALCULATOR
// add function
double add(double a, double b);
@ -13,12 +13,6 @@ double multiply(double a, double b);
// divide function
double divide(double a, double b);
// get input and check if its a number
double testForNumber();
// get input and check if its a operator
char testForOperator();
// Square root function
double squareRootFunction(double x);
@ -85,6 +79,5 @@ double ConClock(double time, int startingUnit, int endingUnit);
double ConTime(double time, int startingUnit, int endingUnit);
int performOperation(int num1, char operatorType, int num2);
#endif // CALCULATOR
#endif // CALCULATOR

2
src/main/c/programmingMode.c

@ -3,7 +3,7 @@
#include <stdio.h>
#include <math.h>
#include "calculator.h"
#include "programmingMode.h"
// Function to convert an integer to binary representation

8
src/main/c/programmingMode.h

@ -0,0 +1,8 @@
#ifndef PROGRAMMINGMODE
#define PROGRAMMINGMODE
// to test some calculations
int performOperation(int num1, char operatorType, int num2);
#endif // PROGRAMMINGMODE

1
src/main/c/scientificMode.c

@ -2,7 +2,6 @@
#include <stdio.h>
#include <math.h>
#include "calculator.h"
// get the number which has to be calculated
double getNumberFromUser() {

3
src/main/c/testForNumber.c

@ -2,8 +2,9 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include "calculator.h"
#include "testForNumber.h"
double testForNumber() {
double num;

7
src/main/c/testForNumber.h

@ -0,0 +1,7 @@
#ifndef TESTFORNUMBER
#define TESTFORNUMBER
// get input and check if its a number
double testForNumber();
#endif // TESTFORNUMBER

4
src/main/c/testForOperator.c

@ -4,7 +4,7 @@
#include <math.h>
#include <stdbool.h>
#include "calculator.h"
#include "testForOperator.h"
char testForOperator() {
//saving the number of operators in a variable so it only needs to be changed in one location
@ -16,7 +16,7 @@ char testForOperator() {
//Loops as long as input isn't valid, enters at least one time
while (!validInput) {
scanf_s("%c\n", &input);
scanf("%c\n", &input);
//checks every position of the array if a position is equal to input returns the input, which also stopps the function
for (int i = 0; i <= numberOfOperators; i++) {
if (input == oppArray[i]) {

7
src/main/c/testForOperator.h

@ -0,0 +1,7 @@
#ifndef TESTFOROPERATOR
#define TESTFOROPERATOR
// get input and check if its a operator
char testForOperator();
#endif // TESTFOROPERATOR

35
src/test/c/test_calculator.c

@ -1,8 +1,9 @@
#ifdef TEST
#include "unity.h"
#include "calculator.h"
#include "main_calculator.h"
#include "testForOperator.h"
#include "testForNumber.h"
#include "programmingMode.h"
void setUp(void)
{
@ -41,25 +42,25 @@ void test_divide(void)
void test_ConMeter(void) {//5 mm to cm
double result = ConMeter(5, 0, 1);
TEST_ASSERT_EQUAL(50, result);
TEST_ASSERT_EQUAL(0.5, result);
}
void test_ConMeterToFoot(void) {//5 m to foot
double result = ConMeterToFoot(5, 0, 1);
double result = ConMeterToFoot(5, 1, 0);
TEST_ASSERT_EQUAL(16.4042, result);
}
void test_ConKilometerToMiles(void) {//5 miles to km
double result = ConKilometerToMiles(5, 0, 1);
TEST_ASSERT_EQUAL(3.10686, result);
TEST_ASSERT_EQUAL(8.04672, result);
}
void test_ConGram(void) {//5 mg to g
double result = ConGram(5, 0, 1);
TEST_ASSERT_EQUAL(5000, result);
TEST_ASSERT_EQUAL(0.005, result);
}
void test_ConGramToPounds(void) {//5 kg to pounds
double result = ConGramToPounds(5, 0, 1);
double result = ConGramToPounds(5, 0, 0);
TEST_ASSERT_EQUAL(11.0231, result);
}
@ -69,17 +70,17 @@ void test_ConTemp(void) {//5 celsius to fahrenheit
}
void test_ConSpeed(void) {//5 kmh to mph
double result = ConTemp(5, 0, 1);
double result = ConSpeed(5, 0, 1);
TEST_ASSERT_EQUAL(3.10686, result);
}
void test_ConLiter(void) {//5 l to ml
double result = ConTemp(5, 1, 0);
double result = ConLiter(5, 1, 0);
TEST_ASSERT_EQUAL(5000, result);
}
void test_ConLiterToGallon(void) {//5 l to gallon
double result = ConTemp(5, 0, 1);
double result = ConLiterToGallon(5, 0, 1);
TEST_ASSERT_EQUAL(1.32086, result);
}
@ -90,22 +91,22 @@ void test_ConData(void) {//5 b to kb
void test_ConArea(void) {//5 mm to cm
double result = ConData(5, 0, 1);
TEST_ASSERT_EQUAL(0.05), result);
TEST_ASSERT_EQUAL(0.05, result);
}
void test_ConVolume(void) {//5 mm to cm
double result = ConData(5, 0, 1);
TEST_ASSERT_EQUAL(0.005), result);
TEST_ASSERT_EQUAL(0.005, result);
}
void test_ConClock(void) {//5:00 to 5AM
double result = ConData(5, 0, 1);
TEST_ASSERT_EQUAL(5), result);
double result = ConClock(5, 0, 1);
TEST_ASSERT_EQUAL(5, result);
}
void test_ConTime(void) {//5 ms to s
double result = ConData(5, 0, 1);
TEST_ASSERT_EQUAL(0.005), result);
TEST_ASSERT_EQUAL(0.005, result);
}
@ -191,5 +192,3 @@ void test_performOperation_Division(void) {
// Assert
TEST_ASSERT_EQUAL_INT(4, result);
}
#endif // TEST

9
target/test/cache/defines_dependency.yml

@ -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

243
target/test/cache/input.yml

@ -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/

502
target/test/cache/test_calculator.c

@ -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);
}

6
target/test/dependencies/cmock.d

@ -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
target/test/dependencies/force_build

2
target/test/dependencies/main_calculator.d

@ -0,0 +1,2 @@
target/test/out/c/main_calculator.o: src/main/c/main_calculator.c \
src/main/c/main_calculator.h

2
target/test/dependencies/programmingMode.d

@ -0,0 +1,2 @@
target/test/out/c/programmingMode.o: src/main/c/programmingMode.c \
src/main/c/programmingMode.h

2
target/test/dependencies/testForNumber.d

@ -0,0 +1,2 @@
target/test/out/c/testForNumber.o: src/main/c/testForNumber.c \
src/main/c/testForNumber.h

2
target/test/dependencies/testForOperator.d

@ -0,0 +1,2 @@
target/test/out/c/testForOperator.o: src/main/c/testForOperator.c \
src/main/c/testForOperator.h

5
target/test/dependencies/test_calculator.d

@ -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

4
target/test/dependencies/test_calculator_runner.d

@ -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

4
target/test/dependencies/unity.d

@ -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

BIN
target/test/out/c/cmock.o

BIN
target/test/out/c/main_calculator.o

BIN
target/test/out/c/programmingMode.o

BIN
target/test/out/c/testForNumber.o

BIN
target/test/out/c/testForOperator.o

BIN
target/test/out/c/test_calculator.o

BIN
target/test/out/c/test_calculator_runner.o

BIN
target/test/out/c/unity.o

BIN
target/test/out/test_calculator.out

502
target/test/preprocess/files/test_calculator.c

@ -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);
}

6
target/test/preprocess/includes/test_calculator.c

@ -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

130
target/test/results/test_calculator.pass

@ -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

137
target/test/runners/test_calculator_runner.c

@ -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();
}
Loading…
Cancel
Save