diff --git a/build/test/cache/test_schach.c b/build/test/cache/test_schach.c index daa4e97..69e491c 100644 --- a/build/test/cache/test_schach.c +++ b/build/test/cache/test_schach.c @@ -46,13 +46,13 @@ void test_print_Schachfeld(void){ - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[0][7])), ( + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[5][0])), ( ((void *)0) ), (UNITY_UINT)(26), UNITY_DISPLAY_STYLE_CHAR); - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[1][0])), ( + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[4][3])), ( ((void *)0) @@ -62,6 +62,42 @@ void test_print_Schachfeld(void){ +void test_print_Schachfeld_Turm(void){ + + + + char expected = 'T'; + + int x = 8; + + int y = 8; + + + + + + char** Spielfeld = create_Schachfeld(x, y); + + + + + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[0][0])), ( + + ((void *)0) + + ), (UNITY_UINT)(40), UNITY_DISPLAY_STYLE_CHAR); + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[0][7])), ( + + ((void *)0) + + ), (UNITY_UINT)(41), UNITY_DISPLAY_STYLE_CHAR); + +} + + + void test_read_input(void) { @@ -116,7 +152,7 @@ void test_read_input(void) { ((void *)0) - ), (UNITY_UINT)(49), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT); diff --git a/build/test/out/c/schach.o b/build/test/out/c/schach.o index eb217f1..adfb845 100644 Binary files a/build/test/out/c/schach.o and b/build/test/out/c/schach.o differ diff --git a/build/test/out/c/test_schach.o b/build/test/out/c/test_schach.o index 93fb978..d27dd18 100644 Binary files a/build/test/out/c/test_schach.o and b/build/test/out/c/test_schach.o differ diff --git a/build/test/out/c/test_schach_runner.o b/build/test/out/c/test_schach_runner.o index f82262b..2cc7649 100644 Binary files a/build/test/out/c/test_schach_runner.o and b/build/test/out/c/test_schach_runner.o differ diff --git a/build/test/out/test_schach.out b/build/test/out/test_schach.out index 9081829..9d907c7 100644 Binary files a/build/test/out/test_schach.out and b/build/test/out/test_schach.out differ diff --git a/build/test/preprocess/files/test_schach.c b/build/test/preprocess/files/test_schach.c index daa4e97..69e491c 100644 --- a/build/test/preprocess/files/test_schach.c +++ b/build/test/preprocess/files/test_schach.c @@ -46,13 +46,13 @@ void test_print_Schachfeld(void){ - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[0][7])), ( + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[5][0])), ( ((void *)0) ), (UNITY_UINT)(26), UNITY_DISPLAY_STYLE_CHAR); - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[1][0])), ( + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[4][3])), ( ((void *)0) @@ -62,6 +62,42 @@ void test_print_Schachfeld(void){ +void test_print_Schachfeld_Turm(void){ + + + + char expected = 'T'; + + int x = 8; + + int y = 8; + + + + + + char** Spielfeld = create_Schachfeld(x, y); + + + + + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[0][0])), ( + + ((void *)0) + + ), (UNITY_UINT)(40), UNITY_DISPLAY_STYLE_CHAR); + + UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((expected)), (UNITY_INT)(UNITY_INT8 )((Spielfeld[0][7])), ( + + ((void *)0) + + ), (UNITY_UINT)(41), UNITY_DISPLAY_STYLE_CHAR); + +} + + + void test_read_input(void) { @@ -116,7 +152,7 @@ void test_read_input(void) { ((void *)0) - ), (UNITY_UINT)(49), UNITY_DISPLAY_STYLE_INT); + ), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT); diff --git a/build/test/results/test_schach.pass b/build/test/results/test_schach.pass index 2d96714..7a19fd3 100644 --- a/build/test/results/test_schach.pass +++ b/build/test/results/test_schach.pass @@ -7,16 +7,20 @@ :line: 16 :message: '' :unity_test_time: 0 -- :test: test_read_input +- :test: test_print_Schachfeld_Turm :line: 30 :message: '' :unity_test_time: 0 +- :test: test_read_input + :line: 44 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 2 - :passed: 2 + :total: 3 + :passed: 3 :failed: 0 :ignored: 0 :stdout: [] -:time: 1.9844588999985717 +:time: 0.14233430003514513 diff --git a/build/test/runners/test_schach_runner.c b/build/test/runners/test_schach_runner.c index a6f58a7..d271d71 100644 --- a/build/test/runners/test_schach_runner.c +++ b/build/test/runners/test_schach_runner.c @@ -11,6 +11,7 @@ char* GlobalOrderError; extern void setUp(void); extern void tearDown(void); extern void test_print_Schachfeld(void); +extern void test_print_Schachfeld_Turm(void); extern void test_read_input(void); @@ -77,7 +78,8 @@ int main(void) { UnityBegin("test_schach.c"); run_test(test_print_Schachfeld, "test_print_Schachfeld", 16); - run_test(test_read_input, "test_read_input", 30); + run_test(test_print_Schachfeld_Turm, "test_print_Schachfeld_Turm", 30); + run_test(test_read_input, "test_read_input", 44); return UnityEnd(); } diff --git a/src/schach.c b/src/schach.c index a82fa23..9d1ece2 100644 --- a/src/schach.c +++ b/src/schach.c @@ -20,6 +20,7 @@ Programmablauf: 1.Spielfeld in der create_Schachfeld erstellen + 1.1 Schachfeld füllen 2.Spielfeld anzeigen mit print_Schachfeld 3.Eingabe mit choose_Figur 3.1 erst x dann y @@ -42,6 +43,8 @@ int checkmate(){ return 0; } + + int read_input(){ int koordinate = 0; @@ -53,7 +56,7 @@ int read_input(){ } else{ - + read_input(); } @@ -97,6 +100,25 @@ char** create_Schachfeld(int x, int y) { } } } + + Spielfeld[0][0] = 'T'; //Turm Weiß + Spielfeld[0][1] = 'P'; //Pferd Weiß + Spielfeld[0][2] = 'L'; //Laufer Weiß + Spielfeld[0][3] = 'D'; //Dame Weiß + Spielfeld[0][4] = 'K'; //König Weiß + Spielfeld[0][5] = 'L'; + Spielfeld[0][6] = 'P'; + Spielfeld[0][7] = 'T'; + + Spielfeld[7][0] = 't'; //Turm Schwarz + Spielfeld[7][1] = 'p'; + Spielfeld[7][2] = 'l'; + Spielfeld[7][3] = 'd'; + Spielfeld[7][4] = 'k'; + Spielfeld[7][5] = 'l'; + Spielfeld[7][6] = 'p'; + Spielfeld[7][7] = 't'; + return Spielfeld; } diff --git a/test/test_schach.c b/test/test_schach.c index 5e3489e..4e21771 100644 --- a/test/test_schach.c +++ b/test/test_schach.c @@ -23,8 +23,22 @@ void test_print_Schachfeld(void){ char** Spielfeld = create_Schachfeld(x, y); /* assert */ + TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[5][0]); + TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[4][3]); +} + +void test_print_Schachfeld_Turm(void){ + /* arrange */ + char expected = 'T'; + int x = 8; + int y = 8; + + /* act */ + char** Spielfeld = create_Schachfeld(x, y); + + /* assert */ + TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[0][0]); TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[0][7]); - TEST_ASSERT_EQUAL_CHAR(expected,Spielfeld[1][0]); } void test_read_input(void) {