From 84c21acaa723411a7a1bbb50c30324c503a1a15e Mon Sep 17 00:00:00 2001 From: KaffeeMaus Date: Fri, 26 Jan 2024 11:34:49 +0100 Subject: [PATCH] modified the command functions for testing purpose --- src/main/c/Georg/tictactoe.c | 14 ++++++++++---- src/main/c/Georg/tictactoe.h | 4 ++-- src/test/c/Georg/test_tictactoe.c | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/c/Georg/tictactoe.c b/src/main/c/Georg/tictactoe.c index 7c09e45..42df92f 100644 --- a/src/main/c/Georg/tictactoe.c +++ b/src/main/c/Georg/tictactoe.c @@ -63,12 +63,18 @@ commandFunction getCommandById( struct command* commands, int id ){ return result; } -int startMenu(){ +int startMenu( int code ){ + if( code == 1 ){ // command test + return 1; + } - return 1; + return 0; } -int startGame(){ +int startGame( int code ){ + if( code == 1 ){ // command test + return 1; + } - return 1; + return 0; } \ No newline at end of file diff --git a/src/main/c/Georg/tictactoe.h b/src/main/c/Georg/tictactoe.h index 19f2f6e..3fa6555 100644 --- a/src/main/c/Georg/tictactoe.h +++ b/src/main/c/Georg/tictactoe.h @@ -22,7 +22,7 @@ struct command* createCommands(); /* commands */ commandFunction getCommandById(struct command* commands, int id); -int startMenu(); -int startGame(); +int startMenu( int code ); +int startGame( int code ); #endif //TICTACTOE_H diff --git a/src/test/c/Georg/test_tictactoe.c b/src/test/c/Georg/test_tictactoe.c index 1842e5a..849ed61 100644 --- a/src/test/c/Georg/test_tictactoe.c +++ b/src/test/c/Georg/test_tictactoe.c @@ -84,7 +84,7 @@ void test_createCommandlist(void){ size_t arraySize = sizeof(*commands) / sizeof(commands[0]); for (size_t i = 0; i < arraySize; i++) { - TEST_ASSERT_EQUAL_INT( 1, commands[i].fun() ); + TEST_ASSERT_EQUAL_INT( 1, commands[i].fun(1) ); } }