diff --git a/build/artifacts/test/report.xml b/build/artifacts/test/report.xml
index a4b9029..a0dddf2 100644
--- a/build/artifacts/test/report.xml
+++ b/build/artifacts/test/report.xml
@@ -9,27 +9,30 @@
test/test_Bauer.c::test_Bauer_Schlag_Bewegung
- test/test_Bauer.c::test_Bauer_Y_Bewegung
+ test/test_Bauer.c::test_Bauer_Schwarz_Y_Bewegung
- test/test_Bauer.c::test_Bauer_Start_Bewegung
+ 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
- 8
+ 9
0
0
0
diff --git a/build/test/cache/test_Bauer.c b/build/test/cache/test_Bauer.c
index 370c05b..e5aebdb 100644
--- a/build/test/cache/test_Bauer.c
+++ b/build/test/cache/test_Bauer.c
@@ -112,6 +112,54 @@ void test_Bauer_Schlag_Bewegung(void) {
+ for (int i = 0; i < 8; i++) {
+
+ free(brett[i]);
+
+ }
+
+ free(brett);
+
+}
+
+
+
+void test_Bauer_Schwarz_Y_Bewegung(void) {
+
+
+
+ char** brett = Schachbrett_erstellen();
+
+ int startX = 1;
+
+ int startY = 6;
+
+ int endX = 1;
+
+ int endY = 5;
+
+ Player player = PLAYER_BLACK;
+
+
+
+
+
+ do {if ((((brett)) !=
+
+ ((void *)0)
+
+ )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(72))));}} while(0);
+
+
+
+
+
+ do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(75)));}} while(0);
+
+
+
+
+
for (int i = 0; i < 8; i++) {
free(brett[i]);
@@ -150,13 +198,13 @@ void test_Bauer_Y_Bewegung(void) {
((void *)0)
- )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(73))));}} while(0);
+ )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(95))));}} while(0);
- do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(76)));}} while(0);
+ do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(98)));}} while(0);
@@ -198,13 +246,13 @@ void test_Bauer_Start_Bewegung(void) {
((void *)0)
- )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(95))));}} while(0);
+ )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(117))));}} while(0);
- do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(98)));}} while(0);
+ do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(120)));}} while(0);
diff --git a/build/test/out/c/Bauer.o b/build/test/out/c/Bauer.o
index 5efc50b..dfc6c8d 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 49cef52..1a09ba8 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 0b00d2c..5731961 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 ebeca7d..9c25875 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 370c05b..e5aebdb 100644
--- a/build/test/preprocess/files/test_Bauer.c
+++ b/build/test/preprocess/files/test_Bauer.c
@@ -112,6 +112,54 @@ void test_Bauer_Schlag_Bewegung(void) {
+ for (int i = 0; i < 8; i++) {
+
+ free(brett[i]);
+
+ }
+
+ free(brett);
+
+}
+
+
+
+void test_Bauer_Schwarz_Y_Bewegung(void) {
+
+
+
+ char** brett = Schachbrett_erstellen();
+
+ int startX = 1;
+
+ int startY = 6;
+
+ int endX = 1;
+
+ int endY = 5;
+
+ Player player = PLAYER_BLACK;
+
+
+
+
+
+ do {if ((((brett)) !=
+
+ ((void *)0)
+
+ )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(72))));}} while(0);
+
+
+
+
+
+ do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(75)));}} while(0);
+
+
+
+
+
for (int i = 0; i < 8; i++) {
free(brett[i]);
@@ -150,13 +198,13 @@ void test_Bauer_Y_Bewegung(void) {
((void *)0)
- )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(73))));}} while(0);
+ )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(95))));}} while(0);
- do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(76)));}} while(0);
+ do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(98)));}} while(0);
@@ -198,13 +246,13 @@ void test_Bauer_Start_Bewegung(void) {
((void *)0)
- )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(95))));}} while(0);
+ )) {} else {UnityFail( (((" Expected Non-NULL"))), (UNITY_UINT)((UNITY_UINT)((UNITY_UINT)(117))));}} while(0);
- do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(98)));}} while(0);
+ do {if ((istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player))) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(120)));}} while(0);
diff --git a/build/test/results/test_Bauer.pass b/build/test/results/test_Bauer.pass
index cd18e6d..dea5703 100644
--- a/build/test/results/test_Bauer.pass
+++ b/build/test/results/test_Bauer.pass
@@ -11,19 +11,23 @@
:line: 36
:message: ''
:unity_test_time: 0
+- :test: test_Bauer_Schwarz_Y_Bewegung
+ :line: 62
+ :message: ''
+ :unity_test_time: 0
- :test: test_Bauer_Y_Bewegung
- :line: 63
+ :line: 85
:message: ''
:unity_test_time: 0
- :test: test_Bauer_Start_Bewegung
- :line: 85
+ :line: 107
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
- :total: 4
- :passed: 4
+ :total: 5
+ :passed: 5
:failed: 0
:ignored: 0
:stdout:
@@ -35,4 +39,4 @@
- " "
- " p p p p p p p p "
- " r n b q k b n r "
-:time: 0.10874160006642342
+:time: 0.17051259998697788
diff --git a/build/test/results/test_Input.pass b/build/test/results/test_Input.pass
index 791a663..e818eca 100644
--- a/build/test/results/test_Input.pass
+++ b/build/test/results/test_Input.pass
@@ -16,4 +16,4 @@
:ignored: 0
:stdout:
- "-> "
-:time: 0.025090100010856986
+:time: 0.030730400001630187
diff --git a/build/test/results/test_Moving.pass b/build/test/results/test_Moving.pass
index 188aa47..e4ff5d5 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.03258749993983656
+:time: 0.02595009992364794
diff --git a/build/test/results/test_Schachbrett.pass b/build/test/results/test_Schachbrett.pass
index 1f4516c..bfd5a2d 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.03429610002785921
+:time: 0.02901870000641793
diff --git a/build/test/runners/test_Bauer_runner.c b/build/test/runners/test_Bauer_runner.c
index ec2e660..a4f83b3 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_Schlag_Bewegung(void);
+extern void test_Bauer_Schwarz_Y_Bewegung(void);
extern void test_Bauer_Y_Bewegung(void);
extern void test_Bauer_Start_Bewegung(void);
@@ -80,8 +81,9 @@ int main(void)
UnityBegin("test_Bauer.c");
run_test(test_Bauer_X_Bewegung, "test_Bauer_X_Bewegung", 14);
run_test(test_Bauer_Schlag_Bewegung, "test_Bauer_Schlag_Bewegung", 36);
- run_test(test_Bauer_Y_Bewegung, "test_Bauer_Y_Bewegung", 63);
- run_test(test_Bauer_Start_Bewegung, "test_Bauer_Start_Bewegung", 85);
+ run_test(test_Bauer_Schwarz_Y_Bewegung, "test_Bauer_Schwarz_Y_Bewegung", 62);
+ run_test(test_Bauer_Y_Bewegung, "test_Bauer_Y_Bewegung", 85);
+ run_test(test_Bauer_Start_Bewegung, "test_Bauer_Start_Bewegung", 107);
return UnityEnd();
}
diff --git a/src/Bauer.c b/src/Bauer.c
index 78d288c..1d545a7 100644
--- a/src/Bauer.c
+++ b/src/Bauer.c
@@ -10,7 +10,10 @@ bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int end
//Wichtig extra Funktion EN Passaut
//Wichtig Bauernumwandlung
-if((startY + 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'p') || (Brett[endY][endX] == 'n') || (Brett[endY][endX] == 'b') ||
+
+if (player == PLAYER_WHITE){
+
+ if((startY + 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'p') || (Brett[endY][endX] == 'n') || (Brett[endY][endX] == 'b') ||
(Brett[endY][endX] == 'q') || (Brett[endY][endX] == 'r')))
{
return true;
@@ -20,12 +23,31 @@ if((startY + 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Br
if(startX != endX){
return false;
}
-if (player == PLAYER_WHITE){
+
if ((startY + 1 ) == endY|| ((startY == 1) && (startY + 2 == endY))){
return true;
}else {
return false;
}
+
+ }
+ else{
+ if((startY - 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'P') || (Brett[endY][endX] == 'N') || (Brett[endY][endX] == 'B') ||
+(Brett[endY][endX] == 'Q') || (Brett[endY][endX] == 'R')))
+{
+ return true;
+}
+
+
+if(startX != endX){
+ return false;
+ }
+
+ if ((startY - 1 ) == endY|| ((startY == 6) && (startY - 2 == endY))){
+ return true;
+ }else {
+ return false;
+ }
}
diff --git a/test/test_Bauer.c b/test/test_Bauer.c
index 7d061e6..567a1e4 100644
--- a/test/test_Bauer.c
+++ b/test/test_Bauer.c
@@ -59,6 +59,28 @@ void test_Bauer_Schlag_Bewegung(void) {
free(brett);
}
+void test_Bauer_Schwarz_Y_Bewegung(void) {
+
+ char** brett = Schachbrett_erstellen();
+ int startX = 1;
+ int startY = 6;
+ int endX = 1;
+ int endY = 5;
+ Player player = PLAYER_BLACK;
+
+
+ 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);
+}
+
void test_Bauer_Y_Bewegung(void) {