void load_factor_insert_tests(X* ptr = 0) { insert_test(ptr, 1.0f); insert_test(ptr, 0.1f); insert_test(ptr, 100.0f); insert_test(ptr, (std::numeric_limits<float>::min)()); if(std::numeric_limits<float>::has_infinity) insert_test(ptr, std::numeric_limits<float>::infinity()); }
int main() { conversion_test(); to_view_test(); equal_test(); unequal_test(); less_test(); greater_test(); less_equal_test(); greater_equal_test(); constructor_test(); assignment_test(); assign_test(); plus_equal_test(); append_test(); insert_test(); replace_test(); find_test(); rfind_test(); find_first_of_test(); find_last_of_test(); find_first_not_of_test(); find_last_not_of_test(); compare_test(); return boost::report_errors(); }
int main( ) { int rc = 0; int original_count = heap_count( ); try { if( !construct_test( ) || !heap_ok( "t01" ) ) rc = 1; if( !assign_test( ) || !heap_ok( "t02" ) ) rc = 1; if( !access_test( ) || !heap_ok( "t03" ) ) rc = 1; if( !relational_test( ) || !heap_ok( "t04" ) ) rc = 1; if( !capacity_test( ) || !heap_ok( "t05" ) ) rc = 1; if( !iterator_test( ) || !heap_ok( "t06" ) ) rc = 1; if( !append_test( ) || !heap_ok( "t07" ) ) rc = 1; if( !insert_test( ) || !heap_ok( "t08" ) ) rc = 1; if( !erase_test( ) || !heap_ok( "t09" ) ) rc = 1; if( !replace_test( ) || !heap_ok( "t10" ) ) rc = 1; if( !iterator_replace_test( ) || !heap_ok( "t11" ) ) rc = 1; if( !copy_test( ) || !heap_ok( "t12" ) ) rc = 1; if( !swap_test( ) || !heap_ok( "t13" ) ) rc = 1; if( !cstr_test( ) || !heap_ok( "t14" ) ) rc = 1; if( !find_test( ) || !heap_ok( "t15" ) ) rc = 1; if( !rfind_test( ) || !heap_ok( "t16" ) ) rc = 1; if( !find_first_of_test( ) || !heap_ok( "t17" ) ) rc = 1; if( !find_last_of_test( ) || !heap_ok( "t18" ) ) rc = 1; if( !find_first_not_of_test( ) || !heap_ok( "t19" ) ) rc = 1; if( !find_last_not_of_test( ) || !heap_ok( "t20" ) ) rc = 1; if( !substr_test( ) || !heap_ok( "t21" ) ) rc = 1; } catch( std::out_of_range e ) { std::cout << "Unexpected out_of_range exception: " << e.what( ) << "\n"; rc = 1; } catch( std::length_error e ) { std::cout << "Unexpected length_error exception: " << e.what( ) << "\n"; rc = 1; } catch( ... ) { std::cout << "Unexpected exception of unexpected type.\n"; rc = 1; } if( heap_count( ) != original_count ) { std::cout << "Possible memory leak!\n"; rc = 1; } return( rc ); }
int main(int argc, char **argv) { std::map<std::string, int> m; const char *datafile; const char *queryfile; if(argc > 1) { datafile = argv[1]; } else { datafile = "/usr/share/dict/words"; } if(argc > 2) { queryfile = argv[2]; } else { queryfile = datafile; } std::cout << "Insert test\n"; insert_test(m, datafile); std::cout << "\n\nQuery test\n"; query_test(m, queryfile); return 0; }
/* Testing: binding of data via ct_param */ int main(int argc, char *argv[]) { int errCode = 0; CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_CHAR cmdbuf[4096]; if (argc > 1 && (0 == strcmp(argv[1], "-v"))) verbose = 1; fprintf(stdout, "%s: submit language query with variables using ct_param \n", __FILE__); if (verbose) { fprintf(stdout, "Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *) ex_clientmsg_cb); ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) ex_servermsg_cb); strcpy(cmdbuf, "create table #ctparam_lang (id numeric identity not null, \ name varchar(30), name2 varchar(20), age int, cost money, bdate datetime, fval float) "); ret = run_command(cmd, cmdbuf); if (ret != CS_SUCCEED) { fprintf(stderr, "create table failed\n"); errCode = 1; goto ERR; } /* test by name */ errCode = insert_test(conn, cmd, 1); /* if worked, test by position */ if (0 == errCode) errCode = insert_test(conn, cmd, 0); query = "insert into #ctparam_lang (name,name2,age,cost,bdate,fval) values (?, ?, ?, ?, ?, ?)"; if (0 == errCode) errCode = insert_test(conn, cmd, 0); if (verbose && (0 == errCode)) fprintf(stdout, "lang_ct_param tests successful\n"); ERR: if (verbose) { fprintf(stdout, "Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return errCode; }