Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81320 - in trunk/boost/test: . detail impl output tree utils
From: gennadiy.rozental_at_[hidden]
Date: 2012-11-13 07:17:54


Author: rogeeff
Date: 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
New Revision: 81320
URL: http://svn.boost.org/trac/boost/changeset/81320

Log:
New feature: Boost.Test now reports number of failed warnings in passed test case and number of passed test cases with failed warnings
renamed some global constants to follow naming convention
removed some outdated workarounds
Text files modified:
   trunk/boost/test/debug.hpp | 9 ----
   trunk/boost/test/detail/global_typedef.hpp | 10 +++-
   trunk/boost/test/framework.hpp | 2
   trunk/boost/test/impl/compiler_log_formatter.ipp | 6 --
   trunk/boost/test/impl/debug.ipp | 4 --
   trunk/boost/test/impl/decorator.ipp | 4 +-
   trunk/boost/test/impl/exception_safety.ipp | 8 ++--
   trunk/boost/test/impl/framework.ipp | 22 ++++++------
   trunk/boost/test/impl/plain_report_formatter.ipp | 39 ++++++++++----------
   trunk/boost/test/impl/progress_monitor.ipp | 2
   trunk/boost/test/impl/results_collector.ipp | 73 ++++++++++++++-------------------------
   trunk/boost/test/impl/results_reporter.ipp | 4 +-
   trunk/boost/test/impl/test_tools.ipp | 7 ++-
   trunk/boost/test/impl/test_tree.ipp | 35 ++++++++++++++++++-
   trunk/boost/test/impl/unit_test_log.ipp | 18 ---------
   trunk/boost/test/impl/unit_test_parameters.ipp | 18 ++++----
   trunk/boost/test/impl/xml_log_formatter.ipp | 6 +-
   trunk/boost/test/impl/xml_report_formatter.ipp | 11 +++--
   trunk/boost/test/output/xml_log_formatter.hpp | 2
   trunk/boost/test/output/xml_report_formatter.hpp | 2
   trunk/boost/test/progress_monitor.hpp | 18 +++------
   trunk/boost/test/results_collector.hpp | 20 +++++-----
   trunk/boost/test/tree/observer.hpp | 12 ++++++
   trunk/boost/test/tree/test_unit.hpp | 23 ++++++------
   trunk/boost/test/tree/traverse.hpp | 2
   trunk/boost/test/unit_test_log.hpp | 18 ++++-----
   trunk/boost/test/utils/class_properties.hpp | 22 ------------
   trunk/boost/test/utils/xml_printer.hpp | 2
   28 files changed, 184 insertions(+), 215 deletions(-)

Modified: trunk/boost/test/debug.hpp
==============================================================================
--- trunk/boost/test/debug.hpp (original)
+++ trunk/boost/test/debug.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -63,17 +63,8 @@
 // ************** debugger setup ************** //
 // ************************************************************************** //
 
-#if BOOST_WORKAROUND( BOOST_MSVC, <1300)
-
-std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id );
-
-#else
-
 std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() );
 
-#endif
-
-
 // ************************************************************************** //
 // ************** attach debugger to the current process ************** //
 // ************************************************************************** //

Modified: trunk/boost/test/detail/global_typedef.hpp
==============================================================================
--- trunk/boost/test/detail/global_typedef.hpp (original)
+++ trunk/boost/test/detail/global_typedef.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -44,11 +44,15 @@
 
 //____________________________________________________________________________//
 
-enum output_format { INV_OF, CLF /* compiler log format */, XML /* XML */ };
+enum output_format { OF_INVALID, OF_CLF /* compiler log format */, OF_XML /* OF_XML */ };
 
 //____________________________________________________________________________//
 
-enum test_unit_type { tut_case = 0x01, tut_suite = 0x10, tut_any = 0x11 };
+enum test_unit_type { TUT_CASE = 0x01, TUT_SUITE = 0x10, TUT_ANY = 0x11 };
+
+//____________________________________________________________________________//
+
+enum assertion_result { AR_FAILED, AR_PASSED, AR_TRIGGERED };
 
 //____________________________________________________________________________//
 
@@ -67,7 +71,7 @@
 inline test_unit_type
 test_id_2_unit_type( test_unit_id id )
 {
- return (id & 0xFFFF0000) != 0 ? tut_case : tut_suite;
+ return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE;
 }
 
 //____________________________________________________________________________//

Modified: trunk/boost/test/framework.hpp
==============================================================================
--- trunk/boost/test/framework.hpp (original)
+++ trunk/boost/test/framework.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -102,7 +102,7 @@
 BOOST_TEST_DECL void run( test_unit const*, bool continue_test = true );
 
 // public test events dispatchers
-BOOST_TEST_DECL void assertion_result( bool passed );
+BOOST_TEST_DECL void assertion_result( unit_test::assertion_result ar );
 BOOST_TEST_DECL void exception_caught( execution_exception const& );
 BOOST_TEST_DECL void test_unit_aborted( test_unit const& );
 

Modified: trunk/boost/test/impl/compiler_log_formatter.ipp
==============================================================================
--- trunk/boost/test/impl/compiler_log_formatter.ipp (original)
+++ trunk/boost/test/impl/compiler_log_formatter.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -95,11 +95,7 @@
 
     print_prefix( output, tu.p_file_name, tu.p_line_num );
 
