Browse Source

modified the command functions for testing purpose

remotes/origin/georg
KaffeeMaus 11 months ago
parent
commit
84c21acaa7
  1. 14
      src/main/c/Georg/tictactoe.c
  2. 4
      src/main/c/Georg/tictactoe.h
  3. 2
      src/test/c/Georg/test_tictactoe.c

14
src/main/c/Georg/tictactoe.c

@ -63,12 +63,18 @@ commandFunction getCommandById( struct command* commands, int id ){
return result; 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;
} }

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

@ -22,7 +22,7 @@ struct command* createCommands();
/* commands */ /* commands */
commandFunction getCommandById(struct command* commands, int id); commandFunction getCommandById(struct command* commands, int id);
int startMenu();
int startGame();
int startMenu( int code );
int startGame( int code );
#endif //TICTACTOE_H #endif //TICTACTOE_H

2
src/test/c/Georg/test_tictactoe.c

@ -84,7 +84,7 @@ void test_createCommandlist(void){
size_t arraySize = sizeof(*commands) / sizeof(commands[0]); size_t arraySize = sizeof(*commands) / sizeof(commands[0]);
for (size_t i = 0; i < arraySize; i++) { 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) );
} }
} }

Loading…
Cancel
Save