Browse Source

Turm Y Bewegung, Luis Hahn

remotes/origin/Läufer-fertig,-Hendrik-Voß
Luis Hahn 11 months ago
parent
commit
44ab4924e8
  1. 13
      src/Turm.c
  2. 48
      test/test_Turm.c

13
src/Turm.c

@ -7,6 +7,19 @@
bool istzugerlaubt_Turm(char** Brett, int startX, int startY, int endX, int endY, Player player) { bool istzugerlaubt_Turm(char** Brett, int startX, int startY, int endX, int endY, Player player) {
int counter = 0;
if(startX == startY){
counter = endY-startY;
for(int i = 0; i<counter;i++){
if(Brett[startY+i][startX] == ' '){
}else{
return false;
}
}
}
return true; return true;
} }

48
test/test_Turm.c

@ -0,0 +1,48 @@
#ifdef TEST
#include "unity.h"
#include "Schachbrett.h"
#include "Spieler.h"
#include "Turm.h"
#include <stdlib.h>
void setUp(void) {
}
void tearDown(void) {
}
void test_Turm_Y_Bewegung(void) {
char** brett = Schachbrett_erstellen();
int startX = 0;
int startY = 0;
int endX = 0;
int endY = 3;
Player player = PLAYER_WHITE;
TEST_ASSERT_NOT_NULL(brett);
brett[1][0] = ' ';
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