Browse Source

Test exp2

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
f83f916a81
  1. 51
      build/test/cache/test_exp2.c
  2. 49
      build/test/cache/test_fmin.c
  3. 4
      build/test/dependencies/test_exp2.d
  4. 4
      build/test/dependencies/test_exp2_runner.d
  5. 4
      build/test/dependencies/test_fmin.d
  6. 4
      build/test/dependencies/test_fmin_runner.d
  7. BIN
      build/test/out/c/calculator.o
  8. BIN
      build/test/out/c/test_exp2.o
  9. BIN
      build/test/out/c/test_exp2_runner.o
  10. BIN
      build/test/out/c/test_fmin.o
  11. BIN
      build/test/out/c/test_fmin_runner.o
  12. BIN
      build/test/out/test_cbrt.out
  13. BIN
      build/test/out/test_ceil.out
  14. BIN
      build/test/out/test_divide.out
  15. BIN
      build/test/out/test_exp.out
  16. BIN
      build/test/out/test_exp2.out
  17. BIN
      build/test/out/test_factorial.out
  18. BIN
      build/test/out/test_floor.out
  19. BIN
      build/test/out/test_fmax.out
  20. BIN
      build/test/out/test_fmin.out
  21. BIN
      build/test/out/test_log.out
  22. BIN
      build/test/out/test_log10.out
  23. BIN
      build/test/out/test_mod.out
  24. BIN
      build/test/out/test_pow.out
  25. BIN
      build/test/out/test_round.out
  26. BIN
      build/test/out/test_sin.out
  27. BIN
      build/test/out/test_sqrt.out
  28. BIN
      build/test/out/test_subtract.out
  29. 51
      build/test/preprocess/files/test_exp2.c
  30. 49
      build/test/preprocess/files/test_fmin.c
  31. 3
      build/test/preprocess/includes/test_exp2.c
  32. 3
      build/test/preprocess/includes/test_fmin.c
  33. 2
      build/test/results/test_add.pass
  34. 2
      build/test/results/test_cbrt.pass
  35. 2
      build/test/results/test_ceil.pass
  36. 2
      build/test/results/test_divide.pass
  37. 2
      build/test/results/test_exp.pass
  38. 18
      build/test/results/test_exp2.pass
  39. 2
      build/test/results/test_factorial.pass
  40. 2
      build/test/results/test_floor.pass
  41. 2
      build/test/results/test_fmax.pass
  42. 18
      build/test/results/test_fmin.pass
  43. 2
      build/test/results/test_log.pass
  44. 2
      build/test/results/test_log10.pass
  45. 2
      build/test/results/test_mod.pass
  46. 2
      build/test/results/test_multiply.pass
  47. 2
      build/test/results/test_pow.pass
  48. 2
      build/test/results/test_round.pass
  49. 2
      build/test/results/test_sin.pass
  50. 2
      build/test/results/test_sqrt.pass
  51. 2
      build/test/results/test_subtract.pass
  52. 81
      build/test/runners/test_exp2_runner.c
  53. 81
      build/test/runners/test_fmin_runner.c
  54. 28
      src/main/c/Calculator/calculator.c
  55. 2
      src/main/c/Calculator/calculator.h
  56. 27
      test/Calculator/test_exp2.c
  57. 26
      test/Calculator/test_fmin.c

51
build/test/cache/test_exp2.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_fmin(void){
double num1 =1;
double num2 = 8;
double result;
double min = fmin(1,8);
result = min;
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

49
build/test/cache/test_fmin.c

@ -0,0 +1,49 @@
#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_fmin(void){
double num1;
double num2;
double result = fmin(1,16);
return result;
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT);
}

4
build/test/dependencies/test_exp2.d

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

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

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

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

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

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

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

BIN
build/test/out/test_cbrt.out

BIN
build/test/out/test_ceil.out

BIN
build/test/out/test_divide.out

BIN
build/test/out/test_exp.out

BIN
build/test/out/test_exp2.out

BIN
build/test/out/test_factorial.out

BIN
build/test/out/test_floor.out

BIN
build/test/out/test_fmax.out

BIN
build/test/out/test_fmin.out

BIN
build/test/out/test_log.out

BIN
build/test/out/test_log10.out

BIN
build/test/out/test_mod.out

BIN
build/test/out/test_pow.out

BIN
build/test/out/test_round.out

BIN
build/test/out/test_sin.out

BIN
build/test/out/test_sqrt.out

BIN
build/test/out/test_subtract.out

51
build/test/preprocess/files/test_exp2.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_fmin(void){
double num1 =1;
double num2 = 8;
double result;
double min = fmin(1,8);
result = min;
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
}