- const_string type = tu.p_type_name;
- if( tu.p_type == tut_suite && (tu.p_id == framework::master_test_suite().p_id) )
- type = BOOST_TEST_L("module");
-
- output << "Entering test " << type << " \"" << tu.p_name << "\"" << std::endl;
+ output << "Entering test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl;
 }
 
 //____________________________________________________________________________//

Modified: trunk/boost/test/impl/debug.ipp
==============================================================================
--- trunk/boost/test/impl/debug.ipp (original)
+++ trunk/boost/test/impl/debug.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -40,10 +40,6 @@
 # endif
 
 
-# if BOOST_WORKAROUND( BOOST_MSVC, <1300)
-# define snprintf _snprintf
-# endif
-
 # ifdef BOOST_NO_STDC_NAMESPACE
 namespace std { using ::memset; using ::sprintf; }
 # endif

Modified: trunk/boost/test/impl/decorator.ipp
==============================================================================
--- trunk/boost/test/impl/decorator.ipp (original)
+++ trunk/boost/test/impl/decorator.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -170,14 +170,14 @@
 
     test_unit* dep = &framework::master_test_suite();
     while( tit != string_token_iterator() ) {
- BOOST_TEST_SETUP_ASSERT( dep->p_type == tut_suite, std::string( "incorrect dependency specification " ) + m_dependency );
+ BOOST_TEST_SETUP_ASSERT( dep->p_type == TUT_SUITE, std::string( "incorrect dependency specification " ) + m_dependency );
 
         test_unit_id next_id = static_cast<test_suite*>(dep)->get( *tit );
 
         if( next_id == INV_TEST_UNIT_ID )
             throw framework::setup_error( std::string( "incorrect dependency specification " ) + m_dependency );
 
- dep = &framework::get( next_id, tut_any );
+ dep = &framework::get( next_id, TUT_ANY );
         ++tit;
     }
 

Modified: trunk/boost/test/impl/exception_safety.ipp
==============================================================================
--- trunk/boost/test/impl/exception_safety.ipp (original)
+++ trunk/boost/test/impl/exception_safety.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -123,7 +123,7 @@
     virtual void freed( void* p );
 
     // test observer interface
- virtual void assertion_result( bool passed );
+ virtual void assertion_result( unit_test::assertion_result ar );
     virtual int priority() { return (std::numeric_limits<int>::max)(); } // we want this observer to run the last
 
 private:
