Ulriche Nguefack
11 months ago
23 changed files with 503 additions and 1 deletions
-
47build/test/cache/test_factorial.c
-
79build/test/cache/test_pow.c
-
4build/test/dependencies/test_factorial.d
-
4build/test/dependencies/test_factorial_runner.d
-
4build/test/dependencies/test_pow.d
-
3build/test/dependencies/test_pow_runner.d
-
BINbuild/test/out/c/test_factorial.o
-
BINbuild/test/out/c/test_factorial_runner.o
-
BINbuild/test/out/c/test_pow.o
-
BINbuild/test/out/c/test_pow_runner.o
-
BINbuild/test/out/test_factorial.out
-
BINbuild/test/out/test_pow.out
-
47build/test/preprocess/files/test_factorial.c
-
79build/test/preprocess/files/test_pow.c
-
3build/test/preprocess/includes/test_factorial.c
-
3build/test/preprocess/includes/test_pow.c
-
18build/test/results/test_factorial.pass
-
22build/test/results/test_pow.pass
-
2build/test/results/test_template.pass
-
81build/test/runners/test_factorial_runner.c
-
83build/test/runners/test_pow_runner.c
-
25test/Calculator/test_factorial.c
-
0test/Calculator/test_pow.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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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(); |
|||
} |
@ -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(); |
|||
} |
@ -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 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue