Added optional code to time how long the test takes.

[SVN r11828]
This commit is contained in:
John Maddock
2001-11-30 11:56:35 +00:00
parent c167b1f183
commit 0bd54d3821

View File

@ -46,6 +46,9 @@ using std::endl;
#if defined(BOOST_MSVC) && defined(_DEBUG) #if defined(BOOST_MSVC) && defined(_DEBUG)
#include <CRTDBG.H> #include <CRTDBG.H>
#endif #endif
#ifdef TIME_TEST
#include <boost/timer.hpp>
#endif
// //
@ -82,6 +85,9 @@ int cpp_main(int argc, char * argv[])
tmpFlag |= _CRTDBG_LEAK_CHECK_DF; tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
tmpFlag &= ~_CRTDBG_CHECK_CRT_DF; tmpFlag &= ~_CRTDBG_CHECK_CRT_DF;
_CrtSetDbgFlag( tmpFlag ); _CrtSetDbgFlag( tmpFlag );
#endif
#ifdef TIME_TEST
boost::timer tim;
#endif #endif
if(argc < 2) if(argc < 2)
usage(); usage();
@ -113,6 +119,10 @@ int cpp_main(int argc, char * argv[])
} }
cout << line << " lines, " << tests << " tests completed in file " << argv[i] << endl; cout << line << " lines, " << tests << " tests completed in file " << argv[i] << endl;
} }
#ifdef TIME_TEST
double elapsed_time = tim.elapsed();
cout << "Elapsed time = " << elapsed_time << "s" << endl;
#endif
return error_count; return error_count;
} }