Browse Source

refactoring: commandHandler

remotes/origin/georg
KaffeeMaus 11 months ago
parent
commit
f921aaaf1c
  1. 2
      src/main/c/Georg/tictactoe.c
  2. 2
      src/main/c/Georg/tictactoe.h
  3. 4
      src/test/c/Georg/test_tictactoe.c

2
src/main/c/Georg/tictactoe.c

@ -24,7 +24,7 @@ struct ticTacToe createTicTacToe() {
return newGame;
}
int handleState( char* input ){
int handeCommand( char* input ){
if( strcmp(input, "start game") == 0 ){
return 1;
}

2
src/main/c/Georg/tictactoe.h

@ -8,6 +8,6 @@ struct ticTacToe{
char* getWelcomeMessage();
char* getRulesMessage();
struct ticTacToe createTicTacToe();
int handleState( char* input );
int handeCommand( char* input );
#endif //TICTACTOE_H

4
src/test/c/Georg/test_tictactoe.c

@ -51,13 +51,13 @@ void test_initial_state(void){
TEST_ASSERT_EQUAL_INT( expectedState, newGame.currentState );
}
void test_userInput(void){
void test_command_startGame(void){
// arrange
int expectedState = 1;
char* input = "start game";
// act
int actualState = handleState( input );
int actualState = handeCommand( input );
// assert
TEST_ASSERT_EQUAL_INT( expectedState, actualState );
Loading…
Cancel
Save