|
|
#ifdef TEST
#include "unity.h"
#include "Schachbrett.h"
#include "Spieler.h"
#include "Bauer.h"
#include <stdlib.h>
void setUp(void) { }
void tearDown(void) { }
void test_Bauer_X_Bewegung(void) {
char** brett = Schachbrett_erstellen(); int startX = 1; int startY = 1; int endX = 2; int endY = 1; Player player = PLAYER_WHITE;
TEST_ASSERT_NOT_NULL(brett);
TEST_ASSERT_FALSE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player));
for (int i = 0; i < 8; i++) { free(brett[i]); } free(brett); }
void test_Bauer_Schlag_Bewegung(void) {
char** brett = Schachbrett_erstellen(); int startX = 6; int startY = 2; int endX = 5; int endY = 3; Player player = PLAYER_WHITE;
TEST_ASSERT_NOT_NULL(brett); brett[startY][startX] = 'P'; brett[endY][endX] = 'p';
print_Schachfeld(brett);
TEST_ASSERT_FALSE(istzugerlaubt_Bauer( brett, startX, startY, endX, endY, player));
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;
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) {
char** brett = Schachbrett_erstellen(); int startX = 1; int startY = 1; int endX = 1; int endY = 2; Player player = PLAYER_WHITE;
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_Start_Bewegung(void) {
char** brett = Schachbrett_erstellen(); int startX = 2; int startY = 1; int endX = 2; int endY = 3; Player player = PLAYER_WHITE;
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); }
#endif // TEST
|