|
|
@ -46,6 +46,7 @@ void test_checkLine_horizontalerGewinner(void) { |
|
|
|
TEST_ASSERT_EQUAL_CHAR('X', result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_isValidMove_gueltigerZug(void) { |
|
|
|
/* arrangieren */ |
|
|
|
int result; |
|
|
@ -57,4 +58,29 @@ void test_isValidMove_gueltigerZug(void) { |
|
|
|
/* überprüfen */ |
|
|
|
TEST_ASSERT_EQUAL_INT(1, result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_checkWinner_vertikalerGewinner(void) { |
|
|
|
/* arrangieren */ |
|
|
|
char result; |
|
|
|
|
|
|
|
// Initialisiere das Spielfeld |
|
|
|
for (int i = 0; i < BOARD_SIZE; i++) { |
|
|
|
for (int j = 0; j < BOARD_SIZE; j++) { |
|
|
|
board[i][j] = (char)('1' + i * BOARD_SIZE + j); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Setze die Daten für einen vertikalen Gewinner |
|
|
|
board[0][0] = 'O'; |
|
|
|
board[1][0] = 'O'; |
|
|
|
board[2][0] = 'O'; |
|
|
|
|
|
|
|
/* handeln */ |
|
|
|
result = checkWinner(); |
|
|
|
|
|
|
|
/* überprüfen */ |
|
|
|
TEST_ASSERT_EQUAL_CHAR('O', result); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |