Browse Source

added a test case for the command by id caller

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

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

@ -21,6 +21,7 @@ int handleCommand( char* input );
struct command* createCommands();
/* commands */
commandFunction getCommandById(struct command* commands, int id);
int startMenu();
int startGame();

12
src/test/c/Georg/test_tictactoe.c

@ -86,4 +86,16 @@ void test_createCommandlist(void){
for (size_t i = 0; i < arraySize; i++) {
TEST_ASSERT_EQUAL_INT( 1, commands[i].fun() );
}
}
void test_callCommandById(void){
// arrange
struct command* commands = NULL;
// act
commands = createCommands();
commandFunction actualCommand = getCommandById( commands, 1);
// assert
TEST_ASSERT_EQUAL_PTR( startMenu, actualCommand );
}
Loading…
Cancel
Save