diff -r e20de85af2ee -r ce057bb09d0b genericopenlibs/cppstdlib/stl/test/eh/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/genericopenlibs/cppstdlib/stl/test/eh/main.cpp Fri Jun 04 16:20:51 2010 +0100 @@ -0,0 +1,408 @@ +/*********************************************************************************** + Main.cpp + * Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Moscow Center for SPARC Technology makes +no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Prefix.h" +#include "Tests.h" + +#if defined (EH_NEW_IOSTREAMS) +# include +# else +# include +#endif + +#if defined(macintosh)&&(!defined(__MRC__) && !defined(__SC__)) || defined (_MAC) && defined(__MWERKS__) + +# include +# include +# include + +# ifdef EH_NEW_HEADERS +# include +# include +# include +# else +# include +# include +# include +# endif + +# if defined (_STL_DEBUG) + +# if defined ( EH_USE_SGI_STL ) +// Override assertion behavior +# include +//# include +void STLPORT::__stl_debug_message(const char * format_str, ...) +{ + std::va_list args; + va_start( args, format_str ); + char msg[256]; + std::vsnprintf(msg, sizeof(msg)/sizeof(*msg) - 1, format_str, args ); + DebugStr( c2pstr(msg) ); +} +# else +/*=================================================================================== + __assertion_failed (override standard library function) + + EFFECTS: Breaks into the debugger and shows the assertion. This implementation + is Mac-specific; others could be added for other platforms. +====================================================================================*/ +extern "C" +{ + void __assertion_failed(char *condition, char *testfilename, int lineno); + void __assertion_failed(char *condition, char *testfilename, int lineno) + { + char msg[256]; + std::strncpy( msg, condition, 255 ); + std::strncat( msg, ": ", 255 ); + std::strncat( msg, testfilename, 255 ); + std::strncat( msg, ", ", 255 ); + char line[20]; + std::sprintf( line, "%d", lineno ); + std::strncat( msg, line, 255 ); + DebugStr( c2pstr( msg ) ); + } +} +# endif + +# endif + +#endif + +#include "nc_alloc.h" + +#if defined (EH_NEW_HEADERS) +# include +# include +# else +# include +# include +#endif + +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#ifdef __BORLANDC__ +# include +#endif + +# if defined(EH_USE_NAMESPACES) +namespace // dwa 1/21/00 - must use unnamed namespace here to avoid conflict under gcc using native streams +{ + using namespace std; + // using std::cerr; + // using std::endl; +} +# endif + + +/*=================================================================================== + usage (file-static helper) + + EFFECTS: Prints a message describing the command-line parameters +====================================================================================*/ +static void usage(const char* name) +{ + cerr<] [-s ] [-l] [-e] [-q]/[-v] [-t] [test_name...]\n"; + cerr<<"\t[-n ] : number of test iterations, default==100;"<] : base value for random container sizes, default==1000;"< +# else +# include +# endif + +#if defined(_WIN32_WCE) || defined(__SYMBIAN32__) +#include +#endif + +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