diff --git a/src/main/c/Georg/tictactoe.h b/src/main/c/Georg/tictactoe.h index 077ef48..19f2f6e 100644 --- a/src/main/c/Georg/tictactoe.h +++ b/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(); diff --git a/src/test/c/Georg/test_tictactoe.c b/src/test/c/Georg/test_tictactoe.c index fa1e452..7e40ecc 100644 --- a/src/test/c/Georg/test_tictactoe.c +++ b/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 ); } \ No newline at end of file