Browse Source

Test divide

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
512e9e7b7a
  1. 51
      build/test/cache/test_divide.c
  2. 4
      build/test/dependencies/test_divide.d
  3. 4
      build/test/dependencies/test_divide_runner.d
  4. BIN
      build/test/out/c/calculator.o
  5. BIN
      build/test/out/c/test_divide.o
  6. BIN
      build/test/out/c/test_divide_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. 51
      build/test/preprocess/files/test_divide.c
  15. 3
      build/test/preprocess/includes/test_divide.c
  16. 2
      build/test/results/test_cbrt.pass
  17. 18
      build/test/results/test_divide.pass
  18. 2
      build/test/results/test_factorial.pass
  19. 2
      build/test/results/test_log.pass
  20. 2
      build/test/results/test_mod.pass
  21. 2
      build/test/results/test_multiply.pass
  22. 2
      build/test/results/test_pow.pass
  23. 2
      build/test/results/test_sqrt.pass
  24. 81
      build/test/runners/test_divide_runner.c
  25. 6
      src/main/c/Calculator/calculator.c
  26. 1
      src/main/c/Calculator/calculator.h
  27. 27
      test/Calculator/test_divide.c

51
build/test/cache/test_divide.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_divide(void){
double num1 = 9;
double num2 = 3;
double division = num1 / num2;
double result;
result = division;
UnityAssertEqualNumber((UNITY_INT)((3)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

4
build/test/dependencies/test_divide.d

@ -0,0 +1,4 @@
build/test/out/c/test_divide.o: test/Calculator/test_divide.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_divide_runner.d

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

BIN
build/test/out/c/test_divide_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

51
build/test/preprocess/files/test_divide.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_divide(void){
double num1 = 9;
double num2 = 3;
double division = num1 / num2;
double result;
result = division;
UnityAssertEqualNumber((UNITY_INT)((3)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

3
build/test/preprocess/includes/test_divide.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_cbrt.pass

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

18
build/test/results/test_divide.pass

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

2
build/test/results/test_factorial.pass

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

2
build/test/results/test_log.pass

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

2
build/test/results/test_mod.pass

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

2
build/test/results/test_multiply.pass

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

2
build/test/results/test_pow.pass

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

2
build/test/results/test_sqrt.pass

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

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

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

@ -17,7 +17,7 @@ double log(num1);
double sqrt(double num1); 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);
int calculator() { int calculator() {
@ -184,3 +184,7 @@ int multiply(int num1,int num2){
int product = num1 * num2; int product = num1 * num2;
return product; return product;
} }
double divide(double num1, double num2){
double division = num1 / num2;
return division;
}

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

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

27
test/Calculator/test_divide.c

@ -0,0 +1,27 @@
#ifdef TEST
#include "unity.h"
#include "calculator.h"
void setUp(void){
//Wenn Funktion Vorraussetzungen braucht
}
void tearDown(void){
}
void test_divide(void){
/* arrange */
double num1 = 9;
double num2 = 3;
double division = num1 / num2;
double result;
/* act */
result = division;
/* assert */
TEST_ASSERT_EQUAL_INT(3, result);// 9 / 3 = 3
}
#endif // TEST
Loading…
Cancel
Save