@@ -208,7 +208,7 @@
     // check memory usage
     if( m_execution_path.size() > 0 ) {
         bool errors_detected = m_invairant_failed || (m_memory_in_use.size() != 0);
- framework::assertion_result( !errors_detected );
+ framework::assertion_result( errors_detected ? AR_FAILED : AR_PASSED );
 
         if( errors_detected )
             report_error();
@@ -373,9 +373,9 @@
 //____________________________________________________________________________//
 
 void
-exception_safety_tester::assertion_result( bool passed )
+exception_safety_tester::assertion_result( unit_test::assertion_result ar )
 {
- if( !m_internal_activity && !passed ) {
+ if( !m_internal_activity && (ar != AR_PASSED) ) {
         m_invairant_failed = true;
 
         failure_point();

Modified: trunk/boost/test/impl/framework.ipp
==============================================================================
--- trunk/boost/test/impl/framework.ipp (original)
+++ trunk/boost/test/impl/framework.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -216,7 +216,7 @@
     {
         if( tu.has_label( m_label ) ) {
             // found a test unit; add it to list of tu to enable with children and stop recursion in case of suites
- m_tu_to_enable.push_back( std::make_pair( tu.p_id, tu.p_type == tut_suite ) );
+ m_tu_to_enable.push_back( std::make_pair( tu.p_id, tu.p_type == TUT_SUITE ) );
             return false;
         }
 
@@ -280,7 +280,7 @@
         // check if any of dependencies are disabled
         if( tu.p_enabled ) {
             BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) {
- test_unit const& dep = framework::get( dep_id, tut_any );
+ test_unit const& dep = framework::get( dep_id, TUT_ANY );
 
                 if( !dep.p_enabled ) {
                     BOOST_TEST_MESSAGE( "Disable test " << tu.p_type_name << ' ' << tu.p_name <<
@@ -295,7 +295,7 @@
 
         // if this test unit is disabled - disable all subunits and remove it from the tree if requested
         if( !tu.p_enabled ) {
- if( tu.p_type == tut_suite ) {
+ if( tu.p_type == TUT_SUITE ) {
                 ut_detail::change_status disabler( false );
                 traverse_test_tree( tu.p_id, disabler, true );
                 m_made_change |= disabler.made_change();
@@ -340,7 +340,7 @@
             test_unit const* tu_ptr = tu.second;
 
             // the delete will erase this element from map
- if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == tut_suite )
+ if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == TUT_SUITE )
                 delete static_cast<test_suite const*>(tu_ptr);
             else
                 delete static_cast<test_case const*>(tu_ptr);
@@ -552,7 +552,7 @@
         // 20. enable tu collected along with their parents, dependencies and children where necessary
         while( !tu_to_enable.empty() ) {
             std::pair<test_unit_id,bool> data = tu_to_enable.front();
- test_unit const& tu = framework::get( data.first, tut_any );
+ test_unit const& tu = framework::get( data.first, TUT_ANY );
 
             tu_to_enable.pop_front();
 
@@ -567,12 +567,12 @@
                 continue;
 
             // 23. add parent to the list (without children)
- if( !framework::get( tu.p_parent_id, tut_any ).p_enabled )
+ if( !framework::get( tu.p_parent_id, TUT_ANY ).p_enabled )
                 tu_to_enable.push_back( std::make_pair( tu.p_parent_id, false ) );
 
             // 24. add dependencies to the list (with children)
             BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) {
- test_unit const& dep = framework::get( dep_id, tut_any );
+ test_unit const& dep = framework::get( dep_id, TUT_ANY );
 
                 if( !dep.p_enabled ) {
                     BOOST_TEST_MESSAGE( "Including test " << dep.p_type_name << ' ' << dep.p_name <<
@@ -583,7 +583,7 @@
             }
 
             // 25. add all children to the list recursively
- if( data.second && tu.p_type == tut_suite ) {
+ if( data.second && tu.p_type == TUT_SUITE ) {
                 class collect_disabled : public test_tree_visitor {
                 public:
                     explicit collect_disabled( ut_detail::tu_enable_list& tu_to_enable ) : m_tu_to_enable( tu_to_enable ) {}
@@ -612,7 +612,7 @@
         // 31. First go through the collected list and disable all tu along with their children
         while( !tu_to_disable.empty() ) {
             std::pair<test_unit_id,bool> data = tu_to_disable.front();
- test_unit const& tu = framework::get( data.first, tut_any );
+ test_unit const& tu = framework::get( data.first, TUT_ANY );
 
             tu_to_disable.pop_front();
 
@@ -1093,10 +1093,10 @@
 // ************************************************************************** //
 
 void
-assertion_result( bool passed )
+assertion_result( unit_test::assertion_result ar )
 {
     BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )
- to->assertion_result( passed );
+ to->assertion_result( ar );
 }
 
 //____________________________________________________________________________//

Modified: trunk/boost/test/impl/plain_report_formatter.ipp
==============================================================================
--- trunk/boost/test/impl/plain_report_formatter.ipp (original)
+++ trunk/boost/test/impl/plain_report_formatter.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -60,17 +60,16 @@
 //____________________________________________________________________________//
 
 void
-print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total,
- const_string name, const_string res )
+print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total, const_string name, const_string res )
 {
- if( v > 0 ) {
- ostr << std::setw( indent ) << ""
- << v << ' ' << name << ( v != 1 ? "s" : "" );
- if( total > 0 )
- ostr << " out of " << total;
+ if( v == 0 )
+ return;
 
- ostr << ' ' << res << '\n';
- }
+ if( total > 0 )
+ ostr << std::setw( indent ) << "" << v << ' ' << name << ( v != 1 ? "s" : "" )
+ << " out of " << total << ' ' << res << '\n';
+ else
+ ostr << std::setw( indent ) << "" << v << ' ' << res << ' ' << name << ( v != 1 ? "s" : "" ) << '\n';
 }
 
 //____________________________________________________________________________//
@@ -115,7 +114,7 @@
         descr = "failed";
 
     ostr << std::setw( m_indent ) << ""
- << "Test " << (tu.p_type == tut_case ? "case " : "suite " ) << quote() << tu.p_name << ' ' << descr;
+ << "Test " << tu.p_type_name << ' ' << quote() << tu.p_name << ' ' << descr;
 
     if( tr.p_skipped ) {
         ostr << " due to " << (tu.check_dependencies() ? "test aborting\n" : "failed dependancy\n" );
@@ -124,21 +123,23 @@
     }
     
     counter_t total_assertions = tr.p_assertions_passed + tr.p_assertions_failed;
- counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_failed + tr.p_test_cases_skipped;
+ counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_warned + tr.p_test_cases_failed + tr.p_test_cases_skipped;
 
- if( total_assertions > 0 || total_tc > 0 )
+ if( total_assertions > 0 || total_tc > 0 || tr.p_warnings_failed > 0)
         ostr << " with:";
 
     ostr << '\n';
     m_indent += 2;
 
- print_stat_value( ostr, tr.p_assertions_passed, m_indent, total_assertions, "assertion", "passed" );
- print_stat_value( ostr, tr.p_assertions_failed, m_indent, total_assertions, "assertion", "failed" );
- print_stat_value( ostr, tr.p_expected_failures, m_indent, 0 , "failure" , "expected" );
- print_stat_value( ostr, tr.p_test_cases_passed, m_indent, total_tc , "test case", "passed" );
- print_stat_value( ostr, tr.p_test_cases_failed, m_indent, total_tc , "test case", "failed" );
- print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" );
- print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" );
+ print_stat_value( ostr, tr.p_test_cases_passed , m_indent, total_tc , "test case", "passed" );
+ print_stat_value( ostr, tr.p_test_cases_warned , m_indent, total_tc , "test case", "passed with warnings" );
+ print_stat_value( ostr, tr.p_test_cases_failed , m_indent, total_tc , "test case", "failed" );
+ print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" );
+ print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" );
+ print_stat_value( ostr, tr.p_assertions_passed , m_indent, total_assertions, "assertion", "passed" );
+ print_stat_value( ostr, tr.p_assertions_failed , m_indent, total_assertions, "assertion", "failed" );
+ print_stat_value( ostr, tr.p_warnings_failed , m_indent, 0 , "warning" , "failed" );
+ print_stat_value( ostr, tr.p_expected_failures , m_indent, 0 , "failure" , "expected" );
     
     ostr << '\n';
 }

Modified: trunk/boost/test/impl/progress_monitor.ipp
==============================================================================
--- trunk/boost/test/impl/progress_monitor.ipp (original)
+++ trunk/boost/test/impl/progress_monitor.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -83,7 +83,7 @@
 {
     BOOST_TEST_SCOPE_SETCOLOR( *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA );
 
- if( tu.p_type == tut_case )
+ if( tu.p_type == TUT_CASE )
         ++(*s_pm_impl().m_progress_display);
 }
 

Modified: trunk/boost/test/impl/results_collector.ipp
==============================================================================
--- trunk/boost/test/impl/results_collector.ipp (original)
+++ trunk/boost/test/impl/results_collector.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -76,7 +76,9 @@
 {
     p_assertions_passed.value += tr.p_assertions_passed;
     p_assertions_failed.value += tr.p_assertions_failed;
+ p_warnings_failed.value += tr.p_warnings_failed;
     p_test_cases_passed.value += tr.p_test_cases_passed;
+ p_test_cases_warned.value += tr.p_test_cases_warned;
     p_test_cases_failed.value += tr.p_test_cases_failed;
     p_test_cases_skipped.value += tr.p_test_cases_skipped;
     p_test_cases_aborted.value += tr.p_test_cases_aborted;
@@ -87,15 +89,17 @@
 void
 test_results::clear()
 {
- p_assertions_passed.value = 0;
- p_assertions_failed.value = 0;
- p_expected_failures.value = 0;
- p_test_cases_passed.value = 0;
- p_test_cases_failed.value = 0;
- p_test_cases_skipped.value = 0;
- p_test_cases_aborted.value = 0;
- p_aborted.value = false;
- p_skipped.value = true;
+ p_assertions_passed.value = 0;
+ p_assertions_failed.value = 0;
+ p_warnings_failed.value = 0;
+ p_expected_failures.value = 0;
+ p_test_cases_passed.value = 0;
+ p_test_cases_warned.value = 0;
+ p_test_cases_failed.value = 0;
+ p_test_cases_skipped.value = 0;
+ p_test_cases_aborted.value = 0;
+ p_aborted.value = false;
+ p_skipped.value = true;
 }
 
 //____________________________________________________________________________//
@@ -104,8 +108,6 @@
 // ************** results_collector ************** //
 // ************************************************************************** //
 
-#if !BOOST_WORKAROUND(BOOST_MSVC, <1300)
-
 namespace {
 
 struct results_collector_impl {
@@ -116,16 +118,6 @@
 
 } // local namespace
 
-#else
-
-struct results_collector_impl {
- std::map<test_unit_id,test_results> m_results_store;
-};
-
-static results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; }
-
-#endif
-
 //____________________________________________________________________________//
 
 void
@@ -137,22 +129,6 @@
 //____________________________________________________________________________//
 
 void
-results_collector_t::test_finish()
-{
- // do nothing
-}
-
-//____________________________________________________________________________//
-
-void
-results_collector_t::test_aborted()
-{
- // do nothing
-}
-
-//____________________________________________________________________________//
-
-void
 results_collector_t::test_unit_start( test_unit const& tu )
 {
     // init test_results entry
@@ -175,8 +151,12 @@
         test_results const& tr = results_collector.results( tc.p_id );
         m_tr += tr;
 
- if( tr.passed() )
- m_tr.p_test_cases_passed.value++;
+ if( tr.passed() ) {
+ if( tr.p_warnings_failed )
+ m_tr.p_test_cases_warned.value++;
+ else
+ m_tr.p_test_cases_passed.value++;
+ }
         else if( tr.p_skipped )
             m_tr.p_test_cases_skipped.value++;
         else {
@@ -206,7 +186,7 @@
 void
 results_collector_t::test_unit_finish( test_unit const& tu, unsigned long )
 {
- if( tu.p_type == tut_suite ) {
+ if( tu.p_type == TUT_SUITE ) {
         results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu );
 
         traverse_test_tree( tu, ch );
@@ -229,7 +209,7 @@
 void
 results_collector_t::test_unit_skipped( test_unit const& tu )
 {
- if( tu.p_type == tut_suite ) {
+ if( tu.p_type == TUT_SUITE ) {
         test_case_counter tcc;
         traverse_test_tree( tu, tcc );
 
@@ -245,14 +225,15 @@
 //____________________________________________________________________________//
 
 void
-results_collector_t::assertion_result( bool passed )
+results_collector_t::assertion_result( unit_test::assertion_result ar )
 {
     test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()];
 
- if( passed )
- tr.p_assertions_passed.value++;
- else
- tr.p_assertions_failed.value++;
+ switch( ar ) {
+ case AR_PASSED: tr.p_assertions_passed.value++; break;
+ case AR_FAILED: tr.p_assertions_failed.value++; break;
+ case AR_TRIGGERED: tr.p_warnings_failed.value++; break;
+ }
 
     if( tr.p_assertions_failed == 1 )
         first_failed_assertion();

Modified: trunk/boost/test/impl/results_reporter.ipp
==============================================================================
--- trunk/boost/test/impl/results_reporter.ipp (original)
+++ trunk/boost/test/impl/results_reporter.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -127,10 +127,10 @@
 set_format( output_format rf )
 {
     switch( rf ) {
- case CLF:
+ case OF_CLF:
         set_format( new output::plain_report_formatter );
         break;
- case XML:
+ case OF_XML:
         set_format( new output::xml_report_formatter );
         break;
     default:

Modified: trunk/boost/test/impl/test_tools.ipp
==============================================================================
--- trunk/boost/test/impl/test_tools.ipp (original)
+++ trunk/boost/test/impl/test_tools.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -334,18 +334,19 @@
 
     switch( tl ) {
     case PASS:
- framework::assertion_result( true );
+ framework::assertion_result( AR_PASSED );
         return true;
 
     case WARN:
+ framework::assertion_result( AR_TRIGGERED );
         return false;
 
     case CHECK:
- framework::assertion_result( false );
+ framework::assertion_result( AR_FAILED );
         return false;
         
     case REQUIRE:
- framework::assertion_result( false );
+ framework::assertion_result( AR_FAILED );
 
         framework::test_unit_aborted( framework::current_test_case() );
 

Modified: trunk/boost/test/impl/test_tree.ipp
==============================================================================
--- trunk/boost/test/impl/test_tree.ipp (original)
+++ trunk/boost/test/impl/test_tree.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -56,7 +56,7 @@
 
 test_unit::test_unit( const_string name, const_string file_name, std::size_t line_num, test_unit_type t )
 : p_type( t )
-, p_type_name( t == tut_case ? "case" : "suite" )
+, p_type_name( t == TUT_CASE ? "case" : "suite" )
 , p_file_name( file_name )
 , p_line_num( line_num )
 , p_id( INV_TEST_UNIT_ID )
@@ -67,6 +67,18 @@
 
 //____________________________________________________________________________//
 
+test_unit::test_unit( const_string module_name )
+: p_type( TUT_SUITE )
+, p_type_name( "module" )
+, p_line_num( 0 )
+, p_id( INV_TEST_UNIT_ID )
+, p_name( std::string( module_name.begin(), module_name.size() ) )
+, p_enabled( true )
+{
+}
+
+//____________________________________________________________________________//
+
 test_unit::~test_unit()
 {
     framework::deregister_test_unit( this );
@@ -160,6 +172,14 @@
 
 //____________________________________________________________________________//
 
+test_suite::test_suite( const_string module_name )
+: test_unit( module_name )
+{
+ framework::register_test_unit( this );
+}
+
+//____________________________________________________________________________//
+
 void
 test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout )
 {
@@ -213,6 +233,17 @@
 //____________________________________________________________________________//
 
 // ************************************************************************** //
+// ************** master_test_suite ************** //
+// ************************************************************************** //
+
+master_test_suite_t::master_test_suite_t()
+: test_suite( "Master Test Suite" )
+, argc( 0 )
+, argv( 0 )
+{
+}
+
+// ************************************************************************** //
 // ************** traverse_test_tree ************** //
 // ************************************************************************** //
 
@@ -265,7 +296,7 @@
 void
 traverse_test_tree( test_unit_id id, test_tree_visitor& V, bool ignore_status )
 {
- if( ut_detail::test_id_2_unit_type( id ) == tut_case )
+ if( ut_detail::test_id_2_unit_type( id ) == TUT_CASE )
         traverse_test_tree( framework::get<test_case>( id ), V, ignore_status );
     else
         traverse_test_tree( framework::get<test_suite>( id ), V, ignore_status );

Modified: trunk/boost/test/impl/unit_test_log.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_log.ipp (original)
+++ trunk/boost/test/impl/unit_test_log.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -207,22 +207,6 @@
 //____________________________________________________________________________//
 
 void
-unit_test_log_t::test_unit_aborted( test_unit const& )
-{
- // do nothing
-}
-
-//____________________________________________________________________________//
-
-void
-unit_test_log_t::assertion_result( bool )
-{
- // do nothing
-}
-
-//____________________________________________________________________________//
-
-void
 unit_test_log_t::exception_caught( execution_exception const& ex )
 {
     log_level l =
@@ -442,7 +426,7 @@
     if( s_log_impl().m_entry_in_progress )
         return;
 
- if( log_format == CLF )
+ if( log_format == OF_CLF )
         set_formatter( new output::compiler_log_formatter );
     else
         set_formatter( new output::xml_log_formatter );

Modified: trunk/boost/test/impl/unit_test_parameters.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_parameters.ipp (original)
+++ trunk/boost/test/impl/unit_test_parameters.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -125,18 +125,18 @@
 operator>>( std::istream& in, unit_test::output_format& of )
 {
     fixed_mapping<const_string,unit_test::output_format,case_ins_less<char const> > output_format_name (
- "HRF", unit_test::CLF,
- "CLF", unit_test::CLF,
- "XML", unit_test::XML,
+ "HRF", unit_test::OF_CLF,
+ "CLF", unit_test::OF_CLF,
+ "XML", unit_test::OF_XML,
 
- unit_test::INV_OF
+ unit_test::OF_INVALID
         );
 
     std::string val;
     in >> val;
 
     of = output_format_name[val];
- BOOST_TEST_SETUP_ASSERT( of != unit_test::INV_OF, "invalid output format " + val );
+ BOOST_TEST_SETUP_ASSERT( of != unit_test::OF_INVALID, "invalid output format " + val );
 
     return in;
 }
@@ -347,12 +347,12 @@
             throw framework::nothing_to_test();
         }
 
- s_report_format = retrieve_parameter( REPORT_FORMAT, s_cla_parser, unit_test::CLF );
- s_log_format = retrieve_parameter( LOG_FORMAT, s_cla_parser, unit_test::CLF );
+ s_report_format = retrieve_parameter( REPORT_FORMAT, s_cla_parser, unit_test::OF_CLF );
+ s_log_format = retrieve_parameter( LOG_FORMAT, s_cla_parser, unit_test::OF_CLF );
 
- unit_test::output_format of = retrieve_parameter( OUTPUT_FORMAT, s_cla_parser, unit_test::INV_OF );
+ unit_test::output_format of = retrieve_parameter( OUTPUT_FORMAT, s_cla_parser, unit_test::OF_INVALID );
 
- if( of != unit_test::INV_OF )
+ if( of != unit_test::OF_INVALID )
             s_report_format = s_log_format = of;
 
         s_test_to_run = retrieve_parameter<std::list<std::string> >( TESTS_TO_RUN, s_cla_parser );

Modified: trunk/boost/test/impl/xml_log_formatter.ipp
==============================================================================
--- trunk/boost/test/impl/xml_log_formatter.ipp (original)
+++ trunk/boost/test/impl/xml_log_formatter.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -9,7 +9,7 @@
 //
 // Version : $Revision$
 //
-// Description : implements XML Log formatter
+// Description : implements OF_XML Log formatter
 // ***************************************************************************
 
 #ifndef BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER
@@ -39,7 +39,7 @@
 
 static const_string tu_type_name( test_unit const& tu )
 {
- return tu.p_type == tut_case ? "TestCase" : "TestSuite";
+ return tu.p_type == TUT_CASE ? "TestCase" : "TestSuite";
 }
 
 // ************************************************************************** //
@@ -94,7 +94,7 @@
 void
 xml_log_formatter::test_unit_finish( std::ostream& ostr, test_unit const& tu, unsigned long elapsed )
 {
- if( tu.p_type == tut_case )
+ if( tu.p_type == TUT_CASE )
         ostr << "<TestingTime>" << elapsed << "</TestingTime>";
         
     ostr << "</" << tu_type_name( tu ) << ">";

Modified: trunk/boost/test/impl/xml_report_formatter.ipp
==============================================================================
--- trunk/boost/test/impl/xml_report_formatter.ipp (original)
+++ trunk/boost/test/impl/xml_report_formatter.ipp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -9,7 +9,7 @@
 //
 // Version : $Revision$
 //
-// Description : XML report formatter
+// Description : OF_XML report formatter
 // ***************************************************************************
 
 #ifndef BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER
@@ -64,18 +64,21 @@
     else
         descr = "failed";
 
- ostr << '<' << ( tu.p_type == tut_case ? "TestCase" : "TestSuite" )
+ ostr << '<' << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" )
          << " name" << attr_value() << tu.p_name.get()
          << " result" << attr_value() << descr
          << " assertions_passed" << attr_value() << tr.p_assertions_passed
          << " assertions_failed" << attr_value() << tr.p_assertions_failed
+ << " warnings_failed" << attr_value() << tr.p_warnings_failed
          << " expected_failures" << attr_value() << tr.p_expected_failures;
 
- if( tu.p_type == tut_suite )
+ if( tu.p_type == TUT_SUITE ) {
         ostr << " test_cases_passed" << attr_value() << tr.p_test_cases_passed
+ << " test_cases_passed_with_warnings" << attr_value() << tr.p_test_cases_warned
              << " test_cases_failed" << attr_value() << tr.p_test_cases_failed
              << " test_cases_skipped" << attr_value() << tr.p_test_cases_skipped
              << " test_cases_aborted" << attr_value() << tr.p_test_cases_aborted;
+ }
              
     
     ostr << '>';
@@ -86,7 +89,7 @@
 void
 xml_report_formatter::test_unit_report_finish( test_unit const& tu, std::ostream& ostr )
 {
- ostr << "</" << ( tu.p_type == tut_case ? "TestCase" : "TestSuite" ) << '>';
+ ostr << "</" << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" ) << '>';
 }
 
 //____________________________________________________________________________//

Modified: trunk/boost/test/output/xml_log_formatter.hpp
==============================================================================
--- trunk/boost/test/output/xml_log_formatter.hpp (original)
+++ trunk/boost/test/output/xml_log_formatter.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -9,7 +9,7 @@
 //
 // Version : $Revision$
 //
-// Description : contains XML Log formatter definition
+// Description : contains OF_XML Log formatter definition
 // ***************************************************************************
 
 #ifndef BOOST_TEST_XML_LOG_FORMATTER_020105GER

Modified: trunk/boost/test/output/xml_report_formatter.hpp
==============================================================================
--- trunk/boost/test/output/xml_report_formatter.hpp (original)
+++ trunk/boost/test/output/xml_report_formatter.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -9,7 +9,7 @@
 //
 // Version : $Revision$
 //
-// Description : XML report formatter implementation
+// Description : OF_XML report formatter implementation
 // ***************************************************************************
 
 #ifndef BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER

Modified: trunk/boost/test/progress_monitor.hpp
==============================================================================
--- trunk/boost/test/progress_monitor.hpp (original)
+++ trunk/boost/test/progress_monitor.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -36,22 +36,16 @@
 class BOOST_TEST_DECL progress_monitor_t : public test_observer, public singleton<progress_monitor_t> {
 public:
     // test observer interface
- void test_start( counter_t test_cases_amount );
- void test_finish() {}
- void test_aborted();
-
- void test_unit_start( test_unit const& ) {}
- void test_unit_finish( test_unit const&, unsigned long );
- void test_unit_skipped( test_unit const& );
- void test_unit_aborted( test_unit const& ) {}
+ virtual void test_start( counter_t test_cases_amount );
+ virtual void test_aborted();
 
- void assertion_result( bool ) {}
- void exception_caught( execution_exception const& ) {}
+ virtual void test_unit_finish( test_unit const&, unsigned long );
+ virtual void test_unit_skipped( test_unit const& );
 
- virtual int priority() { return 3; }
+ virtual int priority() { return 3; }
     
     // configuration
- void set_stream( std::ostream& );
+ void set_stream( std::ostream& );
 
 private:
     BOOST_TEST_SINGLETON_CONS( progress_monitor_t )

Modified: trunk/boost/test/results_collector.hpp
==============================================================================
--- trunk/boost/test/results_collector.hpp (original)
+++ trunk/boost/test/results_collector.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -53,8 +53,10 @@
 
     counter_prop p_assertions_passed;
     counter_prop p_assertions_failed;
+ counter_prop p_warnings_failed;
     counter_prop p_expected_failures;
     counter_prop p_test_cases_passed;
+ counter_prop p_test_cases_warned;
     counter_prop p_test_cases_failed;
     counter_prop p_test_cases_skipped;
     counter_prop p_test_cases_aborted;
@@ -78,17 +80,15 @@
 class BOOST_TEST_DECL results_collector_t : public test_observer, public singleton<results_collector_t> {
 public:
     // test_observer interface implementation
- void test_start( counter_t test_cases_amount );
- void test_finish();
- void test_aborted();
-
- void test_unit_start( test_unit const& );
- void test_unit_finish( test_unit const&, unsigned long elapsed );
- void test_unit_skipped( test_unit const& );
- void test_unit_aborted( test_unit const& );
+ virtual void test_start( counter_t test_cases_amount );
 
- void assertion_result( bool passed );
- void exception_caught( execution_exception const& );
+ virtual void test_unit_start( test_unit const& );
+ virtual void test_unit_finish( test_unit const&, unsigned long );
+ virtual void test_unit_skipped( test_unit const& );
+ virtual void test_unit_aborted( test_unit const& );
+
+ virtual void assertion_result( unit_test::assertion_result );
+ virtual void exception_caught( execution_exception const& );
 
     virtual int priority() { return 2; }
 

Modified: trunk/boost/test/tree/observer.hpp
==============================================================================
--- trunk/boost/test/tree/observer.hpp (original)
+++ trunk/boost/test/tree/observer.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -43,12 +43,22 @@
     virtual void test_unit_skipped( test_unit const& ) {}
     virtual void test_unit_aborted( test_unit const& ) {}
 
- virtual void assertion_result( bool /* passed */ ) {}
+ virtual void assertion_result( unit_test::assertion_result ar )
+ {
+ switch( ar ) {
+ case AR_PASSED: assertion_result( true ); break;
+ case AR_FAILED: assertion_result( false ); break;
+ case AR_TRIGGERED: break;
+ }
+ }
     virtual void exception_caught( execution_exception const& ) {}
 
     virtual int priority() { return 0; }
 
 protected:
+ // depracated now
+ virtual void assertion_result( bool /* passed */ ) {}
+
     BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {}
 };
 

Modified: trunk/boost/test/tree/test_unit.hpp
==============================================================================
--- trunk/boost/test/tree/test_unit.hpp (original)
+++ trunk/boost/test/tree/test_unit.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -44,13 +44,10 @@
 
 class BOOST_TEST_DECL test_unit {
 public:
- enum { type = tut_any };
+ enum { type = TUT_ANY };
     typedef std::list<test_unit_id> id_list;
     typedef std::list<test_unit_fixture_ptr> fixture_list;
 
- // Constructor
- test_unit( const_string tu_name, const_string tc_file, std::size_t tc_line, test_unit_type t );
-
     // dependencies management
     void depends_on( test_unit* tu );
     bool check_dependencies() const;
@@ -69,7 +66,7 @@
     typedef decorator::for_test_unit_ptr decorator_base;
 
     readonly_property<test_unit_type> p_type; // type for this test unit
- readonly_property<const_string> p_type_name; // "case"/"suite"
+ readonly_property<const_string> p_type_name; // "case"/"suite"/"module"
     readonly_property<const_string> p_file_name;
     readonly_property<std::size_t> p_line_num;
     id_t p_id; // unique id for this test unit
@@ -87,6 +84,10 @@
 
 protected:
     ~test_unit();
+ // Constructor
+ test_unit( const_string tu_name, const_string tc_file, std::size_t tc_line, test_unit_type t );
+ // Master test suite constructor
+ explicit test_unit( const_string module_name );
 
 private:
     // Data members
@@ -111,7 +112,7 @@
 
 class BOOST_TEST_DECL test_case : public test_unit {
 public:
- enum { type = tut_case };
+ enum { type = TUT_CASE };
 
     // Constructor
     test_case( const_string tc_name, boost::function<void ()> const& test_func );
@@ -133,7 +134,7 @@
 
 class BOOST_TEST_DECL test_suite : public test_unit {
 public:
- enum { type = tut_suite };
+ enum { type = TUT_SUITE };
 
     // Constructor
     explicit test_suite( const_string ts_name, const_string ts_file, std::size_t ts_line );
@@ -148,6 +149,9 @@
     std::size_t size() const { return m_members.size(); }
 
 protected:
+ // Master test suite constructor
+ explicit test_suite( const_string module_name );
+
     friend BOOST_TEST_DECL
     void traverse_test_tree( test_suite const&, test_tree_visitor&, bool );
     friend class framework_impl;
@@ -163,10 +167,7 @@
 
 class BOOST_TEST_DECL master_test_suite_t : public test_suite {
 public:
- master_test_suite_t() : test_suite( "Master Test Suite", "", 0 )
- , argc( 0 )
- , argv( 0 )
- {}
+ master_test_suite_t();
     
     // Data members
     int argc;

Modified: trunk/boost/test/tree/traverse.hpp
==============================================================================
--- trunk/boost/test/tree/traverse.hpp (original)
+++ trunk/boost/test/tree/traverse.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -42,7 +42,7 @@
 inline void
 traverse_test_tree( test_unit const& tu, test_tree_visitor& V, bool ignore_status = false )
 {
- if( tu.p_type == tut_case )
+ if( tu.p_type == TUT_CASE )
         traverse_test_tree( static_cast<test_case const&>( tu ), V, ignore_status );
     else
         traverse_test_tree( static_cast<test_suite const&>( tu ), V, ignore_status );

Modified: trunk/boost/test/unit_test_log.hpp
==============================================================================
--- trunk/boost/test/unit_test_log.hpp (original)
+++ trunk/boost/test/unit_test_log.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -91,17 +91,15 @@
 class BOOST_TEST_DECL unit_test_log_t : public test_observer, public singleton<unit_test_log_t> {
 public:
     // test_observer interface implementation
- void test_start( counter_t test_cases_amount );
- void test_finish();
- void test_aborted();
-
- void test_unit_start( test_unit const& );
- void test_unit_finish( test_unit const&, unsigned long elapsed );
- void test_unit_skipped( test_unit const& );
- void test_unit_aborted( test_unit const& );
+ virtual void test_start( counter_t test_cases_amount );
+ virtual void test_finish();
+ virtual void test_aborted();
+
+ virtual void test_unit_start( test_unit const& );
+ virtual void test_unit_finish( test_unit const&, unsigned long elapsed );
+ virtual void test_unit_skipped( test_unit const& );
 
- void assertion_result( bool passed );
- void exception_caught( execution_exception const& );
+ virtual void exception_caught( execution_exception const& ex );
 
     virtual int priority() { return 1; }
 

Modified: trunk/boost/test/utils/class_properties.hpp
==============================================================================
--- trunk/boost/test/utils/class_properties.hpp (original)
+++ trunk/boost/test/utils/class_properties.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -115,28 +115,6 @@
 
 #undef DEFINE_PROPERTY_FREE_BINARY_OPERATOR
 
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-
-#define DEFINE_PROPERTY_LOGICAL_OPERATOR( op ) \
-template<class PropertyType> \
-inline bool \
-operator op( bool b, class_property<PropertyType> const& p ) \
-{ \
- return b op p.get(); \
-} \
-template<class PropertyType> \
-inline bool \
-operator op( class_property<PropertyType> const& p, bool b ) \
-{ \
- return b op p.get(); \
-} \
-/**/
-
-DEFINE_PROPERTY_LOGICAL_OPERATOR( && )
-DEFINE_PROPERTY_LOGICAL_OPERATOR( || )
-
-#endif
-
 // ************************************************************************** //
 // ************** readonly_property ************** //
 // ************************************************************************** //

Modified: trunk/boost/test/utils/xml_printer.hpp
==============================================================================
--- trunk/boost/test/utils/xml_printer.hpp (original)
+++ trunk/boost/test/utils/xml_printer.hpp 2012-11-13 07:17:51 EST (Tue, 13 Nov 2012)
@@ -9,7 +9,7 @@
 //
 // Version : $Revision$
 //
-// Description : common code used by any agent serving as XML printer
+// Description : common code used by any agent serving as OF_XML printer
 // ***************************************************************************
 
 #ifndef BOOST_TEST_XML_PRINTER_HPP_071894GER


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