static int delete_character(string char) { /* This function will permanently delete a player character. A 1 is returned * on successful character deletion, or a 0 upon failure after setting the * DOGL_ERROR value. */ SYSTEM_CHECK(); return char_d->delete_character(char); }
static int hold_name(string name) { /* If the specified name is validated via validate_new_character_name, it is * placed on hold for the current user's account and a 1 is returned. If it * is not valid, a 0 is returned leaving the DOGL_ERROR value set by the * validate_new_characer_name function in place for the calling process. */ SYSTEM_CHECK(); return char_d->hold_name(name); }
static object login_character(string char) { /* This function will log the specified character into the game, as long as * the calling account owns the character. The character's object will be * returned upon success, or nil upon failure after setting the DOGL_ERROR * value. */ SYSTEM_CHECK(); return char_d->login_character(char); }
static object create_character(string name) { /* This function creates the specified character using the name supplied. If * the name specified is not reserved by the user's account object, no object * will be created or returned and the DOGL_ERROR value will list the specific * problem. Otherwise, the new character is created the relevant variables * are updated appropriately and the new object will be returned. */ SYSTEM_CHECK(); return char_d->create_character(name); }
static int logout_character(int quit, varargs object CHARACTER_OBJECT char) { /* Log out the current character, or if specifed the character object o. * The quit integer is used to indicate what sort of message, if any, should * be sent to the communication channels regarding the character's logout. * A value of 1 means to announce a normal logout, -1 will announce an idle * timeout logout, a 0 will announce a disconnect and any other value will * keep the logout quiet. We return 1 to indicate successful logout as there * may be features that block characters leaving the game world temporarily in * the future. */ SYSTEM_CHECK(); return char_d->logout_character(quit, char); }
int s1( int suite, int weight, int argc, char *argv[] ) { int posCtr = 0; START_SUITE( suite, "Command line tests", weight, NUM_POS_TESTS, NUM_NEG_TESTS ); START_POS_TEST( ++posCtr, "test to check if it doesn't crash" ); SYSTEM_CHECK( "./gpstool -info < a2-suite1-postest1.gps", EXIT_SUCCESS, FAIL_POS_TEST ); PASS_POS_TEST START_POS_TEST( ++posCtr, "Test for valgrind errors" ); SYSTEM_CHECK( "valgrind --leak-check=yes --log-file=a2-suite1-postest2-logfile ./gpstool -info < a2-suite1-postest2.gps", EXIT_SUCCESS, FAIL_POS_TEST ); int status = system( "grep -c 'ERROR SUMMARY: 0 errors from 0 contexts' a2-suite1-postest2-logfile > a2-suite1-postest2-grepcheck" ); if ( status == -1 ) { LOG( "grep failed\n" ); abort(); } FILE * fp2 = fopen( "a2-suite1-postest2-grepcheck", "r" ); int numMatches = 0; if ( fscanf( fp2, "%d", &numMatches ) != 1 ) { LOG( "grep did not return a count\n" ); abort(); } fclose( fp2 ); if ( numMatches != 1 ) { LOG( "Valgrind reported errors\n" ); FAIL_POS_TEST }