Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62805 - in trunk/boost/test: . impl utils
From: steven_at_[hidden]
Date: 2010-06-11 11:18:48


Author: steven_watanabe
Date: 2010-06-11 11:18:46 EDT (Fri, 11 Jun 2010)
New Revision: 62805
URL: http://svn.boost.org/trac/boost/changeset/62805

Log:
Call test_finish/test_unit_finish in the reverse order from test_start/test_unit_start. Fixes #3978
Text files modified:
   trunk/boost/test/impl/framework.ipp | 6 ++--
   trunk/boost/test/progress_monitor.hpp | 2
   trunk/boost/test/results_collector.hpp | 2 +
   trunk/boost/test/utils/foreach.hpp | 41 ++++++++++++++++++++++++++++++++++++++++
   4 files changed, 47 insertions(+), 4 deletions(-)

Modified: trunk/boost/test/impl/framework.ipp
==============================================================================
--- trunk/boost/test/impl/framework.ipp (original)
+++ trunk/boost/test/impl/framework.ipp 2010-06-11 11:18:46 EDT (Fri, 11 Jun 2010)
@@ -162,7 +162,7 @@
                 to->test_aborted();
         }
 
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
+ BOOST_TEST_REVERSE_FOREACH( test_observer*, to, m_observers )
             to->test_unit_finish( tc, elapsed );
 
         m_curr_test_case = bkup;
@@ -188,7 +188,7 @@
 
     void test_suite_finish( test_suite const& ts )
     {
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
+ BOOST_TEST_REVERSE_FOREACH( test_observer*, to, m_observers )
             to->test_unit_finish( ts, 0 );
     }
 
@@ -446,7 +446,7 @@
     }
 
     if( call_start_finish ) {
- BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )
+ BOOST_TEST_REVERSE_FOREACH( test_observer*, to, s_frk_impl().m_observers )
             to->test_finish();
     }
 

Modified: trunk/boost/test/progress_monitor.hpp
==============================================================================
--- trunk/boost/test/progress_monitor.hpp (original)
+++ trunk/boost/test/progress_monitor.hpp 2010-06-11 11:18:46 EDT (Fri, 11 Jun 2010)
@@ -49,7 +49,7 @@
     void assertion_result( bool ) {}
     void exception_caught( execution_exception const& ) {}
 
- virtual int priority() { return 2; }
+ virtual int priority() { return 3; }
     
     // configuration
     void set_stream( std::ostream& );

Modified: trunk/boost/test/results_collector.hpp
==============================================================================
--- trunk/boost/test/results_collector.hpp (original)
+++ trunk/boost/test/results_collector.hpp 2010-06-11 11:18:46 EDT (Fri, 11 Jun 2010)
@@ -91,6 +91,8 @@
     void assertion_result( bool passed );
     void exception_caught( execution_exception const& );
 
+ virtual int priority() { return 2; }
+
     // results access
     test_results const& results( test_unit_id ) const;
 

Modified: trunk/boost/test/utils/foreach.hpp
==============================================================================
--- trunk/boost/test/utils/foreach.hpp (original)
+++ trunk/boost/test/utils/foreach.hpp 2010-06-11 11:18:46 EDT (Fri, 11 Jun 2010)
@@ -178,6 +178,28 @@
 //____________________________________________________________________________//
 
 // ************************************************************************** //
+// ************** prev ************** //
+// ************************************************************************** //
+
+template<typename C>
+inline void
+prev( static_any_t cur, C&, mpl::false_ )
+{
+ --static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( cur );
+}
+
+//____________________________________________________________________________//
+
+template<typename C>
+inline void
+prev( static_any_t cur, C const&, mpl::true_ )
+{
+ --static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( cur );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
 // ************** deref ************** //
 // ************************************************************************** //
 
@@ -233,6 +255,13 @@
         BOOST_TEST_FE_IS_CONST( COL ) ) \
 /**/
 
+#define BOOST_TEST_FE_PREV( COL ) \
+ ::boost::unit_test::for_each::prev( \
+ BOOST_TEST_FE_CUR_VAR, \
+ COL, \
+ BOOST_TEST_FE_IS_CONST( COL ) ) \
+/**/
+
 #define BOOST_FOREACH_NOOP(COL) \
     ((void)&(COL))
 
@@ -266,6 +295,18 @@
          !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \
 /**/
 
+#define BOOST_TEST_REVERSE_FOREACH( RefType, var, COL ) \
+if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_END( COL ) ) {} else \
+if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \
+for( bool BOOST_TEST_FE_CON_VAR = true; \
+ BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); ) \
+ \
+ if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \
+ if( (BOOST_TEST_FE_PREV( COL ), false) ) {} else \
+ for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \
+ !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \
+/**/
+
 //____________________________________________________________________________//
 
 } // namespace for_each


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