Browse Source

Fix Unittest

main
Jannis 2 years ago
parent
commit
0bda322678
  1. 3
      .vscode/settings.json
  2. 2
      build/test/cache/defines_dependency.yml
  3. 61
      build/test/cache/test_Umgebung.c
  4. 1
      build/test/dependencies/Umgebung.d
  5. 4
      build/test/dependencies/test_Umgebung.d
  6. 4
      build/test/dependencies/test_Umgebung_runner.d
  7. BIN
      build/test/out/c/Umgebung.o
  8. BIN
      build/test/out/c/test_Umgebung.o
  9. BIN
      build/test/out/c/test_Umgebung_runner.o
  10. BIN
      build/test/out/test_Umgebung.out
  11. 61
      build/test/preprocess/files/test_Umgebung.c
  12. 3
      build/test/preprocess/includes/test_Umgebung.c
  13. 2
      build/test/results/test_Spiellogik.pass
  14. 22
      build/test/results/test_Umgebung.pass
  15. 2
      build/test/results/test_test.pass
  16. 83
      build/test/runners/test_Umgebung_runner.c
  17. 7
      src/Umgebung.c
  18. 1
      test/test_Umgebung.c

3
.vscode/settings.json

@ -0,0 +1,3 @@
{
"C_Cpp.errorSquiggles": "disabled"
}

2
build/test/cache/defines_dependency.yml

@ -5,3 +5,5 @@ src/probe.c:
- TEST
src/Spiellogik.c:
- TEST
src/Umgebung.c:
- TEST

61
build/test/cache/test_Umgebung.c

@ -0,0 +1,61 @@
#include "src/Umgebung.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_Umgebung_RealU(void){
int realU[20][20];
realU[14][15] = 0;
int result = RealU(realU);
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(17), UNITY_DISPLAY_STYLE_INT);
}
void test_Umgebung_delay(void){
int result = delay(2);
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT);
}

1
build/test/dependencies/Umgebung.d

@ -0,0 +1 @@
build/test/out/c/Umgebung.o: src/Umgebung.c

4
build/test/dependencies/test_Umgebung.d

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

4
build/test/dependencies/test_Umgebung_runner.d

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

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

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

BIN
build/test/out/test_Umgebung.out

61
build/test/preprocess/files/test_Umgebung.c

@ -0,0 +1,61 @@
#include "src/Umgebung.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_Umgebung_RealU(void){
int realU[20][20];
realU[14][15] = 0;
int result = RealU(realU);
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(17), UNITY_DISPLAY_STYLE_INT);
}
void test_Umgebung_delay(void){
int result = delay(2);
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT);
}

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

@ -0,0 +1,3 @@
---
- "/var/lib/gems/3.0.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h"
- src/Umgebung.h

2
build/test/results/test_Spiellogik.pass

@ -23,4 +23,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.0022634060005657375
:time: 0.0010967800003527373

22
build/test/results/test_Umgebung.pass

@ -0,0 +1,22 @@
---
:source:
:path: test
:file: test_Umgebung.c
:successes:
- :test: test_Umgebung_RealU
:line: 11
:message: ''
:unity_test_time: 0
- :test: test_Umgebung_delay
:line: 21
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 2
:passed: 2
:failed: 0
:ignored: 0
:stdout: []
:time: 0.0011177370001860254

2
build/test/results/test_test.pass

@ -15,4 +15,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.0015701629999966826
:time: 0.0012317610003265145

83
build/test/runners/test_Umgebung_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_Umgebung_RealU(void);
extern void test_Umgebung_delay(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_Umgebung.c");
run_test(test_Umgebung_RealU, "test_Umgebung_RealU", 11);
run_test(test_Umgebung_delay, "test_Umgebung_delay", 21);
return UnityEnd();
}

7
src/Umgebung.c

@ -17,6 +17,9 @@ void Score(int score);
void Apfel(int realU[N][N]);
void Umgebung(int str[N][N]);
int delay(int ms); //in the first step it remains constant
/*
Unittest funktioniert nicht wenn Dateien mit einer main Methode aufgerufen werden
int main(){
srand(time(0));// damit wir ein Zufallszahl haben.
@ -42,8 +45,8 @@ int main(){
printf("Score: %d\n", score);
}*/
re 0;
}
// re 0;
//}
void Anweisung(char s[N]){

1
test/test_Umgebung.c

@ -1,5 +1,4 @@
#include "unity.h"
#include "cmock.h"
#include <Umgebung.h>
#include <stdlib.h>
void setUp(void)

Loading…
Cancel
Save