Browse Source

Test log

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
9f5c5288f3
  1. 47
      build/test/cache/test_log.c
  2. 4
      build/test/dependencies/test_log.d
  3. 3
      build/test/dependencies/test_log_runner.d
  4. BIN
      build/test/out/c/calculator.o
  5. BIN
      build/test/out/c/test_log.o
  6. BIN
      build/test/out/c/test_log_runner.o
  7. BIN
      build/test/out/test_factorial.out
  8. BIN
      build/test/out/test_log.out
  9. BIN
      build/test/out/test_mod.out
  10. BIN
      build/test/out/test_pow.out
  11. 47
      build/test/preprocess/files/test_log.c
  12. 3
      build/test/preprocess/includes/test_log.c
  13. 2
      build/test/results/test_factorial.pass
  14. 18
      build/test/results/test_log.pass
  15. 2
      build/test/results/test_mod.pass
  16. 2
      build/test/results/test_pow.pass
  17. 81
      build/test/runners/test_log_runner.c
  18. 27
      nano.20128.save
  19. 8
      src/main/c/Calculator/calculator.c
  20. 1
      src/main/c/Calculator/calculator.h
  21. 25
      test/Calculator/test_log.c

47
build/test/cache/test_log.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_log(void){
double result;
double a=4;
result = log(a);
UnityAssertEqualNumber((UNITY_INT)((4)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT);
}

4
build/test/dependencies/test_log.d

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

3
build/test/dependencies/test_log_runner.d

@ -0,0 +1,3 @@
build/test/out/c/test_log_runner.o: build/test/runners/test_log_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_log.o

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

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

47
build/test/preprocess/files/test_log.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_log(void){
double result;
double a=4;
result = log(a);
UnityAssertEqualNumber((UNITY_INT)((4)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT);
}

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

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.0007209489995148033
:time: 0.004361564002465457

18
build/test/results/test_log.pass

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

2
build/test/results/test_mod.pass

@ -15,4 +15,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.0008472290064673871
:time: 0.0026945919962599874

2
build/test/results/test_pow.pass

@ -19,4 +19,4 @@
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.0008012789767235518
:time: 0.0063727759988978505

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

27
nano.20128.save

@ -0,0 +1,27 @@
#ifdef TEST
#include "unity.h"
#include "game100.h"
void setUp(void){
//Wenn Funktion Vorraussetzungen braucht
}
void tearDown(void){
}
void test_log(void){
/* arrange */
int result;
double a = 4;
/* act */
result = log(4);
/* assert */
TEST_ASSERT_EQUAL_INT(4, result);//log(4)= 0.60205991
}
#endif // TEST

8
src/main/c/Calculator/calculator.c

@ -13,7 +13,7 @@ double permutation(int n, int r);
double combination(int n, int r); double combination(int n, int r);
double pow(double num1, double num2); double pow(double num1, double num2);
int mod(int num1,int num2); int mod(int num1,int num2);
double log(num1);
int calculator() { int calculator() {
int choice; int choice;
double num1, num2, result; double num1, num2, result;
@ -89,7 +89,7 @@ int mod(int num1,int num2);
case 6: case 6:
return 0; fmod(num1, num2); return 0; fmod(num1, num2);
case 7: case 7:
return 0;// log(num1);
return 0; log(num1);
case 8: case 8:
return pow(num1, num2); return pow(num1, num2);
case 9: case 9:
@ -162,3 +162,7 @@ int mod(int num1, int num2){
int result = num1%num2; int result = num1%num2;
return result; return result;
} }
double log(double num1){
double result = num1;
return result;
}

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

@ -5,5 +5,6 @@ int calculator();
double pow(double num1, double num2); double pow(double num1, double num2);
double factorial(double num); double factorial(double num);
int mod(int num1, int num2); int mod(int num1, int num2);
double log(double num1);
#endif #endif

25
test/Calculator/test_log.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_log(void){
/* arrange */
double result;
double a=4;
/* act */
result = log(a);
/* assert */
TEST_ASSERT_EQUAL_INT(4, result);//log(4) =0.602059991
}
#endif // TEST
Loading…
Cancel
Save