mirror of
https://github.com/boostorg/test.git
synced 2026-01-25 18:52:15 +00:00
revert more boost.test changes
[SVN r40100]
This commit is contained in:
@@ -26,7 +26,7 @@ namespace unit_test {
|
||||
enum log_level {
|
||||
invalid_log_level = -1,
|
||||
log_successful_tests = 0,
|
||||
log_test_units = 1,
|
||||
log_test_suites = 1,
|
||||
log_messages = 2,
|
||||
log_warnings = 3,
|
||||
log_all_errors = 4, // reported by unit test macros
|
||||
|
||||
@@ -43,8 +43,6 @@ bool BOOST_TEST_DECL save_pattern();
|
||||
bool BOOST_TEST_DECL show_build_info();
|
||||
bool BOOST_TEST_DECL show_progress();
|
||||
bool BOOST_TEST_DECL catch_sys_errors();
|
||||
bool BOOST_TEST_DECL auto_start_dbg();
|
||||
bool BOOST_TEST_DECL use_alt_stack();
|
||||
output_format BOOST_TEST_DECL report_format();
|
||||
output_format BOOST_TEST_DECL log_format();
|
||||
long BOOST_TEST_DECL detect_memory_leaks();
|
||||
@@ -64,6 +62,24 @@ int BOOST_TEST_DECL random_seed();
|
||||
// Revision History :
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.24 2006/11/13 20:03:48 jhunold
|
||||
// Added missing export declarations.
|
||||
//
|
||||
// Revision 1.23 2006/01/30 07:29:49 rogeeff
|
||||
// split memory leaks detection API in two to get more functions with better defined roles
|
||||
//
|
||||
// Revision 1.22 2005/12/14 04:58:30 rogeeff
|
||||
// new parameter --break_exec_path introduced
|
||||
//
|
||||
// Revision 1.21 2005/04/05 06:11:37 rogeeff
|
||||
// memory leak allocation point detection\nextra help with _WIN32_WINNT
|
||||
//
|
||||
// Revision 1.20 2005/02/21 10:18:30 rogeeff
|
||||
// random cla support
|
||||
//
|
||||
// Revision 1.19 2005/02/20 08:27:06 rogeeff
|
||||
// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER
|
||||
|
||||
@@ -49,7 +49,7 @@ BOOST_AUTO_TC_REGISTRAR( test_name )( \
|
||||
boost::unit_test::make_test_case( \
|
||||
&BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
|
||||
boost::unit_test::ut_detail::auto_tc_exp_fail< \
|
||||
BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
|
||||
BOOST_AUTO_TC_UNIQUE_ID( test_name )>::value ); \
|
||||
\
|
||||
void test_name::test_method() \
|
||||
/**/
|
||||
|
||||
@@ -54,17 +54,17 @@ BOOST_TEST_DECL master_test_suite_t& master_test_suite();
|
||||
BOOST_TEST_DECL test_case const& current_test_case();
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x530) )
|
||||
template<typename UnitType>
|
||||
UnitType& get( test_unit_id id )
|
||||
UnitType const& get( test_unit_id id )
|
||||
{
|
||||
return static_cast<UnitType&>( get( id, (test_unit_type)UnitType::type ) );
|
||||
return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) );
|
||||
}
|
||||
test_unit& get( test_unit_id, test_unit_type );
|
||||
test_unit const& get( test_unit_id, test_unit_type );
|
||||
#else
|
||||
test_unit& get( test_unit_id, test_unit_type );
|
||||
test_unit const& get( test_unit_id, test_unit_type );
|
||||
template<typename UnitType>
|
||||
UnitType& get( test_unit_id id )
|
||||
UnitType const& get( test_unit_id id )
|
||||
{
|
||||
return static_cast<UnitType&>( get( id, (test_unit_type)UnitType::type ) );
|
||||
return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ compiler_log_formatter::print_prefix( std::ostream& output, const_string file, s
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace output
|
||||
} // namespace ouptut
|
||||
|
||||
} // namespace unit_test
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace boost {
|
||||
int BOOST_TEST_DECL
|
||||
prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] )
|
||||
{
|
||||
int result = 0;
|
||||
int result;
|
||||
|
||||
boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) );
|
||||
bool catch_system_errors = p != "no";
|
||||
|
||||
@@ -126,7 +126,7 @@ struct exception_safety_tester : itest::manager, test_observer {
|
||||
|
||||
// test observer interface
|
||||
virtual void assertion_result( bool passed );
|
||||
virtual int priority() { return (std::numeric_limits<int>::max)(); } // we want this observer to run the last
|
||||
virtual int priority() { return std::numeric_limits<int>::max(); } // we want this observer to run the last
|
||||
|
||||
private:
|
||||
void failure_point();
|
||||
@@ -493,7 +493,7 @@ exception_safety_tester::report_error()
|
||||
if( m_invairant_failed )
|
||||
formatter << " and ";
|
||||
|
||||
formatter << (unsigned int)m_memory_in_use.size() << " memory leak";
|
||||
formatter << m_memory_in_use.size() << " memory leak";
|
||||
if( m_memory_in_use.size() > 1 )
|
||||
formatter << 's';
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace std { using ::strlen; using ::strncat; }
|
||||
|
||||
# ifndef _WIN32_WINNT
|
||||
# ifdef _WINBASE_
|
||||
# pragma message("Warning: Debugger check disabled. Either define _WIN32_WINNT or include Boost.Test header in front of winbase.h")
|
||||
# warning Debugger check disabled. Either define _WIN32_WINNT or include Boost.Test header in front of winbase.h
|
||||
# else
|
||||
# define BOOST_TEST_DEBUGGER_CHECK
|
||||
# define _WIN32_WINNT 0x0400
|
||||
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<test_unit_id,test_unit*> test_unit_store;
|
||||
typedef std::map<test_unit_id,test_unit const*> test_unit_store;
|
||||
typedef std::set<test_observer*,priority_order> observer_store;
|
||||
|
||||
master_test_suite_t* m_master_test_suite;
|
||||
@@ -211,11 +211,11 @@ init( int argc, char* argv[] )
|
||||
{
|
||||
runtime_config::init( &argc, argv );
|
||||
|
||||
// set the log level and format
|
||||
// set the log level nad format
|
||||
unit_test_log.set_threshold_level( runtime_config::log_level() );
|
||||
unit_test_log.set_format( runtime_config::log_format() );
|
||||
|
||||
// set the report level and format
|
||||
// set the report level nad format
|
||||
results_reporter::set_level( runtime_config::report_level() );
|
||||
results_reporter::set_format( runtime_config::report_format() );
|
||||
|
||||
@@ -335,10 +335,10 @@ current_test_case()
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
test_unit&
|
||||
test_unit const&
|
||||
get( test_unit_id id, test_unit_type t )
|
||||
{
|
||||
test_unit* res = s_frk_impl().m_test_units[id];
|
||||
test_unit const* res = s_frk_impl().m_test_units[id];
|
||||
|
||||
if( (res->p_type & t) == 0 )
|
||||
throw internal_error( "Invalid test unit type" );
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
// ELOG_VER : $Revision$
|
||||
//
|
||||
// Description : Facilities to perform interaction based testng of logged expectations
|
||||
// ***************************************************************************
|
||||
|
||||
@@ -112,14 +112,6 @@ set_stream( std::ostream& ostr )
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
std::ostream&
|
||||
get_stream()
|
||||
{
|
||||
return *s_rr_impl().m_output;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
void
|
||||
set_format( output_format rf )
|
||||
{
|
||||
|
||||
@@ -439,7 +439,7 @@ output_test_stream::output_test_stream( const_string pattern_file_name, bool mat
|
||||
|
||||
BOOST_WARN_MESSAGE( m_pimpl->m_pattern.is_open(),
|
||||
"Couldn't open pattern file " << pattern_file_name
|
||||
<< " for " << (match_or_save ? "reading" : "writing") );
|
||||
<< " for " << (m_pimpl->m_match_or_save ? "reading" : "writing") );
|
||||
}
|
||||
|
||||
m_pimpl->m_match_or_save = match_or_save;
|
||||
|
||||
@@ -124,9 +124,6 @@ unit_test_log_impl& s_log_impl() { static unit_test_log_impl the_inst; return th
|
||||
void
|
||||
unit_test_log_t::test_start( counter_t test_cases_amount )
|
||||
{
|
||||
if( s_log_impl().m_threshold_level == log_nothing )
|
||||
return;
|
||||
|
||||
s_log_impl().m_log_formatter->log_start( s_log_impl().stream(), test_cases_amount );
|
||||
|
||||
if( runtime_config::show_build_info() )
|
||||
@@ -140,9 +137,6 @@ unit_test_log_t::test_start( counter_t test_cases_amount )
|
||||
void
|
||||
unit_test_log_t::test_finish()
|
||||
{
|
||||
if( s_log_impl().m_threshold_level == log_nothing )
|
||||
return;
|
||||
|
||||
s_log_impl().m_log_formatter->log_finish( s_log_impl().stream() );
|
||||
|
||||
s_log_impl().stream().flush();
|
||||
@@ -161,7 +155,7 @@ unit_test_log_t::test_aborted()
|
||||
void
|
||||
unit_test_log_t::test_unit_start( test_unit const& tu )
|
||||
{
|
||||
if( s_log_impl().m_threshold_level > log_test_units )
|
||||
if( s_log_impl().m_threshold_level > log_test_suites )
|
||||
return;
|
||||
|
||||
if( s_log_impl().m_entry_in_progress )
|
||||
@@ -175,7 +169,7 @@ unit_test_log_t::test_unit_start( test_unit const& tu )
|
||||
void
|
||||
unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed )
|
||||
{
|
||||
if( s_log_impl().m_threshold_level > log_test_units )
|
||||
if( s_log_impl().m_threshold_level > log_test_suites )
|
||||
return;
|
||||
|
||||
s_log_impl().m_checkpoint_data.clear();
|
||||
@@ -191,7 +185,7 @@ unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed )
|
||||
void
|
||||
unit_test_log_t::test_unit_skipped( test_unit const& tu )
|
||||
{
|
||||
if( s_log_impl().m_threshold_level > log_test_units )
|
||||
if( s_log_impl().m_threshold_level > log_test_suites )
|
||||
return;
|
||||
|
||||
if( s_log_impl().m_entry_in_progress )
|
||||
@@ -339,7 +333,7 @@ unit_test_log_t::operator<<( const_string value )
|
||||
unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR );
|
||||
break;
|
||||
case log_nothing:
|
||||
case log_test_units:
|
||||
case log_test_suites:
|
||||
case invalid_log_level:
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace unit_test {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** unit_test_main ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace unit_test {
|
||||
|
||||
int BOOST_TEST_DECL
|
||||
|
||||
#if defined(BOOST_TEST_DYN_LINK)
|
||||
@@ -57,9 +57,6 @@ unit_test_main( int argc, char* argv[] )
|
||||
if( !(*init_unit_test_func)() )
|
||||
throw framework::setup_error( BOOST_TEST_L( "test tree initialization error" ) );
|
||||
#endif
|
||||
// !! ?? if( !runtime_config.test_to_run().is_empty() ) {
|
||||
//
|
||||
// }
|
||||
|
||||
framework::run();
|
||||
|
||||
@@ -70,17 +67,17 @@ unit_test_main( int argc, char* argv[] )
|
||||
: results_collector.results( framework::master_test_suite().p_id ).result_code();
|
||||
}
|
||||
catch( framework::internal_error const& ex ) {
|
||||
results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl;
|
||||
std::cerr << "Boost.Test framework internal error: " << ex.what() << std::endl;
|
||||
|
||||
return boost::exit_exception_failure;
|
||||
}
|
||||
catch( framework::setup_error const& ex ) {
|
||||
results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl;
|
||||
std::cerr << "Test setup error: " << ex.what() << std::endl;
|
||||
|
||||
return boost::exit_exception_failure;
|
||||
}
|
||||
catch( ... ) {
|
||||
results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl;
|
||||
std::cerr << "Boost.Test framework internal error: unknown reason" << std::endl;
|
||||
|
||||
return boost::exit_exception_failure;
|
||||
}
|
||||
|
||||
@@ -58,8 +58,6 @@ literal_string SAVE_TEST_PATTERN = "BOOST_TEST_SAVE_PATTERN";
|
||||
literal_string BUILD_INFO = "BOOST_TEST_BUILD_INFO";
|
||||
literal_string SHOW_PROGRESS = "BOOST_TEST_SHOW_PROGRESS";
|
||||
literal_string CATCH_SYS_ERRORS = "BOOST_TEST_CATCH_SYSTEM_ERRORS";
|
||||
literal_string AUTO_START_DBG = "BOOST_TEST_AUTO_START_DBG";
|
||||
literal_string USE_ALT_STACK = "BOOST_TEST_USE_ALT_STACK";
|
||||
literal_string REPORT_FORMAT = "BOOST_TEST_REPORT_FORMAT";
|
||||
literal_string LOG_FORMAT = "BOOST_TEST_LOG_FORMAT";
|
||||
literal_string OUTPUT_FORMAT = "BOOST_TEST_OUTPUT_FORMAT";
|
||||
@@ -76,8 +74,6 @@ bool s_save_pattern;
|
||||
bool s_show_build_info;
|
||||
bool s_show_progress;
|
||||
bool s_catch_sys_errors;
|
||||
bool s_auto_start_dbg;
|
||||
bool s_use_alt_stack;
|
||||
output_format s_report_format;
|
||||
output_format s_log_format;
|
||||
long s_detect_mem_leaks;
|
||||
@@ -99,8 +95,6 @@ retrieve_framework_parameter( const_string parameter_name, int* argc, char** arg
|
||||
BUILD_INFO , "--build_info",
|
||||
SHOW_PROGRESS , "--show_progress",
|
||||
CATCH_SYS_ERRORS , "--catch_system_errors",
|
||||
AUTO_START_DBG , "--auto_start_dbg",
|
||||
USE_ALT_STACK , "--use_alt_stack",
|
||||
REPORT_FORMAT , "--report_format",
|
||||
LOG_FORMAT , "--log_format",
|
||||
OUTPUT_FORMAT , "--output_format",
|
||||
@@ -170,8 +164,7 @@ init( int* argc, char** argv )
|
||||
fixed_mapping<const_string,unit_test::log_level,case_ins_less<char const> > log_level_name(
|
||||
"all" , log_successful_tests,
|
||||
"success" , log_successful_tests,
|
||||
"test_suite" , log_test_units,
|
||||
"unit_scope" , log_test_units,
|
||||
"test_suite" , log_test_suites,
|
||||
"message" , log_messages,
|
||||
"warning" , log_warnings,
|
||||
"error" , log_all_errors,
|
||||
@@ -205,7 +198,6 @@ init( int* argc, char** argv )
|
||||
s_show_build_info = retrieve_framework_parameter( BUILD_INFO, argc, argv ) == "yes";
|
||||
s_show_progress = retrieve_framework_parameter( SHOW_PROGRESS, argc, argv ) == "yes";
|
||||
s_catch_sys_errors = retrieve_framework_parameter( CATCH_SYS_ERRORS, argc, argv ) != "no";
|
||||
s_use_alt_stack = retrieve_framework_parameter( USE_ALT_STACK, argc, argv ) != "no";
|
||||
s_tests_to_run = retrieve_framework_parameter( TESTS_TO_RUN, argc, argv );
|
||||
s_exec_path_to_break= retrieve_framework_parameter( BREAK_EXEC_PATH, argc, argv );
|
||||
|
||||
@@ -226,14 +218,6 @@ init( int* argc, char** argv )
|
||||
|
||||
const_string ml_str = retrieve_framework_parameter( DETECT_MEM_LEAK, argc, argv );
|
||||
s_detect_mem_leaks = ml_str.is_empty() ? 1 : interpret_long( ml_str );
|
||||
|
||||
const_string dbg = retrieve_framework_parameter( AUTO_START_DBG, argc, argv );
|
||||
|
||||
if( dbg.is_empty() || dbg == "no" )
|
||||
s_auto_start_dbg = false;
|
||||
else {
|
||||
s_auto_start_dbg = true;
|
||||
}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -310,22 +294,6 @@ catch_sys_errors()
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
bool
|
||||
auto_start_dbg()
|
||||
{
|
||||
return s_auto_start_dbg;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
bool
|
||||
use_alt_stack()
|
||||
{
|
||||
return s_use_alt_stack;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
output_format
|
||||
report_format()
|
||||
{
|
||||
@@ -372,7 +340,27 @@ random_seed()
|
||||
// Revision History :
|
||||
//
|
||||
// $Log$
|
||||
//
|
||||
// Revision 1.10 2006/01/30 07:29:49 rogeeff
|
||||
// split memory leaks detection API in two to get more functions with better defined roles
|
||||
//
|
||||
// Revision 1.9 2005/12/14 05:38:47 rogeeff
|
||||
// new parameter break_exec_path() is introduced
|
||||
//
|
||||
// Revision 1.8 2005/05/08 08:55:09 rogeeff
|
||||
// typos and missing descriptions fixed
|
||||
//
|
||||
// Revision 1.7 2005/04/05 07:23:21 rogeeff
|
||||
// restore default
|
||||
//
|
||||
// Revision 1.6 2005/04/05 06:11:37 rogeeff
|
||||
// memory leak allocation point detection\nextra help with _WIN32_WINNT
|
||||
//
|
||||
// Revision 1.5 2005/02/21 10:12:22 rogeeff
|
||||
// Support for random order of test cases implemented
|
||||
//
|
||||
// Revision 1.4 2005/02/20 08:27:07 rogeeff
|
||||
// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER
|
||||
|
||||
@@ -84,17 +84,6 @@ test_unit::check_dependencies() const
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
void
|
||||
test_unit::increase_exp_fail( unsigned num )
|
||||
{
|
||||
p_expected_failures.value += num;
|
||||
|
||||
if( p_parent_id != 0 )
|
||||
framework::get<test_suite>( p_parent_id ).increase_exp_fail( num );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** test_case ************** //
|
||||
// ************************************************************************** //
|
||||
@@ -126,17 +115,21 @@ test_suite::test_suite( const_string name )
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// !! need to prevent modifing test unit once it is added to tree
|
||||
|
||||
void
|
||||
test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout )
|
||||
{
|
||||
if( expected_failures != 0 )
|
||||
tu->p_expected_failures.value = expected_failures;
|
||||
|
||||
p_expected_failures.value += tu->p_expected_failures;
|
||||
|
||||
if( timeout != 0 )
|
||||
tu->p_timeout.value = timeout;
|
||||
|
||||
m_members.push_back( tu->p_id );
|
||||
tu->p_parent_id.value = p_id;
|
||||
|
||||
if( expected_failures != 0 )
|
||||
tu->increase_exp_fail( expected_failures );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -151,19 +144,6 @@ test_suite::add( test_unit_generator const& gen, unsigned timeout )
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
test_unit_id
|
||||
test_suite::get( const_string tu_name ) const
|
||||
{
|
||||
BOOST_TEST_FOREACH( test_unit_id, id, m_members ) {
|
||||
if( framework::get( id, test_id_2_unit_type( id ) ).p_name == tu_name )
|
||||
return id;
|
||||
}
|
||||
|
||||
return INV_TEST_UNIT_ID;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** traverse_test_tree ************** //
|
||||
// ************************************************************************** //
|
||||
@@ -233,76 +213,8 @@ normalize_test_case_name( const_string name )
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** auto_test_unit_registrar ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
auto_test_unit_registrar::auto_test_unit_registrar( test_case* tc, counter_t exp_fail )
|
||||
{
|
||||
curr_ts_store().back()->add( tc, exp_fail );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
auto_test_unit_registrar::auto_test_unit_registrar( const_string ts_name )
|
||||
{
|
||||
test_unit_id id = curr_ts_store().back()->get( ts_name );
|
||||
|
||||
test_suite* ts;
|
||||
|
||||
if( id != INV_TEST_UNIT_ID ) {
|
||||
ts = &framework::get<test_suite>( id ); // !! test for invalid tu type
|
||||
BOOST_ASSERT( ts->p_parent_id == curr_ts_store().back()->p_id );
|
||||
}
|
||||
else {
|
||||
ts = new test_suite( ts_name );
|
||||
curr_ts_store().back()->add( ts );
|
||||
}
|
||||
|
||||
curr_ts_store().push_back( ts );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
auto_test_unit_registrar::auto_test_unit_registrar( test_unit_generator const& tc_gen )
|
||||
{
|
||||
curr_ts_store().back()->add( tc_gen );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
auto_test_unit_registrar::auto_test_unit_registrar( int )
|
||||
{
|
||||
if( curr_ts_store().size() == 0 )
|
||||
return; // report error?
|
||||
|
||||
curr_ts_store().pop_back();
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
std::list<test_suite*>&
|
||||
auto_test_unit_registrar::curr_ts_store()
|
||||
{
|
||||
static std::list<test_suite*> inst( 1, &framework::master_test_suite() );
|
||||
return inst;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace ut_detail
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** global_fixture ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
global_fixture::global_fixture()
|
||||
{
|
||||
framework::register_observer( *this );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace unit_test
|
||||
|
||||
} // namespace boost
|
||||
@@ -315,6 +227,33 @@ global_fixture::global_fixture()
|
||||
// Revision History :
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.13 2006/02/23 15:33:15 rogeeff
|
||||
// workaround restored
|
||||
//
|
||||
// Revision 1.12 2006/01/28 08:53:57 rogeeff
|
||||
// VC6.0 workaround removed
|
||||
//
|
||||
// Revision 1.11 2005/12/14 05:54:41 rogeeff
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.10 2005/04/18 04:55:36 rogeeff
|
||||
// test unit name made read/write
|
||||
//
|
||||
// Revision 1.9 2005/03/23 21:02:25 rogeeff
|
||||
// Sunpro CC 5.3 fixes
|
||||
//
|
||||
// Revision 1.8 2005/03/21 15:33:15 rogeeff
|
||||
// check reworked
|
||||
//
|
||||
// Revision 1.7 2005/02/25 21:27:44 turkanis
|
||||
// fix for random_shuffle on Borland 5.x w/ STLPort
|
||||
//
|
||||
// Revision 1.6 2005/02/21 10:12:24 rogeeff
|
||||
// Support for random order of test cases implemented
|
||||
//
|
||||
// Revision 1.5 2005/02/20 08:27:07 rogeeff
|
||||
// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
#define BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER
|
||||
|
||||
#include <boost/test/impl/compiler_log_formatter.ipp>
|
||||
#include <boost/test/impl/framework.ipp>
|
||||
#include <boost/test/impl/exception_safety.ipp>
|
||||
#include <boost/test/impl/execution_monitor.ipp>
|
||||
#include <boost/test/impl/interaction_based.ipp>
|
||||
#include <boost/test/impl/logged_expectations.ipp>
|
||||
#include <boost/test/impl/framework.ipp>
|
||||
#include <boost/test/impl/plain_report_formatter.ipp>
|
||||
#include <boost/test/impl/progress_monitor.ipp>
|
||||
#include <boost/test/impl/results_collector.ipp>
|
||||
|
||||
@@ -47,7 +47,7 @@ BOOST_AUTO_TC_REGISTRAR( test_name )( \
|
||||
boost::unit_test::make_test_case( \
|
||||
&BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
|
||||
boost::unit_test::ut_detail::auto_tc_exp_fail< \
|
||||
BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
|
||||
BOOST_AUTO_TC_UNIQUE_ID( test_name )>::value ); \
|
||||
\
|
||||
void test_name::test_method() \
|
||||
/**/
|
||||
|
||||
@@ -60,8 +60,6 @@ BOOST_TEST_DECL void set_stream( std::ostream& );
|
||||
BOOST_TEST_DECL void set_format( output_format );
|
||||
BOOST_TEST_DECL void set_format( results_reporter::format* );
|
||||
|
||||
BOOST_TEST_DECL std::ostream& get_stream();
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** report initiation ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
@@ -161,7 +161,6 @@ do { \
|
||||
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK, CHECK_EQUAL, (L)(R) )
|
||||
#define BOOST_REQUIRE_EQUAL( L, R ) \
|
||||
BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::equal_impl_frwd(), "", REQUIRE, CHECK_EQUAL, (L)(R) )
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#define BOOST_WARN_CLOSE( L, R, T ) \
|
||||
@@ -470,12 +469,12 @@ predicate_result equal_impl( Left const& left, Right const& right )
|
||||
//____________________________________________________________________________//
|
||||
|
||||
predicate_result BOOST_TEST_DECL equal_impl( char const* left, char const* right );
|
||||
inline predicate_result equal_impl( char* left, char const* right ) { return equal_impl( (char const*)left, (char const*)right ); }
|
||||
inline predicate_result equal_impl( char const* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
|
||||
inline predicate_result equal_impl( char* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
|
||||
inline predicate_result BOOST_TEST_DECL equal_impl( char* left, char const* right ) { return equal_impl( (char const*)left, (char const*)right ); }
|
||||
inline predicate_result BOOST_TEST_DECL equal_impl( char const* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
|
||||
inline predicate_result BOOST_TEST_DECL equal_impl( char* left, char* right ) { return equal_impl( (char const*)left, (char const*)right ); }
|
||||
|
||||
#if !defined( BOOST_NO_CWCHAR )
|
||||
predicate_result BOOST_TEST_DECL equal_impl( wchar_t const* left, wchar_t const* right );
|
||||
predicate_result equal_impl( wchar_t const* left, wchar_t const* right );
|
||||
inline predicate_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
|
||||
inline predicate_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
|
||||
inline predicate_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( (wchar_t const*)left, (wchar_t const*)right ); }
|
||||
@@ -601,6 +600,78 @@ namespace test_toolbox = test_tools;
|
||||
// Revision History :
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.66 2007/04/05 14:46:47 dgregor
|
||||
// Add include of climits
|
||||
//
|
||||
// Revision 1.65 2007/02/22 18:00:39 speedsnail
|
||||
// Removed the msvc-6.5 hack from HEAD again. Gennadiy Rozental didn't like it anyways...
|
||||
//
|
||||
// Revision 1.64 2006/12/16 14:36:23 speedsnail
|
||||
// Workaround for msvc-6.5: *_EQUAL macros give Internal Compiler Errors, when inlining is turned on.
|
||||
//
|
||||
// Revision 1.63 2006/11/14 21:33:01 jhunold
|
||||
// Add missing export macros for print_log_value<>
|
||||
//
|
||||
// Revision 1.62 2006/11/14 07:34:30 jhunold
|
||||
// Removed wrong export declarations.
|
||||
//
|
||||
// Revision 1.61 2006/11/13 20:03:48 jhunold
|
||||
// Added missing export declarations.
|
||||
//
|
||||
// Revision 1.60 2006/03/19 07:27:11 rogeeff
|
||||
// avoid warning
|
||||
//
|
||||
// Revision 1.59 2006/03/03 17:39:46 rogeeff
|
||||
// paaspoint added to check throw
|
||||
//
|
||||
// Revision 1.58 2006/02/06 10:04:55 rogeeff
|
||||
// BOOST_TEST_MODULE - master test suite name
|
||||
//
|
||||
// Revision 1.57 2006/01/28 07:00:47 rogeeff
|
||||
// sunpro port
|
||||
//
|
||||
// Revision 1.56 2005/12/19 03:08:30 rogeeff
|
||||
// added is_abstract to guard numeric_limits instantiation
|
||||
//
|
||||
// Revision 1.55 2005/12/14 05:20:41 rogeeff
|
||||
// dll support introduced
|
||||
// BOOST_TEST_PASSPOINT() introduced
|
||||
// BOOST_MESSAGE depricated. Use BOOST_TEST_MESSAGE instead
|
||||
// BOOST_CHECKPOINT is depricated. Use BOOST_TEST_CHECKPOINT intead
|
||||
//
|
||||
// Revision 1.54 2005/06/07 04:38:20 rogeeff
|
||||
// borland fix
|
||||
//
|
||||
// Revision 1.53 2005/05/11 04:51:14 rogeeff
|
||||
// borlard portability fix
|
||||
//
|
||||
// Revision 1.52 2005/03/22 07:08:47 rogeeff
|
||||
// string comparisons streamlined
|
||||
// precision settings made portable
|
||||
//
|
||||
// Revision 1.51 2005/02/21 10:23:54 rogeeff
|
||||
// major issue with TT redesign causing TT to reevaluate it's arguments fixed
|
||||
// FP precision extended
|
||||
//
|
||||
// Revision 1.50 2005/02/20 08:27:06 rogeeff
|
||||
// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
|
||||
//
|
||||
// Revision 1.49 2005/02/01 06:40:06 rogeeff
|
||||
// copyright update
|
||||
// old log entries removed
|
||||
// minor stylistic changes
|
||||
// deprecated tools removed
|
||||
//
|
||||
// Revision 1.48 2005/01/30 03:32:57 rogeeff
|
||||
// Test Tools completely reworked:
|
||||
// interfaces streamlined to provide 3 version for each tool
|
||||
// implementation reworked to use single vararg formatter function
|
||||
// CHECK_COLLECTION now expect 4 arguments
|
||||
// BITWISE_EQUAL renamed to CHECK_BITWISE_EQUAL but still provided as deprecated
|
||||
// CHECK_COLLECTION interface changed to use PP_SEQ and as a result support arbitrary number of predicate arguments
|
||||
// most of templates eliminated
|
||||
// deprecated tools removed
|
||||
// print_helper object generator added
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/unit_test_suite_impl.hpp>
|
||||
#include <boost/test/framework.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
@@ -43,7 +42,8 @@ boost::unit_test::make_test_case((function), BOOST_TEST_STRINGIZE( function ), t
|
||||
|
||||
#define BOOST_AUTO_TEST_SUITE( suite_name ) \
|
||||
namespace suite_name { \
|
||||
BOOST_AUTO_TC_REGISTRAR( suite_name )( BOOST_STRINGIZE( suite_name ) ); \
|
||||
BOOST_AUTO_TC_REGISTRAR( suite_name )( BOOST_TEST_SUITE( \
|
||||
BOOST_STRINGIZE( suite_name ) ) ); \
|
||||
/**/
|
||||
|
||||
// ************************************************************************** //
|
||||
@@ -70,17 +70,14 @@ BOOST_AUTO_TC_REGISTRAR( BOOST_JOIN( end_suite, __LINE__ ) )( 1 ); \
|
||||
|
||||
#define BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test_name, n ) \
|
||||
struct BOOST_AUTO_TC_UNIQUE_ID( test_name ); \
|
||||
namespace boost { namespace unit_test { namespace ut_detail { \
|
||||
\
|
||||
static struct BOOST_JOIN( test_name, _exp_fail_num_spec ) \
|
||||
: boost::unit_test::ut_detail:: \
|
||||
auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) > \
|
||||
{ \
|
||||
BOOST_JOIN( test_name, _exp_fail_num_spec )() \
|
||||
: boost::unit_test::ut_detail:: \
|
||||
auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) >( n ) \
|
||||
{} \
|
||||
} BOOST_JOIN( test_name, _exp_fail_num_spec_inst ); \
|
||||
template<> \
|
||||
struct auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) > { \
|
||||
enum { value = n }; \
|
||||
}; \
|
||||
\
|
||||
}}} \
|
||||
/**/
|
||||
|
||||
// ************************************************************************** //
|
||||
@@ -102,7 +99,7 @@ BOOST_AUTO_TC_REGISTRAR( test_name )( \
|
||||
boost::unit_test::make_test_case( \
|
||||
&BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
|
||||
boost::unit_test::ut_detail::auto_tc_exp_fail< \
|
||||
BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
|
||||
BOOST_AUTO_TC_UNIQUE_ID( test_name )>::value ); \
|
||||
\
|
||||
void test_name::test_method() \
|
||||
/**/
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <boost/test/detail/fwd_decl.hpp>
|
||||
#include <boost/test/detail/workaround.hpp>
|
||||
#include <boost/test/test_observer.hpp>
|
||||
#include <boost/test/framework.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -66,9 +67,7 @@ public:
|
||||
// Public r/w properties
|
||||
readwrite_property<std::string> p_name; // name for this test unit
|
||||
readwrite_property<unsigned> p_timeout; // timeout for the test unit execution
|
||||
readwrite_property<counter_t> p_expected_failures; // number of expected failures in this test unit
|
||||
|
||||
void increase_exp_fail( unsigned num );
|
||||
readwrite_property<counter_t> p_expected_failures; // number of expected failured in this test unit
|
||||
|
||||
private:
|
||||
// Data members
|
||||
@@ -121,19 +120,16 @@ public:
|
||||
// Constructor
|
||||
explicit test_suite( const_string ts_name );
|
||||
|
||||
// test unit list management
|
||||
// test case list management
|
||||
void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 );
|
||||
void add( test_unit_generator const& gen, unsigned timeout = 0 );
|
||||
|
||||
// access methods
|
||||
test_unit_id get( const_string tu_name ) const;
|
||||
|
||||
protected:
|
||||
friend BOOST_TEST_DECL
|
||||
void traverse_test_tree( test_suite const&, test_tree_visitor& );
|
||||
friend BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor& );
|
||||
friend class framework_impl;
|
||||
virtual ~test_suite() {}
|
||||
|
||||
private:
|
||||
// Data members
|
||||
std::vector<test_unit_id> m_members;
|
||||
};
|
||||
@@ -176,7 +172,7 @@ protected:
|
||||
|
||||
BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor& );
|
||||
BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor& );
|
||||
BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor& );
|
||||
BOOST_TEST_DECL void traverse_test_tree( test_unit_id id, test_tree_visitor& );
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
@@ -262,39 +258,41 @@ namespace ut_detail {
|
||||
|
||||
struct BOOST_TEST_DECL auto_test_unit_registrar
|
||||
{
|
||||
// Constructors
|
||||
auto_test_unit_registrar( test_case* tc, counter_t exp_fail );
|
||||
explicit auto_test_unit_registrar( const_string ts_name );
|
||||
explicit auto_test_unit_registrar( test_unit_generator const& tc_gen );
|
||||
explicit auto_test_unit_registrar( int );
|
||||
// Constructor
|
||||
explicit auto_test_unit_registrar( test_case* tc, counter_t exp_fail )
|
||||
{
|
||||
curr_ts_store().back()->add( tc, exp_fail );
|
||||
}
|
||||
explicit auto_test_unit_registrar( test_suite* ts )
|
||||
{
|
||||
curr_ts_store().back()->add( ts );
|
||||
|
||||
curr_ts_store().push_back( ts );
|
||||
}
|
||||
explicit auto_test_unit_registrar( test_unit_generator const& tc_gen )
|
||||
{
|
||||
curr_ts_store().back()->add( tc_gen );
|
||||
}
|
||||
explicit auto_test_unit_registrar( int )
|
||||
{
|
||||
if( curr_ts_store().size() > 1 )
|
||||
curr_ts_store().pop_back();
|
||||
// else report error
|
||||
}
|
||||
|
||||
private:
|
||||
static std::list<test_suite*>& curr_ts_store();
|
||||
static std::list<test_suite*>& curr_ts_store()
|
||||
{
|
||||
static std::list<test_suite*> inst( 1, &framework::master_test_suite() );
|
||||
return inst;
|
||||
}
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename T>
|
||||
struct auto_tc_exp_fail {
|
||||
explicit auto_tc_exp_fail( unsigned v = 0 )
|
||||
: m_value( v )
|
||||
{
|
||||
instance() = this;
|
||||
}
|
||||
|
||||
static auto_tc_exp_fail*& instance()
|
||||
{
|
||||
static auto_tc_exp_fail inst;
|
||||
static auto_tc_exp_fail* inst_ptr = &inst;
|
||||
|
||||
return inst_ptr;
|
||||
}
|
||||
|
||||
unsigned value() const { return m_value; }
|
||||
|
||||
private:
|
||||
// Data members
|
||||
unsigned m_value;
|
||||
enum { value = 0 };
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -308,7 +306,7 @@ private:
|
||||
class BOOST_TEST_DECL global_fixture : public test_observer {
|
||||
public:
|
||||
// Constructor
|
||||
global_fixture();
|
||||
global_fixture() { framework::register_observer( *this ); }
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace unit_test {
|
||||
// configurable maximum fixed sized mapping size supported by this header.
|
||||
// You could redefine it before inclusion of this file.
|
||||
#ifndef MAX_MAP_SIZE
|
||||
#define MAX_MAP_SIZE 16
|
||||
#define MAX_MAP_SIZE 15
|
||||
#endif
|
||||
|
||||
#define CONSTR_DECL_MID( z, i, dummy1 ) key_param_type key##i, value_param_type v##i,
|
||||
|
||||
@@ -319,6 +319,22 @@ optionally_assign( T& target, Params const& p, Keyword k )
|
||||
// Revision History:
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.5 2005/12/14 05:01:13 rogeeff
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.4 2005/06/13 10:35:08 schoepflin
|
||||
// Enable optionally_assign() overload workaround for Tru64/CXX-6.5 as well.
|
||||
//
|
||||
// Revision 1.3 2005/06/05 18:10:59 grafik
|
||||
// named_param.hpp; Work around CW not handling operator, using declaration, by using a real operator,().
|
||||
// token_iterator_test.cpp; Work around CW-8 confused with array initialization.
|
||||
//
|
||||
// Revision 1.2 2005/05/03 05:02:49 rogeeff
|
||||
// como fixes
|
||||
//
|
||||
// Revision 1.1 2005/04/12 06:48:12 rogeeff
|
||||
// Runtime.Param library initial commit
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#endif // BOOST_TEST_NAMED_PARAM_022505GER
|
||||
|
||||
Reference in New Issue
Block a user