Boost logo

Boost-Commit :

From: gennadiy.rozental_at_[hidden]
Date: 2008-07-24 23:26:12


Author: rogeeff
Date: 2008-07-24 23:26:12 EDT (Thu, 24 Jul 2008)
New Revision: 47780
URL: http://svn.boost.org/trac/boost/changeset/47780

Log:
further optimization of test tools output operations
Text files modified:
   trunk/boost/test/impl/test_tools.ipp | 48 ++++++++++++++++++++-------------------
   trunk/boost/test/test_tools.hpp | 5 +--
   2 files changed, 27 insertions(+), 26 deletions(-)

Modified: trunk/boost/test/impl/test_tools.ipp
==============================================================================
--- trunk/boost/test/impl/test_tools.ipp (original)
+++ trunk/boost/test/impl/test_tools.ipp 2008-07-24 23:26:12 EDT (Thu, 24 Jul 2008)
@@ -111,8 +111,10 @@
 // ************** TOOL BOX Implementation ************** //
 // ************************************************************************** //
 
+using ::boost::unit_test::lazy_ostream;
+
 bool
-check_impl( predicate_result const& pr, ::boost::unit_test::lazy_ostream const& check_descr,
+check_impl( predicate_result const& pr, lazy_ostream const& check_descr,
             const_string file_name, std::size_t line_num,
             tool_level tl, check_type ct,
             std::size_t num_of_args, ... )
@@ -191,16 +193,16 @@
         va_list args;
 
         va_start( args, num_of_args );
- char const* arg1_descr = va_arg( args, char const* );
- char const* arg1_val = va_arg( args, char const* );
- char const* arg2_descr = va_arg( args, char const* );
- char const* arg2_val = va_arg( args, char const* );
+ char const* arg1_descr = va_arg( args, char const* );
+ lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* );
+ char const* arg2_descr = va_arg( args, char const* );
+ lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* );
 
         unit_test_log << unit_test::log::begin( file_name, line_num )
                       << ll << prefix << arg1_descr << check_str[ct-CHECK_EQUAL] << arg2_descr << suffix;
 
         if( tl != PASS )
- unit_test_log << " [" << arg1_val << rever_str[ct-CHECK_EQUAL] << arg2_val << "]" ;
+ unit_test_log << " [" << *arg1_val << rever_str[ct-CHECK_EQUAL] << *arg2_val << "]" ;
 
         va_end( args );
         
@@ -216,19 +218,19 @@
         va_list args;
 
         va_start( args, num_of_args );
- char const* arg1_descr = va_arg( args, char const* );
- char const* arg1_val = va_arg( args, char const* );
- char const* arg2_descr = va_arg( args, char const* );
- char const* arg2_val = va_arg( args, char const* );
- /* toler_descr = */ va_arg( args, char const* );
- char const* toler_val = va_arg( args, char const* );
+ char const* arg1_descr = va_arg( args, char const* );
+ lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* );
+ char const* arg2_descr = va_arg( args, char const* );
+ lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* );
+ /* toler_descr = */ va_arg( args, char const* );
+ lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* );
 
         unit_test_log << unit_test::log::begin( file_name, line_num ) << ll;
 
- unit_test_log << "difference between " << arg1_descr << "{" << arg1_val << "}"
- << " and " << arg2_descr << "{" << arg2_val << "}"
+ unit_test_log << "difference between " << arg1_descr << "{" << *arg1_val << "}"
+ << " and " << arg2_descr << "{" << *arg2_val << "}"
                       << ( tl == PASS ? " doesn't exceed " : " exceeds " )
- << toler_val;
+ << *toler_val;
         if( ct == CHECK_CLOSE )
             unit_test_log << "%";
 
@@ -244,16 +246,16 @@
         va_list args;
 
         va_start( args, num_of_args );
- char const* arg1_descr = va_arg( args, char const* );
- char const* arg1_val = va_arg( args, char const* );
- /* toler_descr = */ va_arg( args, char const* );
- char const* toler_val = va_arg( args, char const* );
+ char const* arg1_descr = va_arg( args, char const* );
+ lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* );
+ /* toler_descr = */ va_arg( args, char const* );
+ lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* );
 
         unit_test_log << unit_test::log::begin( file_name, line_num ) << ll;
 
- unit_test_log << "absolute value of " << arg1_descr << "{" << arg1_val << "}"
+ unit_test_log << "absolute value of " << arg1_descr << "{" << *arg1_val << "}"
                       << ( tl == PASS ? " doesn't exceed " : " exceeds " )
- << toler_val;
+ << *toler_val;
 
         va_end( args );
         
@@ -276,7 +278,7 @@
             unit_test_log << "( ";
             for( std::size_t i = 0; i < num_of_args; ++i ) {
                 unit_test_log << va_arg( args, char const* );
- va_arg( args, char const* ); // skip argument value;
+ va_arg( args, lazy_ostream const* ); // skip argument value;
                 
                 if( i != num_of_args-1 )
                     unit_test_log << ", ";
@@ -292,7 +294,7 @@
             unit_test_log << " for ( ";
             for( std::size_t i = 0; i < num_of_args; ++i ) {
                 va_arg( args, char const* ); // skip argument description;
- unit_test_log << va_arg( args, char const* );
+ unit_test_log << *va_arg( args, lazy_ostream const* );
                 
                 if( i != num_of_args-1 )
                     unit_test_log << ", ";

Modified: trunk/boost/test/test_tools.hpp
==============================================================================
--- trunk/boost/test/test_tools.hpp (original)
+++ trunk/boost/test/test_tools.hpp 2008-07-24 23:26:12 EDT (Thu, 24 Jul 2008)
@@ -491,9 +491,8 @@
 
 #define ARG_INFO( z, m, dummy ) \
     , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
- , (boost::wrap_stringstream().ref() \
- << ::boost::test_tools::tt_detail:: \
- print_helper( BOOST_JOIN( arg, m ) )).str().c_str() \
+ , &(const unit_test::lazy_ostream&)(unit_test::lazy_ostream::instance() \
+ << ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \
 /**/
 
 #define IMPL_FRWD( z, n, dummy ) \


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk