diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 458d904f..ad2ebd02 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -90,6 +90,7 @@ set(BOOST_UTF_SRC ${BOOST_TEST_ROOT_DIR}/src/progress_monitor.cpp ${BOOST_TEST_ROOT_DIR}/src/results_collector.cpp ${BOOST_TEST_ROOT_DIR}/src/results_reporter.cpp + ${BOOST_TEST_ROOT_DIR}/src/test_framework_init_observer.cpp ${BOOST_TEST_ROOT_DIR}/src/test_tools.cpp ${BOOST_TEST_ROOT_DIR}/src/test_tree.cpp ${BOOST_TEST_ROOT_DIR}/src/unit_test_log.cpp diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 529e0711..0665f3fd 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -47,6 +47,7 @@ TEST_EXEC_MON_SOURCES = progress_monitor results_collector results_reporter + test_framework_init_observer test_main test_tools test_tree @@ -69,6 +70,7 @@ UTF_SOURCES = progress_monitor results_collector results_reporter + test_framework_init_observer test_tools test_tree unit_test_log diff --git a/include/boost/test/detail/fwd_decl.hpp b/include/boost/test/detail/fwd_decl.hpp index 944d5226..d5c97fb7 100644 --- a/include/boost/test/detail/fwd_decl.hpp +++ b/include/boost/test/detail/fwd_decl.hpp @@ -26,6 +26,7 @@ class master_test_suite_t; class test_tree_visitor; class test_observer; +class test_unit_fixture; // singletons class unit_test_monitor_t; diff --git a/include/boost/test/detail/global_typedef.hpp b/include/boost/test/detail/global_typedef.hpp index b9cfeb52..aeede00e 100644 --- a/include/boost/test/detail/global_typedef.hpp +++ b/include/boost/test/detail/global_typedef.hpp @@ -71,6 +71,21 @@ test_id_2_unit_type( test_unit_id id ) return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE; } +//! Helper class for restoring the current test unit ID in a RAII manner +struct test_unit_id_restore { + test_unit_id_restore(test_unit_id& to_restore_, test_unit_id new_value) + : to_restore(to_restore_) + , bkup(to_restore_) { + to_restore = new_value; + } + ~test_unit_id_restore() { + to_restore = bkup; + } +private: + test_unit_id& to_restore; + test_unit_id bkup; +}; + //____________________________________________________________________________// } // namespace ut_detail diff --git a/include/boost/test/execution_monitor.hpp b/include/boost/test/execution_monitor.hpp index adfb0336..ed06ef25 100644 --- a/include/boost/test/execution_monitor.hpp +++ b/include/boost/test/execution_monitor.hpp @@ -270,6 +270,7 @@ public: /// Simple model for the location of failure in a source code struct BOOST_TEST_DECL location { explicit location( char const* file_name = 0, size_t line_num = 0, char const* func = 0 ); + explicit location( const_string file_name, size_t line_num = 0, char const* func = 0 ); const_string m_file_name; ///< File name size_t m_line_num; ///< Line number diff --git a/include/boost/test/framework.hpp b/include/boost/test/framework.hpp index f94bcf12..099c0296 100644 --- a/include/boost/test/framework.hpp +++ b/include/boost/test/framework.hpp @@ -74,7 +74,7 @@ BOOST_TEST_DECL bool test_in_progress(); /// This function shuts down the framework and clears up its mono-state. /// /// It needs to be at the very end of test module execution -BOOST_TEST_DECL void shutdown(); +BOOST_TEST_DECL void shutdown(); /// @} /// @name Test unit registration @@ -132,12 +132,28 @@ BOOST_TEST_DECL void clear(); /// @param[in] to test observer object to add BOOST_TEST_DECL void register_observer( test_observer& to ); -/// Excldes the observer object form the framework's list of test observers +/// Excludes the observer object form the framework's list of test observers /// @param[in] to test observer object to exclude BOOST_TEST_DECL void deregister_observer( test_observer& to ); /// @} +/// @name Global fixtures registration +/// @{ + +/// Adds a new global fixture to be setup before any other tests starts and tore down after +/// any other tests finished. +/// Test unit fixture lifetime should exceed the testing execution timeframe +/// @param[in] tuf fixture to add +BOOST_TEST_DECL void register_global_fixture( test_unit_fixture& tuf ); + +/// Removes a test global fixture from the framework +/// +/// Test unit fixture lifetime should exceed the testing execution timeframe +/// @param[in] tuf fixture to remove +BOOST_TEST_DECL void deregister_global_fixture( test_unit_fixture& tuf ); +/// @} + /// @name Assertion/uncaught exception context support /// @{ /// Context accessor @@ -178,6 +194,15 @@ BOOST_TEST_DECL context_generator get_context(); /// @returns a reference the master test suite instance BOOST_TEST_DECL master_test_suite_t& master_test_suite(); +/// This function provides an access to the test unit currently being executed. + +/// The difference with current_test_case is about the time between a test-suite +/// is being set up or torn down (fixtures) and when the test-cases of that suite start. + +/// This function is only valid during test execution phase. +/// @see current_test_case_id, current_test_case +BOOST_TEST_DECL test_unit const& current_test_unit(); + /// This function provides an access to the test case currently being executed. /// This function is only valid during test execution phase. @@ -231,6 +256,8 @@ BOOST_TEST_DECL void assertion_result( unit_test::assertion_resul BOOST_TEST_DECL void exception_caught( execution_exception const& ); /// Reports aborted test unit to all test observers BOOST_TEST_DECL void test_unit_aborted( test_unit const& ); +/// Reports aborted test module to all test observers +BOOST_TEST_DECL void test_aborted( ); /// @} namespace impl { diff --git a/include/boost/test/impl/compiler_log_formatter.ipp b/include/boost/test/impl/compiler_log_formatter.ipp index a4e045ca..4887ff58 100644 --- a/include/boost/test/impl/compiler_log_formatter.ipp +++ b/include/boost/test/impl/compiler_log_formatter.ipp @@ -52,7 +52,7 @@ namespace { std::string test_phase_identifier() { - return framework::test_in_progress() ? framework::current_test_case().full_name() : std::string( "Test setup" ); + return framework::test_in_progress() ? framework::current_test_unit().full_name() : std::string( "Test setup" ); } } // local namespace diff --git a/include/boost/test/impl/execution_monitor.ipp b/include/boost/test/impl/execution_monitor.ipp index 0c5690ca..94b6f9fb 100644 --- a/include/boost/test/impl/execution_monitor.ipp +++ b/include/boost/test/impl/execution_monitor.ipp @@ -1342,6 +1342,12 @@ execution_exception::location::location( char const* file_name, size_t line_num, , m_function( func ) {} +execution_exception::location::location(const_string file_name, size_t line_num, char const* func ) +: m_file_name( file_name ) +, m_line_num( line_num ) +, m_function( func ) +{} + //____________________________________________________________________________// // ************************************************************************** // diff --git a/include/boost/test/impl/framework.ipp b/include/boost/test/impl/framework.ipp index 53738c24..ca35ce1c 100644 --- a/include/boost/test/impl/framework.ipp +++ b/include/boost/test/impl/framework.ipp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -71,6 +72,7 @@ namespace std { using ::time; using ::srand; } namespace boost { namespace unit_test { namespace framework { + namespace impl { // ************************************************************************** // @@ -457,6 +459,27 @@ void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r ) #endif + +// A simple handle for registering the global fixtures to the master test suite +// without deleting an existing static object (the global fixture itself) when the program +// terminates (shared_ptr). +class global_fixture_handle : public test_unit_fixture { +public: + global_fixture_handle(test_unit_fixture* fixture) : m_global_fixture(fixture) {} + ~global_fixture_handle() {} + + virtual void setup() { + m_global_fixture->setup(); + } + virtual void teardown() { + m_global_fixture->teardown(); + } + +private: + test_unit_fixture* m_global_fixture; +}; + + } // namespace impl // ************************************************************************** // @@ -468,7 +491,7 @@ unsigned const TIMEOUT_EXCEEDED = static_cast( -1 ); class state { public: state() - : m_curr_test_case( INV_TEST_UNIT_ID ) + : m_curr_test_unit( INV_TEST_UNIT_ID ) , m_next_test_case_id( MIN_TEST_CASE_ID ) , m_next_test_suite_id( MIN_TEST_SUITE_ID ) , m_test_in_progress( false ) @@ -625,7 +648,7 @@ public: } }; - // Executed the test tree with the root at specified test unit + // Executes the test tree with the root at specified test unit execution_result execute_test_tree( test_unit_id tu_id, unsigned timeout = 0, random_generator_helper const * const p_random_generator = 0) @@ -664,9 +687,15 @@ public: // 30. Execute setup fixtures if any; any failure here leads to test unit abortion BOOST_TEST_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { + ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); result = unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::setup, F ) ); if( result != unit_test_monitor_t::test_ok ) break; + test_results const& test_rslt = unit_test::results_collector.results( m_curr_test_unit ); + if( test_rslt.aborted() ) { + result = unit_test_monitor_t::precondition_failure; + break; + } } // This is the time we are going to spend executing the test unit @@ -736,8 +765,7 @@ public: m_context_idx = 0; // setup current test case - test_unit_id bkup = m_curr_test_case; - m_curr_test_case = tc.p_id; + ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tc.p_id); // execute the test case body result = unit_test_monitor.execute_and_translate( tc.p_test_func, timeout ); @@ -746,8 +774,7 @@ public: // cleanup leftover context m_context.clear(); - // restore state and abort if necessary - m_curr_test_case = bkup; + // restore state (scope exit) and abort if necessary } } @@ -755,6 +782,7 @@ public: if( !unit_test_monitor.is_critical_error( result ) ) { // execute teardown fixtures if any in reverse order BOOST_TEST_REVERSE_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { + ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); result = (std::min)( result, unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::teardown, F ), 0 ) ); if( unit_test_monitor.is_critical_error( result ) ) @@ -813,7 +841,7 @@ public: master_test_suite_t* m_master_test_suite; std::vector m_auto_test_suites; - test_unit_id m_curr_test_case; + test_unit_id m_curr_test_unit; test_unit_store m_test_units; test_unit_id m_next_test_case_id; @@ -825,6 +853,8 @@ public: context_data m_context; int m_context_idx; + std::set m_global_fixtures; + boost::execution_monitor m_aux_em; std::map m_log_sinks; @@ -1069,6 +1099,7 @@ init( init_unit_test_func init_func, int argc, char* argv[] ) // 40. Register default test observers register_observer( results_collector ); register_observer( unit_test_log ); + register_observer( framework_init_observer ); if( runtime_config::get( runtime_config::btrt_show_progress ) ) { progress_monitor.set_stream( std::cout ); // defaults to stdout @@ -1261,6 +1292,30 @@ deregister_observer( test_observer& to ) //____________________________________________________________________________// +// ************************************************************************** // +// ************** register_global_fixture ************** // +// ************************************************************************** // + +void +register_global_fixture( test_unit_fixture& tuf ) +{ + impl::s_frk_state().m_global_fixtures.insert( &tuf ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** deregister_global_fixture ************** // +// ************************************************************************** // + +void +deregister_global_fixture( test_unit_fixture &tuf ) +{ + impl::s_frk_state().m_global_fixtures.erase( &tuf ); +} + +//____________________________________________________________________________// + // ************************************************************************** // // ************** add_context ************** // // ************************************************************************** // @@ -1389,7 +1444,14 @@ current_auto_test_suite( test_suite* ts, bool push_or_pop ) test_case const& current_test_case() { - return get( impl::s_frk_state().m_curr_test_case ); + return get( impl::s_frk_state().m_curr_test_unit ); +} + + +test_unit const& +current_test_unit() +{ + return *impl::s_frk_state().m_test_units[impl::s_frk_state().m_curr_test_unit]; } //____________________________________________________________________________// @@ -1397,7 +1459,7 @@ current_test_case() test_unit_id current_test_case_id() { - return impl::s_frk_state().m_curr_test_case; + return impl::s_frk_state().m_curr_test_unit; } //____________________________________________________________________________// @@ -1422,6 +1484,17 @@ get( test_unit_id id, test_unit_type t ) // ************** framework::run ************** // // ************************************************************************** // +template +struct swap_on_delete { + swap_on_delete(Cont& c1, Cont& c2) : m_c1(c1), m_c2(c2){} + ~swap_on_delete() { + m_c1.swap(m_c2); + } + + Cont& m_c1; + Cont& m_c2; +}; + void run( test_unit_id id, bool continue_test ) { @@ -1440,39 +1513,90 @@ run( test_unit_id id, bool continue_test ) bool was_in_progress = framework::test_in_progress(); bool call_start_finish = !continue_test || !was_in_progress; - - impl::s_frk_state().m_test_in_progress = true; + bool init_ok = true; + const_string setup_error; if( call_start_finish ) { + // indicates the framework that no test is in progress now if observers need to be notified + impl::s_frk_state().m_test_in_progress = false; + // unit_test::framework_init_observer will get cleared first BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { BOOST_TEST_I_TRY { - impl::s_frk_state().m_aux_em.vexecute( boost::bind( &test_observer::test_start, to, tcc.p_count ) ); + ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); + unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count ) ); + if( init_ok ) { + if( result != unit_test_monitor_t::test_ok ) { + init_ok = false; + } + else { + if( unit_test::framework_init_observer.has_failed() ) { + init_ok = false; + } + } + } } BOOST_TEST_I_CATCH( execution_exception, ex ) { - BOOST_TEST_SETUP_ASSERT( false, ex.what() ); + if( init_ok ) { + // log only the first error + init_ok = false; + setup_error = ex.what(); + } + // break; // we should continue otherwise loggers may have improper structure (XML start missing for instance) } } } - unsigned seed = runtime_config::get( runtime_config::btrt_random_seed ); - switch( seed ) { - case 0: - break; - case 1: - seed = static_cast( std::rand() ^ std::time( 0 ) ); // better init using std::rand() ^ ... - default: - BOOST_TEST_FRAMEWORK_MESSAGE( "Test cases order is shuffled using seed: " << seed ); - std::srand( seed ); + if( init_ok ) { + + // attaching the global fixtures to the main entry point + test_unit& entry_test_unit = framework::get( id, TUT_ANY ); + std::vector v_saved_fixture(entry_test_unit.p_fixtures.value.begin(), + entry_test_unit.p_fixtures.value.end()); + + BOOST_TEST_FOREACH( test_unit_fixture*, tuf, impl::s_frk_state().m_global_fixtures ) { + entry_test_unit.p_fixtures.value.insert( entry_test_unit.p_fixtures.value.begin(), + test_unit_fixture_ptr(new impl::global_fixture_handle(tuf)) ); + } + + swap_on_delete< std::vector > raii_fixture(v_saved_fixture, entry_test_unit.p_fixtures.value); + + // now work in progress + impl::s_frk_state().m_test_in_progress = true; + unsigned seed = runtime_config::get( runtime_config::btrt_random_seed ); + switch( seed ) { + case 0: + break; + case 1: + seed = static_cast( std::rand() ^ std::time( 0 ) ); // better init using std::rand() ^ ... + default: + BOOST_TEST_FRAMEWORK_MESSAGE( "Test cases order is shuffled using seed: " << seed ); + std::srand( seed ); + } + + // executing the test tree + impl::s_frk_state().execute_test_tree( id ); + + // removing previously added global fixtures: dtor raii_fixture } - impl::s_frk_state().execute_test_tree( id ); + impl::s_frk_state().m_test_in_progress = false; + unit_test::framework_init_observer.clear(); if( call_start_finish ) { - BOOST_TEST_REVERSE_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) + // indicates the framework that no test is in progress anymore if observers need to be notified + // and this is a teardown, so assertions should not raise any exception otherwise an exception + // might be raised in a dtor of a global fixture + impl::s_frk_state().m_test_in_progress = false; + BOOST_TEST_REVERSE_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { + ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); to->test_finish(); + } } impl::s_frk_state().m_test_in_progress = was_in_progress; + + // propagates the init/teardown error if any + BOOST_TEST_SETUP_ASSERT( init_ok && !unit_test::framework_init_observer.has_failed(), setup_error ); } //____________________________________________________________________________// @@ -1522,6 +1646,18 @@ test_unit_aborted( test_unit const& tu ) to->test_unit_aborted( tu ); } +// ************************************************************************** // +// ************** test_aborted ************** // +// ************************************************************************** // + +void +test_aborted( ) +{ + BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) + to->test_aborted( ); +} + + //____________________________________________________________________________// } // namespace framework diff --git a/include/boost/test/impl/results_collector.ipp b/include/boost/test/impl/results_collector.ipp index daee8bc3..fd74bdb6 100644 --- a/include/boost/test/impl/results_collector.ipp +++ b/include/boost/test/impl/results_collector.ipp @@ -59,6 +59,12 @@ test_results::passed() const !p_aborted; } +bool +test_results::aborted() const +{ + return p_aborted; +} + //____________________________________________________________________________// int diff --git a/include/boost/test/impl/test_framework_init_observer.ipp b/include/boost/test/impl/test_framework_init_observer.ipp new file mode 100644 index 00000000..89f854aa --- /dev/null +++ b/include/boost/test/impl/test_framework_init_observer.ipp @@ -0,0 +1,109 @@ +// (c) Copyright Raffi Enficiaud 2017. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! An observer for monitoring the success/failure of the other observers +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER +#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER + +// Boost.Test +#include +#include +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** framework_init_observer_t ************** // +// ************************************************************************** // + +namespace { + +struct test_init_observer_check { + bool has_failure; + + void clear() + { + has_failure = false; + } +}; + + +test_init_observer_check& s_tioc_impl() { static test_init_observer_check the_inst; return the_inst; } + +} // local namespace + +void +framework_init_observer_t::clear() +{ + if(!framework::test_in_progress()) + s_tioc_impl().clear(); +} + +//____________________________________________________________________________// + +void +framework_init_observer_t::test_start( counter_t ) +{ + clear(); +} + +//____________________________________________________________________________// + +void +framework_init_observer_t::assertion_result( unit_test::assertion_result ar ) +{ + test_init_observer_check& tr = s_tioc_impl(); + switch( ar ) { + case AR_TRIGGERED: break; + case AR_PASSED: break; + case AR_FAILED: tr.has_failure = true; break; + default: + break; + } +} + +//____________________________________________________________________________// + +void +framework_init_observer_t::exception_caught( execution_exception const& ) +{ + test_init_observer_check& tr = s_tioc_impl(); + tr.has_failure = true; +} + +void +framework_init_observer_t::test_aborted() +{ + s_tioc_impl().has_failure = true; +} + + +//____________________________________________________________________________// + +bool +framework_init_observer_t::has_failed() const +{ + return s_tioc_impl().has_failure; +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER diff --git a/include/boost/test/impl/test_tools.ipp b/include/boost/test/impl/test_tools.ipp index 853b3913..37ebc20b 100644 --- a/include/boost/test/impl/test_tools.ipp +++ b/include/boost/test/impl/test_tools.ipp @@ -310,8 +310,19 @@ report_assertion( assertion_result const& ar, { using namespace unit_test; - BOOST_TEST_I_ASSRT( framework::current_test_case_id() != INV_TEST_UNIT_ID, - std::runtime_error( "Can't use testing tools outside of test case implementation." ) ); + if( !framework::test_in_progress() ) { + // in case no test is in progress, we do not throw anything: + // raising an exception here may result in raising an exception in a destructor of a global fixture + // which will abort the process + // We flag this as aborted instead + + //BOOST_TEST_I_ASSRT( framework::current_test_case_id() != INV_TEST_UNIT_ID, + // std::runtime_error( "Can't use testing tools outside of test case implementation." ) ); + + framework::test_aborted(); + return false; + } + if( !!ar ) tl = PASS; @@ -369,10 +380,9 @@ report_assertion( assertion_result const& ar, case REQUIRE: framework::assertion_result( AR_FAILED ); - - framework::test_unit_aborted( framework::current_test_case() ); - + framework::test_unit_aborted( framework::current_test_unit() ); BOOST_TEST_I_THROW( execution_aborted() ); + return false; } return true; @@ -493,7 +503,7 @@ struct output_test_stream::Impl char get_char() { - char res; + char res = 0; do { m_pattern.get( res ); } while( m_text_or_binary && res == '\r' && !m_pattern.fail() && !m_pattern.eof() ); @@ -619,6 +629,7 @@ output_test_stream::match_pattern( bool flush_stream ) int offset = 0; std::vector last_elements; for ( std::string::size_type i = 0; static_cast(i + offset) < static_cast(stream_string_repr.length()); ++i ) { + char c = m_pimpl->get_char(); if( last_elements.size() <= n_chars_presuffix ) { @@ -698,7 +709,7 @@ output_test_stream::match_pattern( bool flush_stream ) if( last_elements_ordered[pattern_start_index + k] == sub_str_suffix[stream_start_index + k] ) nb_char_in_common ++; else - break; // we take fully macthing substring only + break; // we take fully matching substring only } if( nb_char_in_common > max_nb_char_in_common ) { @@ -709,20 +720,32 @@ output_test_stream::match_pattern( bool flush_stream ) } } - // indicates with more precision the location of the mismatchs in ascii arts ... + // indicates with more precision the location of the mismatchs in "ascii arts" ... result.message() << " ...\n... "; for( std::string::size_type j = 0; j < sub_str_prefix.size(); j++) { result.message() << ' '; } - for( std::size_t k = 0; k < (std::max)(best_pattern_start_index, best_stream_start_index); k++ ) { // 1 is for the current char c + result.message() << '~'; // places the first tilde at the current char that mismatches + + for( std::size_t k = 1; k < (std::max)(best_pattern_start_index, best_stream_start_index); k++ ) { // 1 is for the current char c std::string s1(pretty_print_log(std::string(1, last_elements_ordered[(std::min)(k, best_pattern_start_index)]))); std::string s2(pretty_print_log(std::string(1, sub_str_suffix[(std::min)(k, best_stream_start_index)]))); for( int h = (std::max)(s1.size(), s2.size()); h > 0; h--) - result.message() << "~"; + result.message() << "~"; } + + if( m_pimpl->m_pattern.eof() ) { + result.message() << " (reference string shorter than current stream)"; + } + result.message() << "\n"; + // no need to continue if the EOF is reached + if( m_pimpl->m_pattern.eof() ) { + break; + } + // first char is a replicat of c, so we do not copy it. for(std::string::size_type counter = 0; counter < last_elements_ordered.size() - 1 ; counter++) last_elements[ (i + 1 + counter) % last_elements.size() ] = last_elements_ordered[counter + 1]; diff --git a/include/boost/test/impl/test_tree.ipp b/include/boost/test/impl/test_tree.ipp index 08bdad33..81995bb2 100644 --- a/include/boost/test/impl/test_tree.ipp +++ b/include/boost/test/impl/test_tree.ipp @@ -447,10 +447,29 @@ auto_test_unit_registrar::auto_test_unit_registrar( int ) // ************************************************************************** // global_fixture::global_fixture() +{ + framework::register_global_fixture( *this ); +} + +global_fixture::~global_fixture() +{ + framework::deregister_global_fixture( *this ); +} + +// ************************************************************************** // +// ************** global_configuration ************** // +// ************************************************************************** // + +global_configuration::global_configuration() { framework::register_observer( *this ); } +global_configuration::~global_configuration() +{ + framework::deregister_observer( *this ); +} + //____________________________________________________________________________// } // namespace unit_test diff --git a/include/boost/test/impl/unit_test_log.ipp b/include/boost/test/impl/unit_test_log.ipp index c52260b9..717e166b 100644 --- a/include/boost/test/impl/unit_test_log.ipp +++ b/include/boost/test/impl/unit_test_log.ipp @@ -171,6 +171,8 @@ unit_test_log_t::test_start( counter_t test_cases_amount ) if( runtime_config::get( runtime_config::btrt_build_info ) ) current_logger_data.m_log_formatter->log_build_info( current_logger_data.stream() ); + //current_logger_data.stream().flush(); + current_logger_data.m_entry_in_progress = false; } } diff --git a/include/boost/test/impl/unit_test_monitor.ipp b/include/boost/test/impl/unit_test_monitor.ipp index fdd36f7c..cfb41a23 100644 --- a/include/boost/test/impl/unit_test_monitor.ipp +++ b/include/boost/test/impl/unit_test_monitor.ipp @@ -47,7 +47,7 @@ unit_test_monitor_t::execute_and_translate( boost::function const& func } BOOST_TEST_I_CATCH( execution_exception, ex ) { framework::exception_caught( ex ); - framework::test_unit_aborted( framework::current_test_case() ); + framework::test_unit_aborted( framework::current_test_unit() ); // translate execution_exception::error_code to error_level switch( ex.code() ) { diff --git a/include/boost/test/included/test_exec_monitor.hpp b/include/boost/test/included/test_exec_monitor.hpp index 34b6ef44..e75b4698 100644 --- a/include/boost/test/included/test_exec_monitor.hpp +++ b/include/boost/test/included/test_exec_monitor.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/include/boost/test/included/unit_test.hpp b/include/boost/test/included/unit_test.hpp index 993d75e4..90882eb1 100644 --- a/include/boost/test/included/unit_test.hpp +++ b/include/boost/test/included/unit_test.hpp @@ -5,6 +5,7 @@ // See http://www.boost.org/libs/test for the library home page. // +// //!@file //!@brief Included (vs. linked) version of Unit Test Framework // *************************************************************************** @@ -24,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/test/progress_monitor.hpp b/include/boost/test/progress_monitor.hpp index e480ac66..2f661f58 100644 --- a/include/boost/test/progress_monitor.hpp +++ b/include/boost/test/progress_monitor.hpp @@ -41,7 +41,7 @@ public: virtual void test_unit_finish( test_unit const&, unsigned long ); virtual void test_unit_skipped( test_unit const&, const_string ); - virtual int priority() { return 3; } + virtual int priority() { return 4; } /// @} /// @name Configuration diff --git a/include/boost/test/results_collector.hpp b/include/boost/test/results_collector.hpp index 7d2c2bee..3acd7b87 100644 --- a/include/boost/test/results_collector.hpp +++ b/include/boost/test/results_collector.hpp @@ -79,6 +79,9 @@ public: /// Returns true if test unit passed bool passed() const; + /// Returns true if the test unit was aborted (hard failure) + bool aborted() const; + /// Produces result code for the test unit execution /// /// This methhod return one of the result codes defined in @c boost/cstdlib.hpp @@ -119,7 +122,7 @@ public: virtual void assertion_result( unit_test::assertion_result ); virtual void exception_caught( execution_exception const& ); - virtual int priority() { return 2; } + virtual int priority() { return 3; } /// Results access per test unit /// diff --git a/include/boost/test/test_framework_init_observer.hpp b/include/boost/test/test_framework_init_observer.hpp new file mode 100644 index 00000000..cdf5ef5e --- /dev/null +++ b/include/boost/test/test_framework_init_observer.hpp @@ -0,0 +1,63 @@ +// (c) Copyright Raffi Enficiaud 2017. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Defines an observer that monitors the init of the unit test framework +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER +#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER + +// Boost.Test +#include + +#include +#include + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +/// @brief Monitors the init of the framework +/// +/// This class collects the state of the init/termination of the unit test framework. +/// +/// @see boost::unit_test::test_observer +class BOOST_TEST_DECL framework_init_observer_t : public test_observer, public singleton { +public: + + virtual void test_start( counter_t ); + + virtual void assertion_result( unit_test::assertion_result ); + virtual void exception_caught( execution_exception const& ); + virtual void test_aborted(); + + virtual int priority() { return 0; } + + void clear(); + + /// Indicates if a failure has been recorded so far + bool has_failed( ) const; + +private: + BOOST_TEST_SINGLETON_CONS( framework_init_observer_t ) +}; + +BOOST_TEST_SINGLETON_INST( framework_init_observer ) + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER diff --git a/include/boost/test/tree/fixture.hpp b/include/boost/test/tree/fixture.hpp index 7bca5a8d..1cdceb75 100644 --- a/include/boost/test/tree/fixture.hpp +++ b/include/boost/test/tree/fixture.hpp @@ -5,11 +5,8 @@ // See http://www.boost.org/libs/test for the library home page. // -// File : $RCSfile$ -// -// Version : $Revision: 74640 $ -// -// Description : defines fixture interface and object makers +/// @file +/// Defines fixture interface and object makers // *************************************************************************** #ifndef BOOST_TEST_TREE_FIXTURE_HPP_100311GER @@ -45,6 +42,56 @@ public: typedef shared_ptr test_unit_fixture_ptr; +// ************************************************************************** // +// ************** fixture helper functions ************** // +// ************************************************************************** // + + +namespace fixture_details { + + template + struct has_setup { + template struct detect {}; + template static char Test(detect*); + template static int Test(...); + static const bool value = sizeof(Test(0)) == sizeof(char); + }; + + template + struct has_teardown { + template struct detect {}; + template static char Test(detect*); + template static int Test(...); + static const bool value = sizeof(Test(0)) == sizeof(char); + }; + + template + struct call_setup { template void operator()(U& u) { } }; + + template <> + struct call_setup { template void operator()(U& u) { u.setup(); } }; + + template + struct call_teardown { template void operator()(U& u) { } }; + + template <> + struct call_teardown { template void operator()(U& u) { u.teardown(); } }; + + //! Calls the fixture "setup" if detected by the compiler, otherwise does nothing. + template + void setup_conditional(U& u) { + return call_setup::value>()(u); + } + + //! Calls the fixture "teardown" if detected by the compiler, otherwise does nothing. + template + void teardown_conditional(U& u) { + return call_teardown::value>()(u); + } + +} + + // ************************************************************************** // // ************** class_based_fixture ************** // // ************************************************************************** // @@ -57,8 +104,8 @@ public: private: // Fixture interface - virtual void setup() { m_inst.reset( new F( m_arg ) ); } - virtual void teardown() { m_inst.reset(); } + virtual void setup() { m_inst.reset( new F( m_arg ) ); fixture_details::setup_conditional(*m_inst); } + virtual void teardown() { fixture_details::teardown_conditional(*m_inst); m_inst.reset(); } // Data members scoped_ptr m_inst; @@ -75,8 +122,8 @@ public: private: // Fixture interface - virtual void setup() { m_inst.reset( new F ); } - virtual void teardown() { m_inst.reset(); } + virtual void setup() { m_inst.reset( new F ); fixture_details::setup_conditional(*m_inst); } + virtual void teardown() { fixture_details::teardown_conditional(*m_inst); m_inst.reset(); } // Data members scoped_ptr m_inst; diff --git a/include/boost/test/tree/global_fixture.hpp b/include/boost/test/tree/global_fixture.hpp index 21145959..38ab146f 100644 --- a/include/boost/test/tree/global_fixture.hpp +++ b/include/boost/test/tree/global_fixture.hpp @@ -17,6 +17,7 @@ #include #include +#include #include @@ -26,14 +27,37 @@ namespace boost { namespace unit_test { +// ************************************************************************** // +// ************** global_configuration ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL global_configuration : public test_observer { + +public: + // Constructor + global_configuration(); + + // Dtor + virtual ~global_configuration(); + + // Happens after the framework global observer init has been done + virtual int priority() { return 1; } +}; + + + // ************************************************************************** // // ************** global_fixture ************** // // ************************************************************************** // -class BOOST_TEST_DECL global_fixture : public test_observer { +class BOOST_TEST_DECL global_fixture : public test_unit_fixture { + public: // Constructor global_fixture(); + + // Dtor + virtual ~global_fixture(); }; //____________________________________________________________________________// @@ -41,14 +65,48 @@ public: namespace ut_detail { template -struct global_fixture_impl : public global_fixture { +struct global_configuration_impl : public global_configuration { // Constructor - global_fixture_impl() : m_fixture( 0 ) {} + global_configuration_impl() : m_configuration_observer( 0 ) { + } // test observer interface - virtual void test_start( counter_t ) { m_fixture = new F; } - virtual void test_finish() { delete m_fixture; m_fixture = 0; } - virtual void test_aborted() { delete m_fixture; m_fixture = 0; } + virtual void test_start( counter_t ) { + m_configuration_observer = new F; + } + + // test observer interface + virtual void test_finish() { + if(m_configuration_observer) { + delete m_configuration_observer; + m_configuration_observer = 0; + } + } +private: + // Data members + F* m_configuration_observer; +}; + +template +struct global_fixture_impl : public global_fixture { + // Constructor + global_fixture_impl() : m_fixture( 0 ) { + } + + // test fixture interface + virtual void setup() { + m_fixture = new F; + fixture_details::setup_conditional(*m_fixture); + } + + // test fixture interface + virtual void teardown() { + if(m_fixture) { + fixture_details::teardown_conditional(*m_fixture); + } + delete m_fixture; + m_fixture = 0; + } private: // Data members diff --git a/include/boost/test/tree/observer.hpp b/include/boost/test/tree/observer.hpp index 4db930fb..bd6fc9bf 100644 --- a/include/boost/test/tree/observer.hpp +++ b/include/boost/test/tree/observer.hpp @@ -34,7 +34,7 @@ namespace unit_test { /// Boost.Test framework on the current execution state. /// /// Several observers can be running at the same time, and it is not unusual to -/// have interactions among them. The test_observer#priority member function allows the specification +/// have interactions among them. The @ref test_observer::priority member function allows the specification /// of a particular order among them (lowest priority executed first, except specified otherwise). /// class BOOST_TEST_DECL test_observer { @@ -44,10 +44,8 @@ public: //! //! @param[in] number_of_test_cases indicates the number of test cases. Only active //! test cases are taken into account. - //! virtual void test_start( counter_t /* number_of_test_cases */ ) {} - //! Called after the framework ends executing the test cases //! //! @note The call is made with a reversed priority order. @@ -98,6 +96,8 @@ public: //! additional data about the exception. virtual void exception_caught( execution_exception const& ) {} + //! The priority indicates the order at which this observer is initialized + //! and tore down in the UTF framework. The order is lowest to highest priority. virtual int priority() { return 0; } protected: diff --git a/include/boost/test/unit_test_log.hpp b/include/boost/test/unit_test_log.hpp index ba998b0c..4e6a97b3 100644 --- a/include/boost/test/unit_test_log.hpp +++ b/include/boost/test/unit_test_log.hpp @@ -123,7 +123,7 @@ public: virtual void exception_caught( execution_exception const& ex ); - virtual int priority() { return 1; } + virtual int priority() { return 2; } // log configuration methods //! Sets the stream for all loggers diff --git a/include/boost/test/unit_test_suite.hpp b/include/boost/test/unit_test_suite.hpp index b434fa9f..1247b681 100644 --- a/include/boost/test/unit_test_suite.hpp +++ b/include/boost/test/unit_test_suite.hpp @@ -290,6 +290,22 @@ void BOOST_JOIN( name, _impl )( boost::type* ) \ // ************************************************************************** // #define BOOST_GLOBAL_FIXTURE( F ) \ +static boost::unit_test::ut_detail::global_configuration_impl BOOST_JOIN( gf_, F ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_TEST_GLOBAL_CONFIGURATION ************** // +// ************************************************************************** // + +#define BOOST_TEST_GLOBAL_CONFIGURATION( F ) \ +static boost::unit_test::ut_detail::global_configuration_impl BOOST_JOIN( gf_, F ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_TEST_GLOBAL_FIXTURE ************** // +// ************************************************************************** // + +#define BOOST_TEST_GLOBAL_FIXTURE( F ) \ static boost::unit_test::ut_detail::global_fixture_impl BOOST_JOIN( gf_, F ) \ /**/ diff --git a/src/test_framework_init_observer.cpp b/src/test_framework_init_observer.cpp new file mode 100644 index 00000000..140329dd --- /dev/null +++ b/src/test_framework_init_observer.cpp @@ -0,0 +1,15 @@ +// (C) Copyright Raffi Enficiaud 2017. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! Forwarding source +// ************************************************************************** + +#define BOOST_TEST_SOURCE +#include + +// EOF diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 0401902b..1828dd2e 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -136,6 +136,7 @@ test-suite "framework-ts" [ boost.test-self-test run : framework-ts : log-formatter-test : : baseline-outputs/log-formatter-test.pattern ] [ boost.test-self-test run : framework-ts : run-by-name-or-label-test ] [ boost.test-self-test run : framework-ts : version-uses-module-name : included ] + [ boost.test-self-test run : framework-ts : test-macro-global-fixture ] ; #_________________________________________________________________________________________________# @@ -156,6 +157,7 @@ test-suite "writing-test-ts" [ boost.test-self-test run : writing-test-ts : test-dataset-over-tuples : : : : : : $(requirements_datasets) ] [ boost.test-self-test run : writing-test-ts : nullptr-support-test : : : : : : [ requires cxx11_nullptr ] ] [ boost.test-self-test run : writing-test-ts : user-defined-types-logging-customization-points ] + [ boost.test-self-test run : writing-test-ts : test-fixture-detect-setup-teardown ] ; #_________________________________________________________________________________________________# diff --git a/test/baseline-outputs/global-fixtures-test.pattern b/test/baseline-outputs/global-fixtures-test.pattern new file mode 100644 index 00000000..bce003f9 --- /dev/null +++ b/test/baseline-outputs/global-fixtures-test.pattern @@ -0,0 +1,5831 @@ +*********************** +*********************** GlobalFixtureWithCtor<&good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + +*********************** +*********************** GlobalFixtureWithCtor<&almost_good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy": condition 2>3 is not satisfied [2 <= 3] +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors": condition 2>3 is not satisfied [2 <= 3] +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + +*********************** +*********************** GlobalFixtureWithCtor<&bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy": non sense +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy no errors": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy no errors": non sense +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithCtor: dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + + + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithCtor<&very_bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy no errors": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithCtor<&very_bad_exception> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithCtor: ctor +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy no errors": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithSetup<&good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + +*********************** +*********************** GlobalFixtureWithSetup<&almost_good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + +*********************** +*********************** GlobalFixtureWithSetup<&bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy": non sense +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy no errors": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy no errors": non sense +GlobalFixtureWithSetup::setup-calling function done +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + + + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithSetup<&very_bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy": very_bad_foo is fatal +Failure occurred in a following context: + some context +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy no errors": very_bad_foo is fatal +Failure occurred in a following context: + some context +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithSetup<&very_bad_exception> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithSetup ctor +GlobalFixtureWithSetup::setup-calling function +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy no errors": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +GlobalFixtureWithSetup dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithTeardown<&good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + +*********************** +*********************** GlobalFixtureWithTeardown<&almost_good_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ3 is not satisfied [2 <= 3]]]> +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors": condition 2>3 is not satisfied [2 <= 3] +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ3 is not satisfied [2 <= 3]]]> +* 3-format ******************************************************************* + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + +*********************** +*********************** GlobalFixtureWithTeardown<&bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy": non sense +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy no errors": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy no errors": non sense +GlobalFixtureWithTeardown::teardown-calling function done +GlobalFixtureWithTeardown dtor +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + + + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithTeardown<&very_bad_foo> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy no errors": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + + + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + + + + +*********************** +*********************** GlobalFixtureWithTeardown<&very_bad_exception> +*********************** +* 1-format ******************************************************************* +Running 5 test cases... +xxx/test-macro-global-fixture.cpp:282: Entering test suite "Fake Test Suite Hierarchy" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:283: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:283: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:284: Entering test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:173: fatal error: in "Fake Test Suite Hierarchy/very_bad_foo": very_bad_foo is fatal +Failure occurred in a following context: + some context +xxx/test-macro-global-fixture.cpp:284: Leaving test case "very_bad_foo" +xxx/test-macro-global-fixture.cpp:285: Entering test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy/very_bad_exception": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy/very_bad_exception": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:285: Leaving test case "very_bad_exception" +xxx/test-macro-global-fixture.cpp:276: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:277: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:277: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:276: Leaving test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:279: Entering test suite "1 bad test case inside" +xxx/test-macro-global-fixture.cpp:280: Entering test case "bad_foo" +xxx/test-macro-global-fixture.cpp:152: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": +this is a message +xxx/test-macro-global-fixture.cpp:155: info: check true has passed +xxx/test-macro-global-fixture.cpp:159: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +xxx/test-macro-global-fixture.cpp:161: error: in "Fake Test Suite Hierarchy/1 bad test case inside/bad_foo": non sense +xxx/test-macro-global-fixture.cpp:280: Leaving test case "bad_foo" +xxx/test-macro-global-fixture.cpp:279: Leaving test suite "1 bad test case inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:282: Leaving test suite "Fake Test Suite Hierarchy" + +* 2-format ******************************************************************* +ZZZZZZZZZZZZZZZ +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + + + + + +* 3-format ******************************************************************* + + + + + + + + + + + + + + + + + + + + +* 1-format ******************************************************************* +Running 2 test cases... +xxx/test-macro-global-fixture.cpp:294: Entering test suite "Fake Test Suite Hierarchy no errors" +GlobalFixtureWithTeardown ctor +xxx/test-macro-global-fixture.cpp:296: Entering test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:148: warning: in "Fake Test Suite Hierarchy no errors/almost_good_foo": condition 2>3 is not satisfied [2 <= 3] +Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:296: Leaving test case "almost_good_foo" +xxx/test-macro-global-fixture.cpp:291: Entering test suite "1 test cases inside" +xxx/test-macro-global-fixture.cpp:292: Entering test case "good_foo" +Test case Fake Test Suite Hierarchy no errors/1 test cases inside/good_foo did not check any assertions +xxx/test-macro-global-fixture.cpp:292: Leaving test case "good_foo" +xxx/test-macro-global-fixture.cpp:291: Leaving test suite "1 test cases inside" +GlobalFixtureWithTeardown::teardown-calling function +xxx/test-macro-global-fixture.cpp:182: error: in "Fake Test Suite Hierarchy no errors": with some message +Failure occurred in a following context: + Context value=something + Context value2=something different +unknown location:0: fatal error: in "Fake Test Suite Hierarchy no errors": unknown type +xxx/test-macro-global-fixture.cpp:182: last checkpoint +Failure occurred in a following context: + exception context should be shown +xxx/test-macro-global-fixture.cpp:294: Leaving test suite "Fake Test Suite Hierarchy no errors" + +* 2-format ******************************************************************* +3 is not satisfied [2 <= 3]]]>ZZZZZZ +* 3-format ******************************************************************* + + + + + + + +3 is not satisfied [2 <= 3] + +MESSAGE: +- file : boost.test framework +- line : 212 +- message: Test case Fake Test Suite Hierarchy no errors/almost_good_foo did not check any assertions + +]]> + + + + + +* 3-format ******************************************************************* + + + + + + + + + + diff --git a/test/framework-ts/log-formatter-test.cpp b/test/framework-ts/log-formatter-test.cpp index abfb87fc..e72ad12e 100644 --- a/test/framework-ts/log-formatter-test.cpp +++ b/test/framework-ts/log-formatter-test.cpp @@ -11,7 +11,7 @@ // Boost.Test #define BOOST_TEST_MAIN -#include +#include #include #include #include @@ -113,7 +113,7 @@ void check( output_test_stream& output, test_suite* ts ) check( output, OF_CLF, ts->p_id ); check( output, OF_XML, ts->p_id ); check( output, OF_JUNIT, ts->p_id, log_successful_tests ); - check( output, OF_JUNIT, ts->p_id, log_cpp_exception_errors ); // should branch to the log log_all_errors + check( output, OF_JUNIT, ts->p_id, log_cpp_exception_errors ); // should branch to the log log_all_errors } //____________________________________________________________________________// @@ -186,7 +186,7 @@ public: "condition 2>3 is not satisfied\n", "condition 2>3 is not satisfied]", }; - + static const std::string to_replace[] = {"time=\"0.1234\"", get_basename() + ":*:" , "unknown location:*:", diff --git a/test/framework-ts/test-macro-global-fixture.cpp b/test/framework-ts/test-macro-global-fixture.cpp new file mode 100644 index 00000000..96dffe6c --- /dev/null +++ b/test/framework-ts/test-macro-global-fixture.cpp @@ -0,0 +1,417 @@ +// (C) Copyright Raffi Enficiaud 2016. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. + +// checks issue https://svn.boost.org/trac/boost/ticket/5563 + +#define BOOST_TEST_MODULE test_macro_in_global_fixture +#include +#include +#include +#include +#include +#include +#include +#include +typedef boost::onullstream onullstream_type; +#include + +// BOOST +#include + +// STL +#include +#include + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; +namespace utf = boost::unit_test; + + +template < void (*function_to_call)() > +struct GlobalFixtureWithCtor { + GlobalFixtureWithCtor() { + BOOST_TEST_MESSAGE("GlobalFixtureWithCtor: ctor"); + (*function_to_call)(); + // having a message is ok + // although it should break existing logger consistency + } + ~GlobalFixtureWithCtor() { + BOOST_TEST_MESSAGE("GlobalFixtureWithCtor: dtor"); + } +}; + +template < void (*function_to_call)() > +struct GlobalFixtureWithSetup { + GlobalFixtureWithSetup() { + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup ctor"); + } + virtual ~GlobalFixtureWithSetup() { + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup dtor"); + } + + virtual void setup() { + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup::setup-calling function"); + (*function_to_call)(); + BOOST_TEST_MESSAGE("GlobalFixtureWithSetup::setup-calling function done"); + } +}; + +template < void (*function_to_call)() > +struct GlobalFixtureWithTeardown { + GlobalFixtureWithTeardown() { + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown ctor"); + } + virtual ~GlobalFixtureWithTeardown() { + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown dtor"); + } + + virtual void teardown() { + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown::teardown-calling function"); + (*function_to_call)(); + BOOST_TEST_MESSAGE("GlobalFixtureWithTeardown::teardown-calling function done"); + } +}; + +template +void check_global_fixture( + output_test_stream& output, + output_format log_format, + test_unit_id id, + bool bt_module_failed = false, + bool has_setup_error = false, + log_level ll = log_successful_tests ) +{ + boost::unit_test::unit_test_log.set_format(log_format); + boost::unit_test::unit_test_log.set_stream(output); + boost::unit_test::unit_test_log.set_threshold_level(ll); + + // output before fixture registration + output << "* " << log_format << "-format *******************************************************************"; + output << std::endl; + + // register this as a global fixture + boost::unit_test::ut_detail::global_fixture_impl fixture_stack_element; + framework::finalize_setup_phase( id ); + + bool setup_error_caught = false; + try { + framework::run( id, false ); // do not continue the test tree to have the test_log_start/end + } + catch (framework::setup_error&) { + BOOST_TEST_MESSAGE("Framework setup_error caught"); + setup_error_caught = true; + } + + output << std::endl; + + // we do not want the result of the comparison go to the "output" stream + boost::unit_test::unit_test_log.set_format(OF_CLF); + boost::unit_test::unit_test_log.set_stream(std::cout); + + BOOST_TEST( setup_error_caught == has_setup_error ); + BOOST_TEST( bt_module_failed == (( results_collector.results( id ).result_code() != 0 ) || setup_error_caught )); + BOOST_TEST( output.match_pattern(true) ); // flushes the stream at the end of the comparison. +} + +template +void check_global_fixture( + output_test_stream& output, + test_suite* ts, + bool bt_module_failed = false, + bool has_setup_error = false) +{ + ts->p_default_status.value = test_unit::RS_ENABLED; + + check_global_fixture( output, OF_CLF, ts->p_id, bt_module_failed, has_setup_error ); + check_global_fixture( output, OF_XML, ts->p_id, bt_module_failed, has_setup_error ); + check_global_fixture( output, OF_JUNIT, ts->p_id, bt_module_failed, has_setup_error, log_successful_tests ); + check_global_fixture( output, OF_JUNIT, ts->p_id, bt_module_failed, has_setup_error, log_cpp_exception_errors ); // should branch to the log log_all_errors +} + +struct guard { + ~guard() + { + boost::unit_test::unit_test_log.set_format( runtime_config::get( runtime_config::btrt_log_format ) ); + boost::unit_test::unit_test_log.set_stream( std::cout ); + } +}; + +// this one should generate a message as it does not execute any assertion +void good_foo() {} + +void almost_good_foo() +{ + BOOST_TEST_WARN( 2>3 ); +} + +void bad_foo() { + BOOST_ERROR( "" ); + + BOOST_TEST_MESSAGE("this is a message"); + BOOST_CHECK(true); + + BOOST_TEST_INFO("Context value=something"); + BOOST_TEST_INFO("Context value2=something different"); + BOOST_ERROR( "with some message" ); + + BOOST_CHECK_MESSAGE( 1 == 2.3, "non sense" ); +} + +struct log_guard { + ~log_guard() + { + unit_test_log.set_stream( std::cout ); + } +}; + +void very_bad_foo() { + BOOST_TEST_CONTEXT("some context") { + BOOST_FAIL( "very_bad_foo is fatal" ); + } +} + +struct local_exception {}; + +void very_bad_exception() { + BOOST_TEST_INFO("Context value=something"); + BOOST_TEST_INFO("Context value2=something different"); + BOOST_ERROR( "with some message" ); + + BOOST_TEST_INFO("exception context should be shown"); + throw local_exception(); +} + +// to factorize out with the logger test +class output_test_stream_for_loggers : public output_test_stream { + +public: + explicit output_test_stream_for_loggers( + boost::unit_test::const_string pattern_file_name = boost::unit_test::const_string(), + bool match_or_save = true, + bool text_or_binary = true ) + : output_test_stream(pattern_file_name, match_or_save, text_or_binary) + {} + + static std::string normalize_path(const std::string &str) { + const std::string to_look_for[] = {"\\"}; + const std::string to_replace[] = {"/"}; + return utils::replace_all_occurrences_of( + str, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]) + ); + } + + static std::string get_basename() { + static std::string basename; + + if(basename.empty()) { + basename = normalize_path(__FILE__); + std::string::size_type basename_pos = basename.rfind('/'); + if(basename_pos != std::string::npos) { + basename = basename.substr(basename_pos+1); + } + } + return basename; + } + + virtual std::string get_stream_string_representation() const { + std::string current_string = output_test_stream::get_stream_string_representation(); + + std::string pathname_fixes; + { + static const std::string to_look_for[] = {normalize_path(__FILE__)}; + static const std::string to_replace[] = {"xxx/" + get_basename() }; + pathname_fixes = utils::replace_all_occurrences_of( + current_string, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]) + ); + } + + std::string other_vars_fixes; + { + static const std::string to_look_for[] = {"time=\"*\"", + get_basename() + "(*):", + "unknown location(*):", + "; testing time: *us\n", // removing this is far more easier than adding a testing time + "; testing time: *ms\n", + "*", + "condition 2>3 is not satisfied\n", + "condition 2>3 is not satisfied]", + }; + + static const std::string to_replace[] = {"time=\"0.1234\"", + get_basename() + ":*:" , + "unknown location:*:", + "\n", + "\n", + "ZZZ", + "condition 2>3 is not satisfied [2 <= 3]\n", + "condition 2>3 is not satisfied [2 <= 3]]", + }; + + other_vars_fixes = utils::replace_all_occurrences_with_wildcards( + pathname_fixes, + to_look_for, to_look_for + sizeof(to_look_for)/sizeof(to_look_for[0]), + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]) + ); + } + + return other_vars_fixes; + } + +}; + + +BOOST_AUTO_TEST_CASE( some_test ) +{ + guard G; + ut_detail::ignore_unused_variable_warning( G ); + + test_suite* ts_1 = BOOST_TEST_SUITE( "1 test cases inside" ); + ts_1->add( BOOST_TEST_CASE( good_foo ) ); + + test_suite* ts_1b = BOOST_TEST_SUITE( "1 bad test case inside" ); + ts_1b->add( BOOST_TEST_CASE( bad_foo ), 1 ); + + test_suite* ts_main = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy" ); + ts_main->add( BOOST_TEST_CASE( bad_foo ) ); + ts_main->add( BOOST_TEST_CASE( very_bad_foo ) ); + ts_main->add( BOOST_TEST_CASE( very_bad_exception ) ); + ts_main->add( ts_1 ); + ts_main->add( ts_1b ); + + // we need another tree + test_suite* ts2_0 = BOOST_TEST_SUITE( "0 test cases inside" ); + test_suite* ts2_1 = BOOST_TEST_SUITE( "1 test cases inside" ); + ts2_1->add( BOOST_TEST_CASE( good_foo ) ); + + test_suite* ts_main_no_error = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy no errors" ); + ts_main_no_error->add( ts2_0 ); + ts_main_no_error->add( BOOST_TEST_CASE( almost_good_foo ) ); + ts_main_no_error->add( ts2_1 ); + +#define PATTERN_FILE_NAME "global-fixtures-test.pattern" + + std::string pattern_file_name( + framework::master_test_suite().argc == 1 + ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./baseline-outputs/" PATTERN_FILE_NAME ) + : framework::master_test_suite().argv[1] ); + + + output_test_stream_for_loggers test_output( pattern_file_name, !runtime_config::save_pattern() ); + + // legacy API, we test that we catch exceptions in the ctor, and tests + // in the suite are running or not depending on that + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithCtor<&good_foo> >( test_output, ts_main_no_error, false); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&almost_good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&almost_good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithCtor<&almost_good_foo> >( test_output, ts_main_no_error, false ); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&bad_foo> >( test_output, ts_main, true ); // should fail the module + check_global_fixture< GlobalFixtureWithCtor<&bad_foo> >( test_output, ts_main_no_error, true ); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&very_bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&very_bad_foo> >( test_output, ts_main, true ); // should fail the module + check_global_fixture< GlobalFixtureWithCtor<&very_bad_foo> >( test_output, ts_main_no_error, true ); + + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithCtor<&very_bad_exception>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithCtor<&very_bad_exception> >( test_output, ts_main, true ); // should fail the module + check_global_fixture< GlobalFixtureWithCtor<&very_bad_exception> >( test_output, ts_main_no_error, true ); + + // here we test only for the setup function, tests should not be + // executed when setup fails, setup should be allowed to fail + + // setup does not fail + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&good_foo> >( test_output, ts_main_no_error, false ); + + // setup does not fail, with messages + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&almost_good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&almost_good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&almost_good_foo> >( test_output, ts_main_no_error, false ); + + // setup fails + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&bad_foo> >( test_output, ts_main_no_error, true ); + + // setup fails badly + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&very_bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&very_bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&very_bad_foo> >( test_output, ts_main_no_error, true ); + + // setup fails with exception + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithSetup<&very_bad_exception>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithSetup<&very_bad_exception> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithSetup<&very_bad_exception> >( test_output, ts_main_no_error, true ); + + // here we test only for the teardown function, tests should not be + // executed when setup fails, setup should be allowed to fail + + // teardown does not fail + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&good_foo> >( test_output, ts_main_no_error, false ); + + // teardown does not fail, with messages + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&almost_good_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&almost_good_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&almost_good_foo> >( test_output, ts_main_no_error, false ); + + // teardown fails + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&bad_foo> >( test_output, ts_main_no_error, true ); + + // teardown fails badly + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&very_bad_foo>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_foo> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_foo> >( test_output, ts_main_no_error, true ); + + // teardown fails with exception + test_output << "***********************" << std::endl; + test_output << "*********************** GlobalFixtureWithTeardown<&very_bad_exception>" << std::endl; + test_output << "***********************" << std::endl; + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_exception> >( test_output, ts_main, true ); + check_global_fixture< GlobalFixtureWithTeardown<&very_bad_exception> >( test_output, ts_main_no_error, true ); + +} diff --git a/test/writing-test-ts/test-fixture-detect-setup-teardown.cpp b/test/writing-test-ts/test-fixture-detect-setup-teardown.cpp new file mode 100644 index 00000000..f7778dd5 --- /dev/null +++ b/test/writing-test-ts/test-fixture-detect-setup-teardown.cpp @@ -0,0 +1,72 @@ +// (C) Copyright Raffi Enficiaud 2017. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. + +// checks issue https://svn.boost.org/trac/boost/ticket/5563 + +// we need the included version to be able to access the current framework state +// through boost::unit_test::framework::impl::s_frk_state() + +#define BOOST_TEST_MODULE test_fixture_detect_setup_teardown +#include +#include +#include +#include +#include +#include + +using namespace boost::unit_test; + +class fixture_without { +public: + fixture_without() {} + ~fixture_without() {} +}; + +class fixture_with { +public: + fixture_with() {} + void setup() {} + void teardown() {} + ~fixture_with() {} +}; + +class fixture_with_child : public fixture_with { +public: + fixture_with_child() {} + ~fixture_with_child() {} +}; + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect ) +{ + BOOST_CHECK(!fixture_details::has_setup::value); + BOOST_CHECK(!fixture_details::has_setup::value); + + fixture_without obj; + fixture_details::setup_conditional(obj); + fixture_details::teardown_conditional(obj); +} + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect_both ) +{ + BOOST_CHECK(fixture_details::has_setup::value); + BOOST_CHECK(fixture_details::has_setup::value); + + fixture_with obj; + fixture_details::setup_conditional(obj); + fixture_details::teardown_conditional(obj); +} + +BOOST_AUTO_TEST_CASE( fixture_setup_teardown_detect_both_from_child ) +{ + // cannot detect this with the C++03 approach + BOOST_CHECK(!fixture_details::has_setup::value); + BOOST_CHECK(!fixture_details::has_setup::value); + + fixture_with_child obj; + fixture_details::setup_conditional(obj); + fixture_details::teardown_conditional(obj); +}