int main(int argc, char* argv[]) { int i; double* d; list_t l = list_create(); list_test(l, list_push_front, list_pop_front, 45466, 0.001238); list_test(l, list_push_front, list_pop_back, 786723, 0.12078); list_test(l, list_push_back, list_pop_front, 96753, 1.008962); list_test(l, list_push_back, list_pop_back, 2344, 0.12046); srand(time(0)); for (i = 0; i < 5; ++i) { d = (double*)malloc(sizeof(*d)); *d = rand() % 24435 * 0.00431; list_push_back(l, d); } list_circular(l, 5); while (!list_empty(l)) { d = list_pop_back(l); free(d); } list_delete(&l); return 0; }
int main(int argc, char* argv[]) { list_t l = list_create(32); list_test(l, list_push_front, list_pop_front, 4546, 0.05421); list_test(l, list_push_back, list_pop_front, 657656, 0.00234); list_delete(&l); return 0; }
int main() { multi_file_test(); vector_test(); list_test(); deque_test(); adapter_test(); sort_test(); string_test(); return 0; }
/* * Test for the pixel movement. */ int main(int argc, char **argv) { Solarus solarus(argc, argv); basic_test(); loop_test(); syntax_test(); empty_test(); restart_test(); list_test(); return 0; }
int main(int argc, const char * argv[]) { const std::size_t items = 10; std::srand(static_cast<unsigned>(std::time(0))); std::cout << "Vector test" << "\n"; vector_test(items); std::cout << "List test" << "\n"; list_test(items); std::cout << "Mixed test" << "\n"; mixed_test(items); return 0; }
int _tmain(int argc, _TCHAR* argv[]) { //vecAssignTest(); map_test(); vector_member(); set_test(); hash_set_test(); iterator_test2(); example_algorithm(); example_iterator(); list_test(); autoptr_test(); return 0; }
void part_two_describe() { cout<<"******************************************"<<endl; cout<<"* 第二章 C++ STL泛型编程 *"<<endl; cout<<"******************************************"<<endl; cout<<"*(1) 一个简单的测试案例 *"<<endl; cout<<"*(2) vector向量容器 *"<<endl; cout<<"*(3) string基本字符系列容器 *"<<endl; cout<<"*(4) set集合容器 *"<<endl; cout<<"*(5) mutiset多种集合容器 *"<<endl; cout<<"*(6) map映照容器 *"<<endl; cout<<"*(7) mutimap多重映照容器 *"<<endl; cout<<"*(8) deque双端队列容器 *"<<endl; cout<<"*(9) list双向链表容器 *"<<endl; cout<<"*(10)bitset位集合容器 *"<<endl; cout<<"*(11)stack堆栈容器 *"<<endl; cout<<"*(12)queue队列容器 *"<<endl; cout<<"*(13)priority_queue优先队列容器 *"<<endl; cout<<"******************************************"<<endl; cout<<"请输入对应的编号进入相应的题目(返回上级输入0):"<<endl; int num; cin>>num; while(num!=0&&num!=1&&num!=2&&num!=3&&num!=4&&num!=5&&num!=6&&num!=7&&num!=8&&num!=9&&num!=10&&num!=11&&num!=12&&num!=13){ cout<<"编号不存在"<<endl; cout<<"请输入对应的编号进入相应的题目(返回上级输入0):"<<endl; cin>>num; } switch(num){ case 0:total_describe();break; case 1:test();break; case 2:vector_test();break; case 3:string_test();break; case 4:set_test();break; case 5:multiset_test();break; case 6:map_test();break; case 7:multimap_test();break; case 8:deque_test();break; case 9:list_test();break; case 10:bitset_test();break; case 11:stack_test();break; case 12:queue_test();break; case 13:priority_queue_test();break; } }
int main(int argc, char* argv[]) { // timing mechanism clock_t start, before_operation, after_operation, end; start = clock(); // parse the command line arguments if (argc != 5 && argc != 7) { std::cerr << "Error: wrong number of arguments." << std::endl; usage(); } std::string data_structure = argv[1]; std::string operation = argv[2]; std::string input = argv[3]; int input_count = -1; int string_length = -1; std::string output_file; if (input == "random") { assert (argc == 7); input_count = atoi(argv[4]); string_length = atoi(argv[5]); output_file = argv[6]; } else { assert (argc == 5); output_file = argv[4]; } // load the data into a heap-allocated, C-style array std::string *input_data; load_data(input,input_data,input_count,string_length); // prepare space for the answer (at most the same size as the input!) std::string *output_data = new std::string[input_count]; int output_count; // mark the time before we start before_operation = clock(); // perform the operation if (data_structure == "vector") vector_test(input_data,input_count,operation,output_data,output_count); else if (data_structure == "list") list_test(input_data,input_count,operation,output_data,output_count); else if (data_structure == "bst") // STL set or map bst_test(input_data,input_count,operation,output_data,output_count); else if (data_structure == "priority_queue") priority_queue_test(input_data,input_count,operation,output_data,output_count); else if (data_structure == "hash_table") // STL unordered_set or unordered_map hash_table_test(input_data,input_count,operation,output_data,output_count); else { std::cerr << "Error: unknown data structure: " << data_structure << std::endl; usage(); exit(0); } // mark the time once we are done after_operation = clock(); // output the data std::ofstream ostr(output_file.c_str()); for (int i = 0; i < output_count; i++) { ostr << output_data[i] << std::endl; } // cleanup delete [] input_data; delete [] output_data; // print statistics end = clock(); double load_time = double(before_operation-start)/CLOCKS_PER_SEC; double operation_time = double(after_operation-before_operation)/CLOCKS_PER_SEC; double output_time = double(end-after_operation)/CLOCKS_PER_SEC; std::cout << "load time: " << load_time << std::endl; std::cout << "operation time: " << operation_time << std::endl; std::cout << "output time: " << output_time << std::endl; std::cout << "input/output ratio: " << input_count << ":" << output_count << std::endl; return 0; }
int test_inner(void) { pj_caching_pool caching_pool; const char *filename; int line; int rc = 0; mem = &caching_pool.factory; pj_log_set_level(3); pj_log_set_decor(param_log_decor); rc = pj_init(); if (rc != 0) { app_perror("pj_init() error!!", rc); return rc; } //pj_dump_config(); pj_caching_pool_init( &caching_pool, NULL, 0 ); #if INCLUDE_ERRNO_TEST DO_TEST( errno_test() ); #endif #if INCLUDE_EXCEPTION_TEST DO_TEST( exception_test() ); #endif #if INCLUDE_OS_TEST DO_TEST( os_test() ); #endif #if INCLUDE_RAND_TEST DO_TEST( rand_test() ); #endif #if INCLUDE_LIST_TEST DO_TEST( list_test() ); #endif #if INCLUDE_POOL_TEST DO_TEST( pool_test() ); #endif #if INCLUDE_POOL_PERF_TEST DO_TEST( pool_perf_test() ); #endif #if INCLUDE_STRING_TEST DO_TEST( string_test() ); #endif #if INCLUDE_FIFOBUF_TEST DO_TEST( fifobuf_test() ); #endif #if INCLUDE_RBTREE_TEST DO_TEST( rbtree_test() ); #endif #if INCLUDE_HASH_TEST DO_TEST( hash_test() ); #endif #if INCLUDE_TIMESTAMP_TEST DO_TEST( timestamp_test() ); #endif #if INCLUDE_ATOMIC_TEST DO_TEST( atomic_test() ); #endif #if INCLUDE_MUTEX_TEST DO_TEST( mutex_test() ); #endif #if INCLUDE_TIMER_TEST DO_TEST( timer_test() ); #endif #if INCLUDE_SLEEP_TEST DO_TEST( sleep_test() ); #endif #if INCLUDE_THREAD_TEST DO_TEST( thread_test() ); #endif #if INCLUDE_SOCK_TEST DO_TEST( sock_test() ); #endif #if INCLUDE_SOCK_PERF_TEST DO_TEST( sock_perf_test() ); #endif #if INCLUDE_SELECT_TEST DO_TEST( select_test() ); #endif #if INCLUDE_UDP_IOQUEUE_TEST DO_TEST( udp_ioqueue_test() ); #endif #if PJ_HAS_TCP && INCLUDE_TCP_IOQUEUE_TEST DO_TEST( tcp_ioqueue_test() ); #endif #if INCLUDE_IOQUEUE_PERF_TEST DO_TEST( ioqueue_perf_test() ); #endif #if INCLUDE_IOQUEUE_UNREG_TEST DO_TEST( udp_ioqueue_unreg_test() ); #endif #if INCLUDE_ACTIVESOCK_TEST DO_TEST( activesock_test() ); #endif #if INCLUDE_FILE_TEST DO_TEST( file_test() ); #endif #if INCLUDE_SSLSOCK_TEST DO_TEST( ssl_sock_test() ); #endif #if INCLUDE_ECHO_SERVER //echo_server(); //echo_srv_sync(); udp_echo_srv_ioqueue(); #elif INCLUDE_ECHO_CLIENT if (param_echo_sock_type == 0) param_echo_sock_type = pj_SOCK_DGRAM(); echo_client( param_echo_sock_type, param_echo_server, param_echo_port); #endif goto on_return; on_return: pj_caching_pool_destroy( &caching_pool ); PJ_LOG(3,("test", "")); pj_thread_get_stack_info(pj_thread_this(), &filename, &line); PJ_LOG(3,("test", "Stack max usage: %u, deepest: %s:%u", pj_thread_get_stack_max_usage(pj_thread_this()), filename, line)); if (rc == 0) PJ_LOG(3,("test", "Looks like everything is okay!..")); else PJ_LOG(3,("test", "Test completed with error(s)")); pj_shutdown(); return 0; }
int main(int argc, char *argv[]) { return list_test(); }
int main(void) { list_test(); return 0; }
static __init int minit(void) { printk("call %s\n",__FUNCTION__); list_test(); return 0; }