@ -7,6 +7,13 @@
bool ist_umwandlung_gerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int endY, Player player) {
if((player == PLAYER_WHITE) && (endY == 7) && (Brett[startY][startX] == 'P')){
return true;
}else if((player == PLAYER_BLACK) && (endY == 0) && (Brett[startY][startX] == 'p')){
}else{
return false;
}
@ -4,7 +4,7 @@
#include <stdbool.h>
#include "spieler.h"
bool ist_umwandlung_gerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int endY, Player player);
char bauer_umwandel_abfrage();
void bauer_umwandeln();
@ -0,0 +1,37 @@
#ifdef TEST
#include "unity.h"
#include <stdlib.h>
#include "Schachbrett.h"
#include "Bauer.h"
#include "Bauernumwandlung.h"
void setUp(void) {
void tearDown(void) {
void test_Bauernumwandlung_erlaubt(void) {
char** brett = Schachbrett_erstellen();
int startX = 6;
int startY = 6;
int endX = 6;
int endY = 7;
Player player = PLAYER_WHITE;
TEST_ASSERT_NOT_NULL(brett);
brett[6][6] = 'P';
brett[7][6] = ' ';
TEST_ASSERT_TRUE(ist_umwandlung_gerlaubt_Bauer( brett, startX, startY, endX, endY, player));
for (int i = 0; i < 8; i++) {
free(brett[i]);
free(brett);
#endif // TEST