diff --git a/build/artifacts/test/report.xml b/build/artifacts/test/report.xml index cd3f7bb..16fbe75 100644 --- a/build/artifacts/test/report.xml +++ b/build/artifacts/test/report.xml @@ -9,21 +9,24 @@ test/test_Bauer.c::test_Bauer_Y_Bewegung - test/test_Input.c::test_getUserInput + test/test_Bauer.c::test_Bauer_Start_Bewegung - test/test_Moving.c::test_Bauern_bewegen + test/test_Input.c::test_getUserInput - test/test_Moving.c::test_istzugerlaubt + test/test_Moving.c::test_Bauern_bewegen + test/test_Moving.c::test_istzugerlaubt + + test/test_Schachbrett.c::test_Schachbrett_erstellen - 6 + 7 0 0 0 diff --git a/build/test/cache/test_Bauer.c b/build/test/cache/test_Bauer.c index 6223100..0a83a79 100644 --- a/build/test/cache/test_Bauer.c +++ b/build/test/cache/test_Bauer.c @@ -106,6 +106,54 @@ void test_Bauer_Y_Bewegung(void) { + for (int i = 0; i < 8; i++) { + + free(brett[i]); + + } + + free(brett); + +} + + + +void test_Bauer_Start_Bewegung(void) { + + + + char** brett = Schachbrett_erstellen(); + + int startX = 2; + + int startY = 1; + + int endX = 2; + + int endY = 3; + + Player player = PLAYER_WHITE; + + + + + + do {if ((((brett)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(69))));}} while(0); + + + + + + do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(72)));}} while(0); + + + + + for (int i = 0; i < 8; i++) { free(brett[i]); diff --git a/build/test/out/c/Bauer.o b/build/test/out/c/Bauer.o index 3d59a9d..086ac98 100644 Binary files a/build/test/out/c/Bauer.o and b/build/test/out/c/Bauer.o differ diff --git a/build/test/out/c/test_Bauer.o b/build/test/out/c/test_Bauer.o index 87deebf..6f980a0 100644 Binary files a/build/test/out/c/test_Bauer.o and b/build/test/out/c/test_Bauer.o differ diff --git a/build/test/out/c/test_Bauer_runner.o b/build/test/out/c/test_Bauer_runner.o index 60e28d5..75a6533 100644 Binary files a/build/test/out/c/test_Bauer_runner.o and b/build/test/out/c/test_Bauer_runner.o differ diff --git a/build/test/out/test_Bauer.out b/build/test/out/test_Bauer.out index cdf759c..89bd190 100644 Binary files a/build/test/out/test_Bauer.out and b/build/test/out/test_Bauer.out differ diff --git a/build/test/preprocess/files/test_Bauer.c b/build/test/preprocess/files/test_Bauer.c index 6223100..0a83a79 100644 --- a/build/test/preprocess/files/test_Bauer.c +++ b/build/test/preprocess/files/test_Bauer.c @@ -106,6 +106,54 @@ void test_Bauer_Y_Bewegung(void) { + for (int i = 0; i < 8; i++) { + + free(brett[i]); + + } + + free(brett); + +} + + + +void test_Bauer_Start_Bewegung(void) { + + + + char** brett = Schachbrett_erstellen(); + + int startX = 2; + + int startY = 1; + + int endX = 2; + + int endY = 3; + + Player player = PLAYER_WHITE; + + + + + + do {if ((((brett)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(69))));}} while(0); + + + + + + do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(72)));}} while(0); + + + + + for (int i = 0; i < 8; i++) { free(brett[i]); diff --git a/build/test/results/test_Bauer.pass b/build/test/results/test_Bauer.pass index 9acd7af..17e6903 100644 --- a/build/test/results/test_Bauer.pass +++ b/build/test/results/test_Bauer.pass @@ -11,12 +11,16 @@ :line: 37 :message: '' :unity_test_time: 0 +- :test: test_Bauer_Start_Bewegung + :line: 59 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 2 - :passed: 2 + :total: 3 + :passed: 3 :failed: 0 :ignored: 0 :stdout: [] -:time: 2.4077018999960274 +:time: 1.2243709999602288 diff --git a/build/test/results/test_Input.pass b/build/test/results/test_Input.pass index 5eacd83..e05cdc5 100644 --- a/build/test/results/test_Input.pass +++ b/build/test/results/test_Input.pass @@ -16,4 +16,4 @@ :ignored: 0 :stdout: - "-> " -:time: 0.2119827000424266 +:time: 0.05332690000068396 diff --git a/build/test/results/test_Moving.pass b/build/test/results/test_Moving.pass index d52fec4..2038a96 100644 --- a/build/test/results/test_Moving.pass +++ b/build/test/results/test_Moving.pass @@ -27,4 +27,4 @@ - " " - " p p p p p p p p " - " r n b q k b n r " -:time: 1.9541468999814242 +:time: 1.424722700030543 diff --git a/build/test/results/test_Schachbrett.pass b/build/test/results/test_Schachbrett.pass index f992a46..5fa9bce 100644 --- a/build/test/results/test_Schachbrett.pass +++ b/build/test/results/test_Schachbrett.pass @@ -15,4 +15,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.24673879996407777 +:time: 0.06810659996699542 diff --git a/build/test/runners/test_Bauer_runner.c b/build/test/runners/test_Bauer_runner.c index b50c8bb..814e7e6 100644 --- a/build/test/runners/test_Bauer_runner.c +++ b/build/test/runners/test_Bauer_runner.c @@ -12,6 +12,7 @@ extern void setUp(void); extern void tearDown(void); extern void test_Bauer_X_Bewegung(void); extern void test_Bauer_Y_Bewegung(void); +extern void test_Bauer_Start_Bewegung(void); /*=======Mock Management=====*/ @@ -78,6 +79,7 @@ int main(void) UnityBegin("test_Bauer.c"); run_test(test_Bauer_X_Bewegung, "test_Bauer_X_Bewegung", 14); run_test(test_Bauer_Y_Bewegung, "test_Bauer_Y_Bewegung", 37); + run_test(test_Bauer_Start_Bewegung, "test_Bauer_Start_Bewegung", 59); return UnityEnd(); } diff --git a/src/Bauer.c b/src/Bauer.c index a2b5407..09a9698 100644 --- a/src/Bauer.c +++ b/src/Bauer.c @@ -14,7 +14,7 @@ if(startX != endX){ return false; } if (player == PLAYER_WHITE){ - if ((startY + 1 ) == endY){ + if ((startY + 1 ) == endY|| ((startY == 1) && (startY + 2 == endY))){ return true; }else { return false; diff --git a/test/test_Bauer.c b/test/test_Bauer.c index a892803..f0fb146 100644 --- a/test/test_Bauer.c +++ b/test/test_Bauer.c @@ -56,4 +56,26 @@ void test_Bauer_Y_Bewegung(void) { free(brett); } +void test_Bauer_Start_Bewegung(void) { + + char** brett = Schachbrett_erstellen(); + int startX = 2; + int startY = 1; + int endX = 2; + int endY = 3; + Player player = PLAYER_WHITE; + + + TEST_ASSERT_NOT_NULL(brett); + + + TEST_ASSERT_TRUE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player)); + + + for (int i = 0; i < 8; i++) { + free(brett[i]); + } + free(brett); +} + #endif // TEST