|
|
@ -34,19 +34,6 @@ void test_if_identical(void){ |
|
|
|
TEST_ASSERT_EQUAL_CHAR(a, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_checkLine_horizontalerGewinner(void) { |
|
|
|
/* arrange */ |
|
|
|
char result; |
|
|
|
char a = 'X', b = 'X', c = 'X'; |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
result = checkLine(a, b, c); |
|
|
|
|
|
|
|
/* überprüfen */ |
|
|
|
TEST_ASSERT_EQUAL_CHAR('X', result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_isValidMove_gueltigerZug(void) { |
|
|
|
/* arrangieren */ |
|
|
|
int result; |
|
|
@ -84,4 +71,28 @@ void test_checkWinner_vertikalerGewinner(void) { |
|
|
|
TEST_ASSERT_EQUAL_CHAR('O', result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_checkWinner_horizontalerGewinner(void) { |
|
|
|
/* arrangieren */ |
|
|
|
char result; |
|
|
|
char board[3][3]; |
|
|
|
|
|
|
|
// 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 horizontalen Gewinner |
|
|
|
board[0][0] = 'X'; |
|
|
|
board[0][1] = 'X'; |
|
|
|
board[0][2] = 'X'; |
|
|
|
|
|
|
|
/* handeln */ |
|
|
|
result = checkWinner(); |
|
|
|
|
|
|
|
/* überprüfen */ |
|
|
|
TEST_ASSERT_EQUAL_CHAR('X', result); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |