Browse Source

Bauern abfrage schwarz, Emman Mensdorf

remotes/origin/Läufer-fertig,-Hendrik-Voß
Emman Mensdorf 11 months ago
parent
commit
80971f1b31
  1. 15
      build/artifacts/test/report.xml
  2. 56
      build/test/cache/test_Bauer.c
  3. BIN
      build/test/out/c/Bauer.o
  4. BIN
      build/test/out/c/test_Bauer.o
  5. BIN
      build/test/out/c/test_Bauer_runner.o
  6. BIN
      build/test/out/test_Bauer.out
  7. 56
      build/test/preprocess/files/test_Bauer.c
  8. 14
      build/test/results/test_Bauer.pass
  9. 2
      build/test/results/test_Input.pass
  10. 2
      build/test/results/test_Moving.pass
  11. 2
      build/test/results/test_Schachbrett.pass
  12. 6
      build/test/runners/test_Bauer_runner.c
  13. 24
      src/Bauer.c
  14. 22
      test/test_Bauer.c

15
build/artifacts/test/report.xml

@ -9,27 +9,30 @@
<Name>test/test_Bauer.c::test_Bauer_Schlag_Bewegung</Name>
</Test>
<Test id="3">
<Name>test/test_Bauer.c::test_Bauer_Y_Bewegung</Name>
<Name>test/test_Bauer.c::test_Bauer_Schwarz_Y_Bewegung</Name>
</Test>
<Test id="4">
<Name>test/test_Bauer.c::test_Bauer_Start_Bewegung</Name>
<Name>test/test_Bauer.c::test_Bauer_Y_Bewegung</Name>
</Test>
<Test id="5">
<Name>test/test_Input.c::test_getUserInput</Name>
<Name>test/test_Bauer.c::test_Bauer_Start_Bewegung</Name>
</Test>
<Test id="6">
<Name>test/test_Moving.c::test_Bauern_bewegen</Name>
<Name>test/test_Input.c::test_getUserInput</Name>
</Test>
<Test id="7">
<Name>test/test_Moving.c::test_istzugerlaubt</Name>
<Name>test/test_Moving.c::test_Bauern_bewegen</Name>
</Test>
<Test id="8">
<Name>test/test_Moving.c::test_istzugerlaubt</Name>
</Test>
<Test id="9">
<Name>test/test_Schachbrett.c::test_Schachbrett_erstellen</Name>
</Test>
</SuccessfulTests>
<IgnoredTests/>
<Statistics>
<Tests>8</Tests>
<Tests>9</Tests>
<Ignores>0</Ignores>
<FailuresTotal>0</FailuresTotal>
<Errors>0</Errors>

56
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);

BIN
build/test/out/c/Bauer.o

BIN
build/test/out/c/test_Bauer.o

BIN
build/test/out/c/test_Bauer_runner.o

BIN
build/test/out/test_Bauer.out

56
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);

14
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

2
build/test/results/test_Input.pass

@ -16,4 +16,4 @@
:ignored: 0
:stdout:
- "-> "
:time: 0.025090100010856986
:time: 0.030730400001630187

2
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

2
build/test/results/test_Schachbrett.pass

@ -15,4 +15,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.03429610002785921
:time: 0.02901870000641793

6
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();
}

24
src/Bauer.c

@ -10,6 +10,9 @@ bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int end
//Wichtig extra Funktion EN Passaut
//Wichtig Bauernumwandlung
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')))
{
@ -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;
}
}

22
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) {

Loading…
Cancel
Save