Browse Source

Turm X Bewegung hinzugefügt, Luis Hahn

remotes/origin/Läufer-fertig,-Hendrik-Voß
Luis Hahn 11 months ago
parent
commit
4762bc7d12
  1. 7
      src/Turm.c
  2. 23
      test/test_Turm.c

7
src/Turm.c

@ -17,6 +17,13 @@ int counter = 0;
}
}
}else if(startY == endY){
counter = endX-startX;
for(int i = 0; i<counter;i++){
if(Brett[startY][startX+i] != ' '){
return false;
}
}
}
return true;
}

23
test/test_Turm.c

@ -36,7 +36,30 @@ void test_Turm_Y_Bewegung(void) {
free(brett);
}
void test_Turm_X_Bewegung(void) {
char** brett = Schachbrett_erstellen();
int startX = 0;
int startY = 2;
int endX = 4;
int endY = 2;
Player player = PLAYER_WHITE;
TEST_ASSERT_NOT_NULL(brett);
brett[2][0] = 'R';
print_Schachfeld(brett);
TEST_ASSERT_FALSE(istzugerlaubt_Turm( brett, startX, startY, endX, endY, player));
for (int i = 0; i < 8; i++) {
free(brett[i]);
}
free(brett);
}
#endif // TEST

Loading…
Cancel
Save