int main() { test_algo(); test_hook(); test_tree(); // int x = *((int*)0); // ralgo::rebalance_after_erasure(&header, 0, &n5); return 0; }
int _STLP_CALL main(int argc, char** argv) { #if defined(_WIN32_WCE) || defined(__SYMBIAN32__) std::ofstream file( "c:\\eh_test.txt" ); std::streambuf* old_cout_buf = cout.rdbuf(file.rdbuf()); std::streambuf* old_cerr_buf = cerr.rdbuf(file.rdbuf()); #endif #if defined( __MWERKS__ ) && defined( macintosh ) // Get command line. argc = ccommand(&argv); // Allow the i/o window to be repositioned. // EH_STD::string s; // getline(EH_STD::cin, s); #endif unsigned int niters=2; bool run_all=true; bool run_slist = false; bool run_list = false; bool run_vector = false; bool run_bit_vector = false; bool run_deque = false; bool run_hash_map = false; bool run_hash_set = false; bool run_set = false; bool run_map = false; bool run_algo = false; bool run_algobase = false; bool run_rope = false; bool run_string = false; bool run_bitset = false; bool run_valarray = false; int cur_argv; char *p, *p1; #if defined (EH_NEW_IOSTREAMS) std::ios_base::sync_with_stdio(false); #endif cerr << argv[0]<<" : Exception handling testsuite.\n"; cerr.flush(); bool track_allocations = false; // parse parameters : // leak_test [-iterations] [-test] ... for (cur_argv=1; cur_argv<argc; cur_argv++) { p = argv[cur_argv]; if (*p == '-') { switch (p[1]) { case 'q': gTestController.SetVerbose(false); break; case 'v': gTestController.SetVerbose(true); break; #if 0 // This option was never actually used -- dwa 9/22/97 case 'i': gTestController.IgnoreLeaks(true); break; #endif case 'n': p1 = argv[++cur_argv]; if (p1 && EH_CSTD::sscanf(p1, "%i", &niters)==1) cerr <<" Doing "<<niters<<" iterations\n"; else usage(argv[0]); break; case 't': track_allocations = true; break; case 'e': gTestController.TurnOffExceptions(); break; case 's': p1 = argv[++cur_argv]; if (p1 && EH_CSTD::sscanf(p1, "%i", &random_base)==1) cerr <<" Setting "<<random_base<<" as base for random sizes.\n"; else usage(argv[0]); break; default: usage(argv[0]); break; } } else { run_all = false; // test name if (EH_CSTD::strcmp(p, "algo")==0) { run_algo=true; } else if (EH_CSTD::strcmp(p, "vector")==0) { run_vector=true; } else if (EH_CSTD::strcmp(p, "bit_vector")==0) { run_bit_vector=true; } else if (EH_CSTD::strcmp(p, "list")==0) { run_list=true; } else if (EH_CSTD::strcmp(p, "slist")==0) { run_slist=true; } else if (EH_CSTD::strcmp(p, "deque")==0) { run_deque=true; } else if (EH_CSTD::strcmp(p, "set")==0) { run_set=true; } else if (EH_CSTD::strcmp(p, "map")==0) { run_map=true; } else if (EH_CSTD::strcmp(p, "hash_set")==0) { run_hash_set=true; } else if (EH_CSTD::strcmp(p, "hash_map")==0) { run_hash_map=true; } else if (EH_CSTD::strcmp(p, "rope")==0) { run_rope=true; } else if (EH_CSTD::strcmp(p, "string")==0) { run_string=true; } else if (EH_CSTD::strcmp(p, "bitset")==0) { run_bitset=true; } else if (EH_CSTD::strcmp(p, "valarray")==0) { run_valarray=true; } else { usage(argv[0]); } } } gTestController.TrackAllocations( track_allocations ); // Over and over... for ( unsigned i = 0; i < niters ; i++ ) { cerr << "iteration #" << i << "\n"; if (run_all || run_algobase) { gTestController.SetCurrentContainer("algobase"); cerr << "EH test : algobase" << endl; test_algobase(); } if (run_all || run_algo) { gTestController.SetCurrentContainer("algo"); cerr << "EH test : algo" << endl; test_algo(); } if (run_all || run_vector) { gTestController.SetCurrentContainer("vector"); cerr << "EH test : vector" << endl; test_vector(); } #if defined( EH_BIT_VECTOR_IMPLEMENTED ) if (run_all || run_bit_vector) { gTestController.SetCurrentContainer("bit_vector"); cerr << "EH test : bit_vector" << endl; test_bit_vector(); } #endif if (run_all || run_list) { gTestController.SetCurrentContainer("list"); cerr << "EH test : list" << endl; test_list(); } #if defined( EH_SLIST_IMPLEMENTED ) if (run_all || run_slist) { gTestController.SetCurrentContainer("slist"); cerr << "EH test : slist" << endl; test_slist(); } #endif // EH_SLIST_IMPLEMENTED if (run_all || run_deque) { gTestController.SetCurrentContainer("deque"); cerr << "EH test : deque" << endl; test_deque(); } if (run_all || run_set) { gTestController.SetCurrentContainer("set"); cerr << "EH test : set" << endl; test_set(); gTestController.SetCurrentContainer("multiset"); cerr << "EH test : multiset" << endl; test_multiset(); } if (run_all || run_map) { gTestController.SetCurrentContainer("map"); cerr << "EH test : map" << endl; test_map(); gTestController.SetCurrentContainer("multimap"); cerr << "EH test : multimap" << endl; test_multimap(); } #if defined( EH_HASHED_CONTAINERS_IMPLEMENTED ) if (run_all || run_hash_map) { gTestController.SetCurrentContainer("hash_map"); cerr << "EH test : hash_map" << endl; test_hash_map(); gTestController.SetCurrentContainer("hash_multimap"); cerr << "EH test : hash_multimap" << endl; test_hash_multimap(); } if (run_all || run_hash_set) { gTestController.SetCurrentContainer("hash_set"); cerr << "EH test : hash_set" << endl; test_hash_set(); gTestController.SetCurrentContainer("hash_multiset"); cerr << "EH test : hash_multiset" << endl; test_hash_multiset(); } #endif // EH_HASHED_CONTAINERS_IMPLEMENTED #if defined( EH_ROPE_IMPLEMENTED ) // CW1.8 can't compile this for some reason! #if !( defined(__MWERKS__) && __MWERKS__ < 0x1900 ) if (run_all || run_rope) { gTestController.SetCurrentContainer("rope"); cerr << "EH test : rope" << endl; test_rope(); } #endif #endif // EH_ROPE_IMPLEMENTED #if defined( EH_STRING_IMPLEMENTED ) if (run_all || run_string) { gTestController.SetCurrentContainer("string"); cerr << "EH test : string" << endl; test_string(); } #endif #if defined( EH_BITSET_IMPLEMENTED ) if (run_all || run_bitset) { gTestController.SetCurrentContainer("bitset"); cerr << "EH test : bitset" << endl; test_bitset(); } #endif #if defined( EH_VALARRAY_IMPLEMENTED ) if (run_all || run_bitset) { gTestController.SetCurrentContainer("valarray"); cerr << "EH test : valarray" << endl; test_valarray(); } #endif } gTestController.TrackAllocations( false ); cerr << "EH test : Done\n"; #if defined(_WIN32_WCE) || defined(__SYMBIAN32__) cout.rdbuf(old_cout_buf); cerr.rdbuf(old_cerr_buf); file.close(); #endif return 0; }