diff --git a/src/main/c/Georg/tictactoe.c b/src/main/c/Georg/tictactoe.c index 7242d8a..614a3e7 100644 --- a/src/main/c/Georg/tictactoe.c +++ b/src/main/c/Georg/tictactoe.c @@ -96,6 +96,14 @@ void initializeBoard( bool board[BORAD_SIZE][BORAD_SIZE] ){ } } +int handleGameInput( char* input ){ + if( strstr(input, "set") != NULL ){ + return 1; + }else{ + return false; + } +} + int startMenu( int code ){ if( code == -1 ){ // command test return 1; diff --git a/src/main/c/Georg/tictactoe.h b/src/main/c/Georg/tictactoe.h index a73cb5e..923fb2e 100644 --- a/src/main/c/Georg/tictactoe.h +++ b/src/main/c/Georg/tictactoe.h @@ -31,6 +31,7 @@ char* getRulesMessageTicTacToe(void); struct ticTacToe createTicTacToe(); int handleCommand( char* input ); void initializeBoard( bool board[3][3] ); +int handleGameInput( char* input ); /* commands */ commandFunction getCommandById(int id); diff --git a/src/test/c/Georg/test_tictactoe.c b/src/test/c/Georg/test_tictactoe.c index 4413a8a..702e4ae 100644 --- a/src/test/c/Georg/test_tictactoe.c +++ b/src/test/c/Georg/test_tictactoe.c @@ -127,3 +127,15 @@ void test_initializeBoard(void){ } } } + +void test_handleGameInput(void){ + // arrange + char* teststring = "set 3,4"; + int expectedState = 1; + + // act + int actualState = handleGameInput( teststring ); + + // assert + TEST_ASSERT_EQUAL_INT( expectedState, actualState ); +}