diff --git a/build/artifacts/test/report.xml b/build/artifacts/test/report.xml index 42e206e..cd3f7bb 100644 --- a/build/artifacts/test/report.xml +++ b/build/artifacts/test/report.xml @@ -6,21 +6,24 @@ test/test_Bauer.c::test_Bauer_X_Bewegung - test/test_Input.c::test_getUserInput + test/test_Bauer.c::test_Bauer_Y_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 - 5 + 6 0 0 0 diff --git a/build/test/cache/test_Bauer.c b/build/test/cache/test_Bauer.c index 0f738c2..6223100 100644 --- a/build/test/cache/test_Bauer.c +++ b/build/test/cache/test_Bauer.c @@ -56,6 +56,56 @@ void test_Bauer_X_Bewegung(void) { + for (int i = 0; i < 8; i++) { + + free(brett[i]); + + } + + free(brett); + +} + + + + + +void test_Bauer_Y_Bewegung(void) { + + + + char** brett = Schachbrett_erstellen(); + + int startX = 1; + + int startY = 1; + + int endX = 1; + + int endY = 2; + + Player player = PLAYER_WHITE; + + + + + + do {if ((((brett)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(47))));}} while(0); + + + + + + do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(50)));}} 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 dc57f63..3d59a9d 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/Moving.o b/build/test/out/c/Moving.o index f1bf744..1473fab 100644 Binary files a/build/test/out/c/Moving.o and b/build/test/out/c/Moving.o differ diff --git a/build/test/out/c/test_Bauer.o b/build/test/out/c/test_Bauer.o index 5eab416..87deebf 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 a905d5b..60e28d5 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/c/test_Moving.o b/build/test/out/c/test_Moving.o index c94846c..c737f4f 100644 Binary files a/build/test/out/c/test_Moving.o and b/build/test/out/c/test_Moving.o differ diff --git a/build/test/out/c/test_Moving_runner.o b/build/test/out/c/test_Moving_runner.o index d7adc2d..788214f 100644 Binary files a/build/test/out/c/test_Moving_runner.o and b/build/test/out/c/test_Moving_runner.o differ diff --git a/build/test/out/test_Bauer.out b/build/test/out/test_Bauer.out index 600373f..cdf759c 100644 Binary files a/build/test/out/test_Bauer.out and b/build/test/out/test_Bauer.out differ diff --git a/build/test/out/test_Moving.out b/build/test/out/test_Moving.out index 600d82c..30630c5 100644 Binary files a/build/test/out/test_Moving.out and b/build/test/out/test_Moving.out differ diff --git a/build/test/preprocess/files/test_Bauer.c b/build/test/preprocess/files/test_Bauer.c index 0f738c2..6223100 100644 --- a/build/test/preprocess/files/test_Bauer.c +++ b/build/test/preprocess/files/test_Bauer.c @@ -56,6 +56,56 @@ void test_Bauer_X_Bewegung(void) { + for (int i = 0; i < 8; i++) { + + free(brett[i]); + + } + + free(brett); + +} + + + + + +void test_Bauer_Y_Bewegung(void) { + + + + char** brett = Schachbrett_erstellen(); + + int startX = 1; + + int startY = 1; + + int endX = 1; + + int endY = 2; + + Player player = PLAYER_WHITE; + + + + + + do {if ((((brett)) != + + ((void *)0) + + )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(47))));}} while(0); + + + + + + do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(50)));}} 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 16e5d1b..9acd7af 100644 --- a/build/test/results/test_Bauer.pass +++ b/build/test/results/test_Bauer.pass @@ -7,12 +7,16 @@ :line: 14 :message: '' :unity_test_time: 0 +- :test: test_Bauer_Y_Bewegung + :line: 37 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 1 - :passed: 1 + :total: 2 + :passed: 2 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.13611029996536672 +:time: 2.4077018999960274 diff --git a/build/test/results/test_Input.pass b/build/test/results/test_Input.pass index e0a7781..5eacd83 100644 --- a/build/test/results/test_Input.pass +++ b/build/test/results/test_Input.pass @@ -16,4 +16,4 @@ :ignored: 0 :stdout: - "-> " -:time: 0.04568029998335987 +:time: 0.2119827000424266 diff --git a/build/test/results/test_Moving.pass b/build/test/results/test_Moving.pass index 33dbf86..d52fec4 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: 0.11075459996936843 +:time: 1.9541468999814242 diff --git a/build/test/results/test_Schachbrett.pass b/build/test/results/test_Schachbrett.pass index b20c394..f992a46 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.038021700049284846 +:time: 0.24673879996407777 diff --git a/build/test/runners/test_Bauer_runner.c b/build/test/runners/test_Bauer_runner.c index bf29a21..b50c8bb 100644 --- a/build/test/runners/test_Bauer_runner.c +++ b/build/test/runners/test_Bauer_runner.c @@ -11,6 +11,7 @@ char* GlobalOrderError; extern void setUp(void); extern void tearDown(void); extern void test_Bauer_X_Bewegung(void); +extern void test_Bauer_Y_Bewegung(void); /*=======Mock Management=====*/ @@ -76,6 +77,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); return UnityEnd(); } diff --git a/src/Bauer.c b/src/Bauer.c index 1c3cade..a2b5407 100644 --- a/src/Bauer.c +++ b/src/Bauer.c @@ -8,11 +8,19 @@ bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int endY, Player player) { //Bauern ZUG und Funktionen //Wichtig extra Funktion EN Passaut - //Wichtig Bauernumwandlung + //Wichtig Bauernumwandlung if(startX != endX){ - return false; + return false; } +if (player == PLAYER_WHITE){ + if ((startY + 1 ) == endY){ + return true; + }else { + return false; + } + } + return true; } diff --git a/test/test_Bauer.c b/test/test_Bauer.c index b417850..a892803 100644 --- a/test/test_Bauer.c +++ b/test/test_Bauer.c @@ -34,4 +34,26 @@ void test_Bauer_X_Bewegung(void) { } +void test_Bauer_Y_Bewegung(void) { + + char** brett = Schachbrett_erstellen(); + int startX = 1; + int startY = 1; + int endX = 1; + int endY = 2; + 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