|
@ -2,6 +2,7 @@ |
|
|
#include "unity.h" |
|
|
#include "unity.h" |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include "Historie.h" |
|
|
#include "Historie.h" |
|
|
|
|
|
#include "Spieler.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,7 +35,7 @@ void test_hinzufuegen_historie(void) { |
|
|
int startY = 2; |
|
|
int startY = 2; |
|
|
int endX = 3; |
|
|
int endX = 3; |
|
|
int endY = 4; |
|
|
int endY = 4; |
|
|
Player currentPlayer = {1}; |
|
|
|
|
|
|
|
|
Player currentPlayer = PLAYER_WHITE; |
|
|
int anzahl_Zuege = 0; |
|
|
int anzahl_Zuege = 0; |
|
|
|
|
|
|
|
|
// Züge zur Historie hinzufügen |
|
|
// Züge zur Historie hinzufügen |
|
@ -51,5 +52,37 @@ void test_hinzufuegen_historie(void) { |
|
|
free(meineHistorie[i]); |
|
|
free(meineHistorie[i]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_hinzufuegen_historie_Player_black(void) { |
|
|
|
|
|
int MAX_ZUEGE = 70; |
|
|
|
|
|
int ZUG_INFO = 5; |
|
|
|
|
|
|
|
|
|
|
|
// Historie erstellen |
|
|
|
|
|
int** meineHistorie = erstellen_historie(); |
|
|
|
|
|
|
|
|
|
|
|
// Testdaten |
|
|
|
|
|
int startX = 1; |
|
|
|
|
|
int startY = 1; |
|
|
|
|
|
int endX = 1; |
|
|
|
|
|
int endY = 4; |
|
|
|
|
|
Player currentPlayer = PLAYER_BLACK; |
|
|
|
|
|
int anzahl_Zuege = 0; |
|
|
|
|
|
|
|
|
|
|
|
// Züge zur Historie hinzufügen |
|
|
|
|
|
hinzufuegen_historie(meineHistorie, startX, startY, endX, endY, currentPlayer, anzahl_Zuege); |
|
|
|
|
|
|
|
|
|
|
|
// Überprüfen, ob die Züge korrekt zur Historie hinzugefügt wurden |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(startX, meineHistorie[anzahl_Zuege][0]); |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(startY, meineHistorie[anzahl_Zuege][1]); |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(endX, meineHistorie[anzahl_Zuege][2]); |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(endY, meineHistorie[anzahl_Zuege][3]); |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, meineHistorie[anzahl_Zuege][4]);//1 da Player Black |
|
|
|
|
|
|
|
|
|
|
|
// Speicher freigeben |
|
|
|
|
|
for (int i = 0; i < MAX_ZUEGE; i++) { |
|
|
|
|
|
free(meineHistorie[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
#endif // TEST |
|
|
#endif // TEST |