Browse Source

Test fixed test_checkWinner

remotes/origin/Ariana
fdai7775 11 months ago
parent
commit
57dd871368
  1. 6
      src/main/c/GameTic_Tac_Toe/tictactoe.c
  2. 1
      src/main/c/GameTic_Tac_Toe/tictactoe.h
  3. 3
      test/test_tictactoe.c

6
src/main/c/GameTic_Tac_Toe/tictactoe.c

@ -8,6 +8,12 @@ char currentPlayer = 'X';
const char PLAYER_X = 'X'; const char PLAYER_X = 'X';
const char PLAYER_O = 'O'; const char PLAYER_O = 'O';
void reset_board(){
board[3][3] = {{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'}};
}
// Funktionen zur Anzeige des Spielbretts // Funktionen zur Anzeige des Spielbretts
void displayBoard() { void displayBoard() {
printf("Tic-Tac-Toe\n"); printf("Tic-Tac-Toe\n");

1
src/main/c/GameTic_Tac_Toe/tictactoe.h

@ -9,5 +9,6 @@ void start_tictactoe();
char checkWinner(); char checkWinner();
void makeMove(int choice); void makeMove(int choice);
void displayBoard(); void displayBoard();
void reset_board();
#endif #endif

3
test/test_tictactoe.c

@ -8,6 +8,7 @@ void setUp(void){
//Wenn Funktion Vorraussetzungen braucht //Wenn Funktion Vorraussetzungen braucht
} }
void tearDown(void){ void tearDown(void){
printf("1\n");
} }
@ -65,6 +66,7 @@ void test_checkWinner_vertikalerGewinner(void) {
/* überprüfen */ /* überprüfen */
TEST_ASSERT_EQUAL_CHAR('O', result); TEST_ASSERT_EQUAL_CHAR('O', result);
reset_board();
} }
void test_checkWinner_horizontalerGewinner(void) { void test_checkWinner_horizontalerGewinner(void) {
@ -84,6 +86,7 @@ void test_checkWinner_horizontalerGewinner(void) {
/* überprüfen */ /* überprüfen */
TEST_ASSERT_EQUAL_CHAR('X', result); TEST_ASSERT_EQUAL_CHAR('X', result);
reset_board()
} }
#endif // TEST #endif // TEST
Loading…
Cancel
Save