Browse Source

added a test case for the command list creation

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

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

@ -17,6 +17,7 @@ char* getWelcomeMessage();
char* getRulesMessage(); char* getRulesMessage();
struct ticTacToe createTicTacToe(); struct ticTacToe createTicTacToe();
int handleCommand( char* input ); int handleCommand( char* input );
struct command* createCommands();
/* commands */ /* commands */
int startMenu(); int startMenu();

13
src/test/c/Georg/test_tictactoe.c

@ -73,4 +73,17 @@ void test_command_startMenu(void){
// assert // assert
TEST_ASSERT_EQUAL_INT( expectedState, actualState ); TEST_ASSERT_EQUAL_INT( expectedState, actualState );
}
void test_createCommandlist(void){
// arrange
struct command* commands = NULL;
// act
commands = createCommands();
size_t arraySize = sizeof(commands) / sizeof(commands[0]);
for (size_t i = 0; i < arraySize; i++) {
TEST_ASSERT_EQUAL_INT( 1, commands[i].fun() );
}
} }
Loading…
Cancel
Save