Browse Source

Unittest feldFrei(freiesFeld)

main
Jannis 2 years ago
parent
commit
6d4ab18a63
  1. 22
      build/test/cache/test_Spiellogik.c
  2. 18
      build/test/cache/test_test.c
  3. BIN
      build/test/out/c/test_Spiellogik.o
  4. BIN
      build/test/out/c/test_Spiellogik_runner.o
  5. BIN
      build/test/out/c/test_test.o
  6. BIN
      build/test/out/c/test_test_runner.o
  7. BIN
      build/test/out/test_Spiellogik.out
  8. BIN
      build/test/out/test_test.out
  9. 22
      build/test/preprocess/files/test_Spiellogik.c
  10. 18
      build/test/preprocess/files/test_test.c
  11. 12
      build/test/results/test_Spiellogik.pass
  12. 12
      build/test/results/test_test.pass
  13. 6
      build/test/runners/test_Spiellogik_runner.c
  14. 30
      build/test/runners/test_test_runner.c
  15. 10
      test/test_Spiellogik.c

22
build/test/cache/test_Spiellogik.c

@ -36,7 +36,7 @@ void test_test1(void){
void test_feldFrei(void){
void test_feldFrei_Verhalten_bei_belegtem_Feld(void){
int realU[20][20]; int realU[20][20];
@ -53,3 +53,23 @@ void test_feldFrei(void){
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT); ), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
} }
void test_feldFrei_Verhalten_bei_freiem_Feld(void){
int realU[20][20];
realU[11][12] = 0;
int result = feldFrei(realU, 11, 12);
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(32), UNITY_DISPLAY_STYLE_INT);
}

18
build/test/cache/test_test.c

@ -21,21 +21,3 @@ void tearDown(void){
} }
void test_test1(void){
int result = probe(2);
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_INT);
}

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

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

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

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

BIN
build/test/out/test_Spiellogik.out

BIN
build/test/out/test_test.out

22
build/test/preprocess/files/test_Spiellogik.c

@ -36,7 +36,7 @@ void test_test1(void){
void test_feldFrei(void){
void test_feldFrei_Verhalten_bei_belegtem_Feld(void){
int realU[20][20]; int realU[20][20];
@ -53,3 +53,23 @@ void test_feldFrei(void){
), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT); ), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT);
} }
void test_feldFrei_Verhalten_bei_freiem_Feld(void){
int realU[20][20];
realU[11][12] = 0;
int result = feldFrei(realU, 11, 12);
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(32), UNITY_DISPLAY_STYLE_INT);
}

18
build/test/preprocess/files/test_test.c

@ -21,21 +21,3 @@ void tearDown(void){
} }
void test_test1(void){
int result = probe(2);
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(19), UNITY_DISPLAY_STYLE_INT);
}

12
build/test/results/test_Spiellogik.pass

@ -7,16 +7,20 @@
:line: 12 :line: 12
:message: '' :message: ''
:unity_test_time: 0 :unity_test_time: 0
- :test: test_feldFrei
- :test: test_feldFrei_Verhalten_bei_belegtem_Feld
:line: 19 :line: 19
:message: '' :message: ''
:unity_test_time: 0 :unity_test_time: 0
- :test: test_feldFrei_Verhalten_bei_freiem_Feld
:line: 27
:message: ''
:unity_test_time: 0
:failures: [] :failures: []
:ignores: [] :ignores: []
:counts: :counts:
:total: 2
:passed: 2
:total: 3
:passed: 3
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.001353542999822821
:time: 0.0033078729993576417

12
build/test/results/test_test.pass

@ -2,17 +2,13 @@
:source: :source:
:path: test :path: test
:file: test_test.c :file: test_test.c
:successes:
- :test: test_test1
:line: 15
:message: ''
:unity_test_time: 0
:successes: []
:failures: [] :failures: []
:ignores: [] :ignores: []
:counts: :counts:
:total: 1
:passed: 1
:total: 0
:passed: 0
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: [] :stdout: []
:time: 0.0018875850000767969
:time: 0.0013589549998869188

6
build/test/runners/test_Spiellogik_runner.c

@ -11,7 +11,8 @@ char* GlobalOrderError;
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_test1(void); extern void test_test1(void);
extern void test_feldFrei(void);
extern void test_feldFrei_Verhalten_bei_belegtem_Feld(void);
extern void test_feldFrei_Verhalten_bei_freiem_Feld(void);
/*=======Mock Management=====*/ /*=======Mock Management=====*/
@ -77,7 +78,8 @@ int main(void)
{ {
UnityBegin("test_Spiellogik.c"); UnityBegin("test_Spiellogik.c");
run_test(test_test1, "test_test1", 12); run_test(test_test1, "test_test1", 12);
run_test(test_feldFrei, "test_feldFrei", 19);
run_test(test_feldFrei_Verhalten_bei_belegtem_Feld, "test_feldFrei_Verhalten_bei_belegtem_Feld", 19);
run_test(test_feldFrei_Verhalten_bei_freiem_Feld, "test_feldFrei_Verhalten_bei_freiem_Feld", 27);
return UnityEnd(); return UnityEnd();
} }

30
build/test/runners/test_test_runner.c

@ -10,7 +10,6 @@ char* GlobalOrderError;
/*=======External Functions This Runner Calls=====*/ /*=======External Functions This Runner Calls=====*/
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_test1(void);
/*=======Mock Management=====*/ /*=======Mock Management=====*/
@ -43,39 +42,10 @@ void verifyTest(void)
CMock_Verify(); 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=====*/ /*=======MAIN=====*/
int main(void) int main(void)
{ {
UnityBegin("test_test.c"); UnityBegin("test_test.c");
run_test(test_test1, "test_test1", 15);
return UnityEnd(); return UnityEnd();
} }

10
test/test_Spiellogik.c

@ -16,10 +16,18 @@ void test_test1(void){
TEST_ASSERT_EQUAL_INT(2, result); TEST_ASSERT_EQUAL_INT(2, result);
} }
void test_feldFrei(void){
void test_feldFrei_Verhalten_bei_belegtem_Feld(void){
int realU[N][N]; int realU[N][N];
realU[11][12] = 1; realU[11][12] = 1;
int result = feldFrei( realU, 11,12); int result = feldFrei( realU, 11,12);
TEST_ASSERT_EQUAL_INT(0 , result); TEST_ASSERT_EQUAL_INT(0 , result);
} }
void test_feldFrei_Verhalten_bei_freiem_Feld(void){
int realU[N][N];
realU[11][12] = 0;
int result = feldFrei(realU, 11, 12);
TEST_ASSERT_EQUAL_INT(1, result);
}
Loading…
Cancel
Save