Browse Source

Test factorial

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
1b48e691ef
  1. 47
      build/test/cache/test_factorial.c
  2. 79
      build/test/cache/test_pow.c
  3. 4
      build/test/dependencies/test_factorial.d
  4. 4
      build/test/dependencies/test_factorial_runner.d
  5. 4
      build/test/dependencies/test_pow.d
  6. 3
      build/test/dependencies/test_pow_runner.d
  7. BIN
      build/test/out/c/test_factorial.o
  8. BIN
      build/test/out/c/test_factorial_runner.o
  9. BIN
      build/test/out/c/test_pow.o
  10. BIN
      build/test/out/c/test_pow_runner.o
  11. BIN
      build/test/out/test_factorial.out
  12. BIN
      build/test/out/test_pow.out
  13. 47
      build/test/preprocess/files/test_factorial.c
  14. 79
      build/test/preprocess/files/test_pow.c
  15. 3
      build/test/preprocess/includes/test_factorial.c
  16. 3
      build/test/preprocess/includes/test_pow.c
  17. 18
      build/test/results/test_factorial.pass
  18. 22
      build/test/results/test_pow.pass
  19. 2
      build/test/results/test_template.pass
  20. 81
      build/test/runners/test_factorial_runner.c
  21. 83
      build/test/runners/test_pow_runner.c
  22. 25
      test/Calculator/test_factorial.c
  23. 0
      test/Calculator/test_pow.c

47
build/test/cache/test_factorial.c

@ -0,0 +1,47 @@
#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_factorial_4(void){
double result;
double a = 4;
result = factorial(a);
UnityAssertEqualNumber((UNITY_INT)((24)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT);
}

79
build/test/cache/test_pow.c

@ -0,0 +1,79 @@
#include "build/temp/../../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_pow_N_N(void){
double result;
double b = 3;
double a = 3;
result = pow(a, b);
UnityAssertEqualNumber((UNITY_INT)((27)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT);
}
void test_pow_Z_N(void){
double result;
double b = 3;
double a = -3;
result = pow(a, b);
UnityAssertEqualNumber((UNITY_INT)((-27)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(36), UNITY_DISPLAY_STYLE_INT);
}

4
build/test/dependencies/test_factorial.d

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

@ -0,0 +1,4 @@
build/test/out/c/test_factorial_runner.o: \
build/test/runners/test_factorial_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
build/test/dependencies/test_pow.d

@ -0,0 +1,4 @@
build/test/out/c/test_pow.o: test/Calculator/test_pow.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 \
test/Calculator/../../src/main/c/Calculator/calculator.h

3
build/test/dependencies/test_pow_runner.d

@ -0,0 +1,3 @@
build/test/out/c/test_pow_runner.o: build/test/runners/test_pow_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/test_factorial.o

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

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

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

BIN
build/test/out/test_factorial.out

BIN
build/test/out/test_pow.out

47
build/test/preprocess/files/test_factorial.c

@ -0,0 +1,47 @@
#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_factorial_4(void){
double result;
double a = 4;
result = factorial(a);
UnityAssertEqualNumber((UNITY_INT)((24)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT);
}

79
build/test/preprocess/files/test_pow.c

@ -0,0 +1,79 @@
#include "build/temp/../../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_pow_N_N(void){
double result;
double b = 3;
double a = 3;
result = pow(a, b);
UnityAssertEqualNumber((UNITY_INT)((27)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT);
}
void test_pow_Z_N(void){
double result;
double b = 3;
double a = -3;
result = pow(a, b);
UnityAssertEqualNumber((UNITY_INT)((-27)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(36), UNITY_DISPLAY_STYLE_INT);
}

3
build/test/preprocess/includes/test_factorial.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

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

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

18
build/test/results/test_factorial.pass

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

22
build/test/results/test_pow.pass

@ -0,0 +1,22 @@
---
:source:
:path: test/Calculator
:file: test_pow.c
:successes:
- :test: test_pow_N_N
:line: 13
:message: ''
:unity_test_time: 0
- :test: test_pow_Z_N
:line: 26
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 2
:passed: 2
:failed: 0
:ignored: 0
:stdout: []
:time: 0.0062921050121076405

2
build/test/results/test_template.pass

@ -19,4 +19,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.004427945998031646
:time: 0.002953332004835829

81
build/test/runners/test_factorial_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_factorial_4(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_factorial.c");
run_test(test_factorial_4, "test_factorial_4", 13);
return UnityEnd();
}

83
build/test/runners/test_pow_runner.c

@ -0,0 +1,83 @@
/* 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_pow_N_N(void);
extern void test_pow_Z_N(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_pow.c");
run_test(test_pow_N_N, "test_pow_N_N", 13);
run_test(test_pow_Z_N, "test_pow_Z_N", 26);
return UnityEnd();
}

25
test/Calculator/test_factorial.c

@ -0,0 +1,25 @@
#ifdef TEST
#include "unity.h"
#include "calculator.h"
void setUp(void){
//Wenn Funktion Vorraussetzungen braucht
}
void tearDown(void){
}
void test_factorial_4(void){
/* arrange */
double result;
double a = 4;
/* act */
result = factorial(a);
/* assert */
TEST_ASSERT_EQUAL_INT(24, result);//1 * 2 * 3 * 4 = 24
}
#endif

0
test/Calculator/test_add.c → test/Calculator/test_pow.c

Loading…
Cancel
Save