Browse Source

Test addition

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
f544e45afc
  1. 51
      build/test/cache/test_add.c
  2. 4
      build/test/dependencies/test_add.d
  3. 3
      build/test/dependencies/test_add_runner.d
  4. BIN
      build/test/out/c/calculator.o
  5. BIN
      build/test/out/c/test_add.o
  6. BIN
      build/test/out/c/test_add_runner.o
  7. BIN
      build/test/out/test_add.out
  8. BIN
      build/test/out/test_cbrt.out
  9. BIN
      build/test/out/test_divide.out
  10. BIN
      build/test/out/test_factorial.out
  11. BIN
      build/test/out/test_log.out
  12. BIN
      build/test/out/test_mod.out
  13. BIN
      build/test/out/test_pow.out
  14. BIN
      build/test/out/test_sqrt.out
  15. 51
      build/test/preprocess/files/test_add.c
  16. 3
      build/test/preprocess/includes/test_add.c
  17. 18
      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. 81
      build/test/runners/test_add_runner.c
  27. 6
      src/main/c/Calculator/calculator.c
  28. 1
      src/main/c/Calculator/calculator.h
  29. 28
      test/Calculator/test_add.c

51
build/test/cache/test_add.c

@ -0,0 +1,51 @@
#include "src/main/c/Template/game100.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_add(void){
int num1 = 10;
int num2 = 5;
int result;
int addition = num1 + num2;
result = addition;
UnityAssertEqualNumber((UNITY_INT)((15)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

4
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 \
src/main/c/Template/game100.h

3
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

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

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

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

BIN
build/test/out/test_add.out

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

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

@ -0,0 +1,51 @@
#include "src/main/c/Template/game100.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_add(void){
int num1 = 10;
int num2 = 5;
int result;
int addition = num1 + num2;
result = addition;
UnityAssertEqualNumber((UNITY_INT)((15)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

3
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"
- src/main/c/Template/game100.h

18
build/test/results/test_add.pass

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

2
build/test/results/test_cbrt.pass

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

2
build/test/results/test_divide.pass

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

2
build/test/results/test_factorial.pass

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

2
build/test/results/test_log.pass

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

2
build/test/results/test_mod.pass

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

2
build/test/results/test_multiply.pass

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

2
build/test/results/test_pow.pass

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

2
build/test/results/test_sqrt.pass

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

81
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_add(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_add, "test_add", 13);
return UnityEnd();
}

6
src/main/c/Calculator/calculator.c

@ -18,7 +18,7 @@ double sqrt(double num1);
double cbrt(num1); 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 calculator() { int calculator() {
int choice; int choice;
@ -188,3 +188,7 @@ double divide(double num1, double num2){
double division = num1 / num2; double division = num1 / num2;
return division; return division;
} }
int add(int num1, int num2){
int addition = num1 + num2;
return addition;
}

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

@ -10,4 +10,5 @@ double sqrt(double num1);
double cbrt(double num1); 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);
#endif #endif

28
test/Calculator/test_add.c

@ -0,0 +1,28 @@
#ifdef TEST
#include "unity.h"
#include "game100.h"
void setUp(void){
//Wenn Funktion Vorraussetzungen braucht
}
void tearDown(void){
}
void test_add(void){
/* arrange */
int num1 = 10;
int num2 = 5;
int result;
int addition = num1 + num2;
/* act */
result = addition;
/* assert */
TEST_ASSERT_EQUAL_INT(15, result);// 10 + 5 = 15
}
#endif // TEST
Loading…
Cancel
Save