You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.3 KiB
56 lines
1.3 KiB
#ifdef TEST
|
|
#include "unity.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <assert.h>
|
|
#include "Spieler.h"
|
|
#include "Schachbrett.h"
|
|
#include "Laeufer.h"
|
|
#include "Spielstatus.h"
|
|
|
|
void test_Laeufer_diagonal_Bewegung(void) {
|
|
char** brett = Schachbrett_erstellen();
|
|
Player player = PLAYER_WHITE;
|
|
// Prüfen, ob der Zug eine Diagonale ist == true
|
|
assert(istzugerlaubt_Laeufer(brett, 1, 1, 3, 3, player) == true);
|
|
// Prüfen ob der Zug keine Diagonale ist == false
|
|
assert(istzugerlaubt_Laeufer(brett, 1, 1, 3, 2, player) == false);
|
|
for (int i = 0; i < 8; i++) {
|
|
free(brett[i]);
|
|
}
|
|
free(brett);
|
|
|
|
|
|
}
|
|
void test_Laeufer_input_imFeld(void){
|
|
char** brett = Schachbrett_erstellen();
|
|
Player player = PLAYER_WHITE;
|
|
// Prüfen, ob Zug außerhalb des Bretts liegt
|
|
assert(istzugerlaubt_Laeufer(brett, 1, 1, 8, 8, player) == false);
|
|
for (int i = 0; i < 8; i++) {
|
|
free(brett[i]);
|
|
}
|
|
free(brett);
|
|
|
|
}
|
|
|
|
void test_Laeufer_Weg_frei(void){
|
|
char** brett = Schachbrett_erstellen();
|
|
Player player = PLAYER_WHITE;
|
|
brett[2][2] = 'P';
|
|
assert(istzugerlaubt_Laeufer(brett, 1, 1, 3, 3, player)==false);
|
|
assert(istzugerlaubt_Laeufer(brett, 3, 3, 6, 6, player)==true);
|
|
for (int i = 0; i < 8; i++) {
|
|
free(brett[i]);
|
|
}
|
|
free(brett);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TEST
|