Browse Source

Test subtraction

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
85affba981
  1. 51
      build/test/cache/test_subtract.c
  2. 4
      build/test/dependencies/test_subtract.d
  3. 4
      build/test/dependencies/test_subtract_runner.d
  4. BIN
      build/test/out/c/calculator.o
  5. BIN
      build/test/out/c/test_subtract.o
  6. BIN
      build/test/out/c/test_subtract_runner.o
  7. BIN
      build/test/out/test_cbrt.out
  8. BIN
      build/test/out/test_divide.out
  9. BIN
      build/test/out/test_factorial.out
  10. BIN
      build/test/out/test_log.out
  11. BIN
      build/test/out/test_mod.out
  12. BIN
      build/test/out/test_pow.out
  13. BIN
      build/test/out/test_sqrt.out
  14. BIN
      build/test/out/test_subtract.out
  15. 51
      build/test/preprocess/files/test_subtract.c
  16. 3
      build/test/preprocess/includes/test_subtract.c
  17. 2
      build/test/results/test_add.pass
  18. 2
      build/test/results/test_cbrt.pass
  19. 2
      build/test/results/test_divide.pass
  20. 2
      build/test/results/test_factorial.pass
  21. 2
      build/test/results/test_log.pass
  22. 2
      build/test/results/test_mod.pass
  23. 2
      build/test/results/test_multiply.pass
  24. 2
      build/test/results/test_pow.pass
  25. 2
      build/test/results/test_sqrt.pass
  26. 18
      build/test/results/test_subtract.pass
  27. 81
      build/test/runners/test_subtract_runner.c
  28. 5
      src/main/c/Calculator/calculator.c
  29. 1
      src/main/c/Calculator/calculator.h
  30. 28
      test/Calculator/test_subtract.c

51
build/test/cache/test_subtract.c

@ -0,0 +1,51 @@
#include "src/main/c/Calculator/calculator.h"
#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h"
void setUp(void){
}
void tearDown(void){
}
void test_subtract(void){
int num1 = 14;
int num2 = 7;
int result;
int subtraction = num1 - num2;
result = subtraction;
UnityAssertEqualNumber((UNITY_INT)((7)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

4
build/test/dependencies/test_subtract.d

@ -0,0 +1,4 @@
build/test/out/c/test_subtract.o: test/Calculator/test_subtract.c \
/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \
/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \
src/main/c/Calculator/calculator.h

4
build/test/dependencies/test_subtract_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_subtract_runner.o: \
build/test/runners/test_subtract_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

BIN
build/test/out/c/calculator.o

BIN
build/test/out/c/test_subtract.o

BIN
build/test/out/c/test_subtract_runner.o

BIN
build/test/out/test_cbrt.out

BIN
build/test/out/test_divide.out

BIN
build/test/out/test_factorial.out

BIN
build/test/out/test_log.out

BIN
build/test/out/test_mod.out

BIN
build/test/out/test_pow.out

BIN
build/test/out/test_sqrt.out

BIN
build/test/out/test_subtract.out

51
build/test/preprocess/files/test_subtract.c

@ -0,0 +1,51 @@
#include "src/main/c/Calculator/calculator.h"
#include "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h"
void setUp(void){
}
void tearDown(void){
}
void test_subtract(void){
int num1 = 14;
int num2 = 7;
int result;
int subtraction = num1 - num2;
result = subtraction;
UnityAssertEqualNumber((UNITY_INT)((7)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

3
build/test/preprocess/includes/test_subtract.c

@ -0,0 +1,3 @@
---
- "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h"
- src/main/c/Calculator/calculator.h

2
build/test/results/test_add.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006868249998660758
:time: 0.001341750001301989

2
build/test/results/test_cbrt.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.0062123289972078055
:time: 0.003224601998226717

2
build/test/results/test_divide.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006226740020792931
:time: 0.0032165549928322434

2
build/test/results/test_factorial.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006363478023558855
:time: 0.0032816580205690116

2
build/test/results/test_log.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006499917013570666
:time: 0.003215620992705226

2
build/test/results/test_mod.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.00630686100339517
:time: 0.003226413013180718

2
build/test/results/test_multiply.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.004303659981815144
:time: 0.00324131001252681

2
build/test/results/test_pow.pass

@ -19,4 +19,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006403419014532119
:time: 0.0032054850016720593

2
build/test/results/test_sqrt.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006328894000034779
:time: 0.0031778719858266413

18
build/test/results/test_subtract.pass

@ -0,0 +1,18 @@
---
:source:
:path: test/Calculator
:file: test_subtract.c
:successes:
- :test: test_subtract
:line: 13
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 1
:passed: 1
:failed: 0
:ignored: 0
:stdout: []
:time: 0.006584955001017079

81
build/test/runners/test_subtract_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_subtract(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_subtract.c");
run_test(test_subtract, "test_subtract", 13);
return UnityEnd();
}

5
src/main/c/Calculator/calculator.c

@ -19,6 +19,7 @@ double cbrt(num1);
int multiply (int num1,int num2); int multiply (int num1,int num2);
double divide (double num1, double num2); double divide (double num1, double num2);
int add (int num1, int num2); int add (int num1, int num2);
int subtract(int num1, int num2);
int calculator() { int calculator() {
int choice; int choice;
@ -192,3 +193,7 @@ int add(int num1, int num2){
int addition = num1 + num2; int addition = num1 + num2;
return addition; return addition;
} }
int subtract(int num1, int num2){
int subtraction = num1 - num2;
return subtraction;
}

1
src/main/c/Calculator/calculator.h

@ -11,4 +11,5 @@ double cbrt(double num1);
int multiply(int num1,int num2); int multiply(int num1,int num2);
double divide(double num1,double num2); double divide(double num1,double num2);
int add(int num1 ,int num2); int add(int num1 ,int num2);
int subtract(int num1, int num2);
#endif #endif

28
test/Calculator/test_subtract.c

@ -0,0 +1,28 @@
#ifdef TEST
#include "unity.h"
#include "calculator.h"
void setUp(void){
//Wenn Funktion Vorraussetzungen braucht
}
void tearDown(void){
}
void test_subtract(void){
/* arrange */
int num1 = 14;
int num2 = 7;
int result;
int subtraction = num1 - num2;
/* act */
result = subtraction;
/* assert */
TEST_ASSERT_EQUAL_INT(7, result);// 14 - 7 = 7
}
#endif // TEST
Loading…
Cancel
Save