49
build/test/preprocess/files/test_fmin.c

@ -0,0 +1,49 @@
#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_fmin(void){
double num1;
double num2;
double result = fmin(1,16);
return result;
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT);
}

3
build/test/preprocess/includes/test_exp2.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_fmin.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.0031575530010741204
:time: 0.00310718099353835

2
build/test/results/test_cbrt.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006589814991457388
:time: 0.0032013720192480832

2
build/test/results/test_ceil.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.00605196098331362
:time: 0.0032484499970450997

2
build/test/results/test_divide.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006208898994373158
:time: 0.0031690610048826784

2
build/test/results/test_exp.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006314277008641511
:time: 0.003156043996568769

18
build/test/results/test_exp2.pass

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

2
build/test/results/test_factorial.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006333274010103196
:time: 0.006395308009814471

2
build/test/results/test_floor.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006300724984612316
:time: 0.0063242810138035566

2
build/test/results/test_fmax.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006286512012593448
:time: 0.006218630995135754

18
build/test/results/test_fmin.pass

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

2
build/test/results/test_log.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.003080766007769853
:time: 0.006288689997745678

2
build/test/results/test_log10.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006343023007502779
:time: 0.006322506000287831

2
build/test/results/test_mod.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006334662000881508
:time: 0.006345372006762773

2
build/test/results/test_multiply.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.004287940013455227
:time: 0.004285867005819455

2
build/test/results/test_pow.pass

@ -19,4 +19,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006217798014404252
:time: 0.006154242000775412

2
build/test/results/test_round.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006286452000495046
:time: 0.006424476014217362

2
build/test/results/test_sin.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006029690994182602
:time: 0.0063063729903660715

2
build/test/results/test_sqrt.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006369120994349942
:time: 0.006311776989605278

2
build/test/results/test_subtract.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.006361763982567936
:time: 0.006199363007908687

81
build/test/runners/test_exp2_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_fmin(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_exp2.c");
run_test(test_fmin, "test_fmin", 13);
return UnityEnd();
}

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

28
src/main/c/Calculator/calculator.c

@ -26,8 +26,8 @@ double floor(double num1);
double round(double num1); double round(double num1);
double fmax(double num1,double num2); double fmax(double num1,double num2);
double log10(double num1); double log10(double num1);
//double exp2(double num1);
double exp2(double num1);
double fmin(double num1, double num2);
int calculator() { int calculator() {
int choice; int choice;
double num1, num2, result; double num1, num2, result;
@ -92,8 +92,8 @@ double log10(double num1);
printf("23. Round\n"); printf("23. Round\n");
printf("24. fmaximum"); printf("24. fmaximum");
printf("25. base 10 logarithm"); printf("25. base 10 logarithm");
// printf("26. 2 raise to the power");
// printf("27 trunc");
printf("26. 2 raise to the power");
printf("27. fminimum");
printf("28. Exit\n"); printf("28. Exit\n");
} }
double performOperation(int choice, double num1, double num2) { double performOperation(int choice, double num1, double num2) {
@ -149,10 +149,10 @@ double log10(double num1);
return 0; fmax(num1,num2); return 0; fmax(num1,num2);
case 25: case 25:
return 0; log10(num1); return 0; log10(num1);
// case 26:
// return 0; exp2(num1);
// case 27:
// return 0; trunc(num1);
case 26:
return 0; exp2(num1);
case 27:
return 0; fmin(num1,num2);
default: default:
return 0.0; return 0.0;
} }
@ -253,13 +253,13 @@ double fmax(double num1 , double num2){
double log10(double num1){ double log10(double num1){
double result = num1; double result = num1;
return result; return result;
}/*
double log10(double num1){
}
double exp2(double num1){
double result = num1; double result = num1;
return result; return result;
} }
double trunc(double num1){
double result = num1;
return result;
double fmin(double num1,double num2){
double minimum = fmin(num1,num2);
return minimum;
} }
*/

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

@ -18,4 +18,6 @@ double floor(double num1);
double round(double num1); double round(double num1);
double fmax(double num1, double num2); double fmax(double num1, double num2);
double log10(double num1); double log10(double num1);
double exp2(double num1);
double fmin(double num1, double num2);
#endif #endif

27
test/Calculator/test_exp2.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_fmin(void){
/* arrange */
double num1 =1;
double num2 = 8;
double result;
double min = fmin(1,8);
/* act */
result = min;
/* assert */
TEST_ASSERT_EQUAL_INT(1,result);//fmin(1,8)=1
}
#endif // TEST

26
test/Calculator/test_fmin.c

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