diff --git a/build/test/cache/test_Spiellogik.c b/build/test/cache/test_Spiellogik.c index 5ce3638..247a06a 100644 --- a/build/test/cache/test_Spiellogik.c +++ b/build/test/cache/test_Spiellogik.c @@ -36,6 +36,32 @@ void test_test1(void){ + + + + + + +void test_win_SchlangegroesseAusreichend(void){ + + int realU[20][20] = {0}; + + realU[15][19] = (20*20)-1; + + int result = win(realU); + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT); + +} + + + void test_feldFrei_Verhalten_bei_belegtem_Feld(void){ int realU[20][20]; @@ -50,7 +76,7 @@ void test_feldFrei_Verhalten_bei_belegtem_Feld(void){ ((void *)0) - ), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT); } @@ -70,7 +96,7 @@ void test_feldFrei_Verhalten_bei_freiem_Feld(void){ ((void *)0) - ), (UNITY_UINT)(32), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(43), UNITY_DISPLAY_STYLE_INT); } @@ -96,7 +122,7 @@ void test_lose_up_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(43), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_INT); } @@ -120,7 +146,7 @@ void test_lose_up_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(53), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(64), UNITY_DISPLAY_STYLE_INT); } @@ -144,7 +170,7 @@ void test_lose_up_Obererrand(void){ ((void *)0) - ), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(74), UNITY_DISPLAY_STYLE_INT); } @@ -168,7 +194,7 @@ void test_lose_down_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(73), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(84), UNITY_DISPLAY_STYLE_INT); } @@ -194,7 +220,7 @@ void test_lose_down_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(84), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(95), UNITY_DISPLAY_STYLE_INT); } @@ -218,7 +244,7 @@ void test_lose_left_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(94), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); } @@ -244,7 +270,7 @@ void test_lose_left_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(116), UNITY_DISPLAY_STYLE_INT); } @@ -268,7 +294,7 @@ void test_lose_left_linkerRand(void){ ((void *)0) - ), (UNITY_UINT)(115), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(126), UNITY_DISPLAY_STYLE_INT); } @@ -292,7 +318,7 @@ void test_lose_right_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(125), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(136), UNITY_DISPLAY_STYLE_INT); } @@ -318,7 +344,7 @@ void test_lose_right_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(136), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(147), UNITY_DISPLAY_STYLE_INT); } @@ -342,6 +368,6 @@ void test_lose_right_rechterRand(void){ ((void *)0) - ), (UNITY_UINT)(146), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(157), UNITY_DISPLAY_STYLE_INT); } diff --git a/build/test/out/c/test_Spiellogik.o b/build/test/out/c/test_Spiellogik.o index adae988..6a63dcf 100644 Binary files a/build/test/out/c/test_Spiellogik.o and b/build/test/out/c/test_Spiellogik.o differ diff --git a/build/test/out/c/test_Spiellogik_runner.o b/build/test/out/c/test_Spiellogik_runner.o index 87299cf..cd825d7 100644 Binary files a/build/test/out/c/test_Spiellogik_runner.o and b/build/test/out/c/test_Spiellogik_runner.o differ diff --git a/build/test/out/test_Spiellogik.out b/build/test/out/test_Spiellogik.out index fc9c9f4..0e78704 100755 Binary files a/build/test/out/test_Spiellogik.out and b/build/test/out/test_Spiellogik.out differ diff --git a/build/test/preprocess/files/test_Spiellogik.c b/build/test/preprocess/files/test_Spiellogik.c index 5ce3638..247a06a 100644 --- a/build/test/preprocess/files/test_Spiellogik.c +++ b/build/test/preprocess/files/test_Spiellogik.c @@ -36,6 +36,32 @@ void test_test1(void){ + + + + + + +void test_win_SchlangegroesseAusreichend(void){ + + int realU[20][20] = {0}; + + realU[15][19] = (20*20)-1; + + int result = win(realU); + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT); + +} + + + void test_feldFrei_Verhalten_bei_belegtem_Feld(void){ int realU[20][20]; @@ -50,7 +76,7 @@ void test_feldFrei_Verhalten_bei_belegtem_Feld(void){ ((void *)0) - ), (UNITY_UINT)(24), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT); } @@ -70,7 +96,7 @@ void test_feldFrei_Verhalten_bei_freiem_Feld(void){ ((void *)0) - ), (UNITY_UINT)(32), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(43), UNITY_DISPLAY_STYLE_INT); } @@ -96,7 +122,7 @@ void test_lose_up_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(43), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(54), UNITY_DISPLAY_STYLE_INT); } @@ -120,7 +146,7 @@ void test_lose_up_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(53), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(64), UNITY_DISPLAY_STYLE_INT); } @@ -144,7 +170,7 @@ void test_lose_up_Obererrand(void){ ((void *)0) - ), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(74), UNITY_DISPLAY_STYLE_INT); } @@ -168,7 +194,7 @@ void test_lose_down_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(73), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(84), UNITY_DISPLAY_STYLE_INT); } @@ -194,7 +220,7 @@ void test_lose_down_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(84), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(95), UNITY_DISPLAY_STYLE_INT); } @@ -218,7 +244,7 @@ void test_lose_left_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(94), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); } @@ -244,7 +270,7 @@ void test_lose_left_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(116), UNITY_DISPLAY_STYLE_INT); } @@ -268,7 +294,7 @@ void test_lose_left_linkerRand(void){ ((void *)0) - ), (UNITY_UINT)(115), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(126), UNITY_DISPLAY_STYLE_INT); } @@ -292,7 +318,7 @@ void test_lose_right_freiesFeld(void){ ((void *)0) - ), (UNITY_UINT)(125), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(136), UNITY_DISPLAY_STYLE_INT); } @@ -318,7 +344,7 @@ void test_lose_right_belegtesFeld(void){ ((void *)0) - ), (UNITY_UINT)(136), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(147), UNITY_DISPLAY_STYLE_INT); } @@ -342,6 +368,6 @@ void test_lose_right_rechterRand(void){ ((void *)0) - ), (UNITY_UINT)(146), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(157), UNITY_DISPLAY_STYLE_INT); } diff --git a/build/test/results/test_Spiellogik.pass b/build/test/results/test_Spiellogik.pass index d5dd92f..e883538 100644 --- a/build/test/results/test_Spiellogik.pass +++ b/build/test/results/test_Spiellogik.pass @@ -7,64 +7,68 @@ :line: 12 :message: '' :unity_test_time: 0 +- :test: test_win_SchlangegroesseAusreichend + :line: 22 + :message: '' + :unity_test_time: 0 - :test: test_feldFrei_Verhalten_bei_belegtem_Feld - :line: 19 + :line: 30 :message: '' :unity_test_time: 0 - :test: test_feldFrei_Verhalten_bei_freiem_Feld - :line: 27 + :line: 38 :message: '' :unity_test_time: 0 - :test: test_lose_up_freiesFeld - :line: 38 + :line: 49 :message: '' :unity_test_time: 0 - :test: test_lose_up_belegtesFeld - :line: 47 + :line: 58 :message: '' :unity_test_time: 0 - :test: test_lose_up_Obererrand - :line: 58 + :line: 69 :message: '' :unity_test_time: 0 - :test: test_lose_down_freiesFeld - :line: 68 + :line: 79 :message: '' :unity_test_time: 0 - :test: test_lose_down_belegtesFeld - :line: 78 + :line: 89 :message: '' :unity_test_time: 0 - :test: test_lose_left_freiesFeld - :line: 89 + :line: 100 :message: '' :unity_test_time: 0 - :test: test_lose_left_belegtesFeld - :line: 99 + :line: 110 :message: '' :unity_test_time: 0 - :test: test_lose_left_linkerRand - :line: 110 + :line: 121 :message: '' :unity_test_time: 0 - :test: test_lose_right_freiesFeld - :line: 120 + :line: 131 :message: '' :unity_test_time: 0 - :test: test_lose_right_belegtesFeld - :line: 130 + :line: 141 :message: '' :unity_test_time: 0 - :test: test_lose_right_rechterRand - :line: 141 + :line: 152 :message: '' :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 14 - :passed: 14 + :total: 15 + :passed: 15 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.000997625000309199 +:time: 0.0010818149985425407 diff --git a/build/test/results/test_Umgebung.pass b/build/test/results/test_Umgebung.pass index 2923dbb..ba7a29b 100644 --- a/build/test/results/test_Umgebung.pass +++ b/build/test/results/test_Umgebung.pass @@ -19,4 +19,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0012777290012309095 +:time: 0.0012024529987684218 diff --git a/build/test/results/test_test.pass b/build/test/results/test_test.pass index c51756b..ab43257 100644 --- a/build/test/results/test_test.pass +++ b/build/test/results/test_test.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0011423740015743533 +:time: 0.001348579000477912 diff --git a/build/test/runners/test_Spiellogik_runner.c b/build/test/runners/test_Spiellogik_runner.c index 4db60cb..1385387 100644 --- a/build/test/runners/test_Spiellogik_runner.c +++ b/build/test/runners/test_Spiellogik_runner.c @@ -11,6 +11,7 @@ char* GlobalOrderError; extern void setUp(void); extern void tearDown(void); extern void test_test1(void); +extern void test_win_SchlangegroesseAusreichend(void); extern void test_feldFrei_Verhalten_bei_belegtem_Feld(void); extern void test_feldFrei_Verhalten_bei_freiem_Feld(void); extern void test_lose_up_freiesFeld(void); @@ -89,19 +90,20 @@ int main(void) { UnityBegin("test_Spiellogik.c"); run_test(test_test1, "test_test1", 12); - 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); - run_test(test_lose_up_freiesFeld, "test_lose_up_freiesFeld", 38); - run_test(test_lose_up_belegtesFeld, "test_lose_up_belegtesFeld", 47); - run_test(test_lose_up_Obererrand, "test_lose_up_Obererrand", 58); - run_test(test_lose_down_freiesFeld, "test_lose_down_freiesFeld", 68); - run_test(test_lose_down_belegtesFeld, "test_lose_down_belegtesFeld", 78); - run_test(test_lose_left_freiesFeld, "test_lose_left_freiesFeld", 89); - run_test(test_lose_left_belegtesFeld, "test_lose_left_belegtesFeld", 99); - run_test(test_lose_left_linkerRand, "test_lose_left_linkerRand", 110); - run_test(test_lose_right_freiesFeld, "test_lose_right_freiesFeld", 120); - run_test(test_lose_right_belegtesFeld, "test_lose_right_belegtesFeld", 130); - run_test(test_lose_right_rechterRand, "test_lose_right_rechterRand", 141); + run_test(test_win_SchlangegroesseAusreichend, "test_win_SchlangegroesseAusreichend", 22); + run_test(test_feldFrei_Verhalten_bei_belegtem_Feld, "test_feldFrei_Verhalten_bei_belegtem_Feld", 30); + run_test(test_feldFrei_Verhalten_bei_freiem_Feld, "test_feldFrei_Verhalten_bei_freiem_Feld", 38); + run_test(test_lose_up_freiesFeld, "test_lose_up_freiesFeld", 49); + run_test(test_lose_up_belegtesFeld, "test_lose_up_belegtesFeld", 58); + run_test(test_lose_up_Obererrand, "test_lose_up_Obererrand", 69); + run_test(test_lose_down_freiesFeld, "test_lose_down_freiesFeld", 79); + run_test(test_lose_down_belegtesFeld, "test_lose_down_belegtesFeld", 89); + run_test(test_lose_left_freiesFeld, "test_lose_left_freiesFeld", 100); + run_test(test_lose_left_belegtesFeld, "test_lose_left_belegtesFeld", 110); + run_test(test_lose_left_linkerRand, "test_lose_left_linkerRand", 121); + run_test(test_lose_right_freiesFeld, "test_lose_right_freiesFeld", 131); + run_test(test_lose_right_belegtesFeld, "test_lose_right_belegtesFeld", 141); + run_test(test_lose_right_rechterRand, "test_lose_right_rechterRand", 152); return UnityEnd(); } diff --git a/src/Spiellogik.h b/src/Spiellogik.h index e676795..9b3120e 100644 --- a/src/Spiellogik.h +++ b/src/Spiellogik.h @@ -4,7 +4,7 @@ #define N 20 int probe(int input); -int win(realU[N][N]); +int win(int realU[N][N]); int feldFrei(int realU[N][N], int ii, int jj); int lose(int realU[N][N], char richtung); diff --git a/test/test_Spiellogik.c b/test/test_Spiellogik.c index a970b52..69a006b 100644 --- a/test/test_Spiellogik.c +++ b/test/test_Spiellogik.c @@ -16,6 +16,17 @@ void test_test1(void){ TEST_ASSERT_EQUAL_INT(2, result); } +//Tests für Funktion win + +//Testet ob die Schlange lang genug ist +void test_win_SchlangegroesseAusreichend(void){ + int realU[N][N] = {0}; + realU[15][19] = (N*N)-1; + int result = win(realU); + + TEST_ASSERT_EQUAL_INT(1, result); +} + void test_feldFrei_Verhalten_bei_belegtem_Feld(void){ int realU[N][N]; realU[11][12] = 1;