|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54633 - in branches/release: boost/test boost/test/detail boost/test/impl boost/test/utils boost/test/utils/basic_cstring boost/test/utils/iterator boost/test/utils/runtime boost/test/utils/runtime/cla boost/test/utils/runtime/cla/detail boost/test/utils/runtime/cla/iface boost/test/utils/runtime/env boost/test/utils/runtime/file libs/test libs/test/build libs/test/example libs/test/src libs/test/test libs/test/test/test_files libs/test/tools/console_test_runner/src
From: gennadiy.rozental_at_[hidden]
Date: 2009-07-04 02:37:07
Author: rogeeff
Date: 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
New Revision: 54633
URL: http://svn.boost.org/trac/boost/changeset/54633
Log:
Trunk version of Boost.Test finally being released
Added:
branches/release/libs/test/CMakeLists.txt
- copied unchanged from r54632, /trunk/libs/test/CMakeLists.txt
branches/release/libs/test/example/external_main_example_1.cpp
- copied unchanged from r54632, /trunk/libs/test/example/external_main_example_1.cpp
branches/release/libs/test/example/external_main_example_2.cpp
- copied unchanged from r54632, /trunk/libs/test/example/external_main_example_2.cpp
branches/release/libs/test/example/external_main_example_3.cpp
- copied unchanged from r54632, /trunk/libs/test/example/external_main_example_3.cpp
branches/release/libs/test/module.cmake
- copied unchanged from r54632, /trunk/libs/test/module.cmake
branches/release/libs/test/src/CMakeLists.txt
- copied unchanged from r54632, /trunk/libs/test/src/CMakeLists.txt
branches/release/libs/test/test/CMakeLists.txt
- copied unchanged from r54632, /trunk/libs/test/test/CMakeLists.txt
Removed:
branches/release/libs/test/test/test_files/test_fp_comparisons.pattern
Text files modified:
branches/release/boost/test/detail/enable_warnings.hpp | 6
branches/release/boost/test/detail/global_typedef.hpp | 20 +
branches/release/boost/test/detail/suppress_warnings.hpp | 6
branches/release/boost/test/detail/unit_test_parameters.hpp | 2
branches/release/boost/test/detail/workaround.hpp | 3
branches/release/boost/test/floating_point_comparison.hpp | 67 ++++-
branches/release/boost/test/framework.hpp | 6
branches/release/boost/test/impl/debug.ipp | 4
branches/release/boost/test/impl/exception_safety.ipp | 8
branches/release/boost/test/impl/execution_monitor.ipp | 138 +++++++++--
branches/release/boost/test/impl/framework.ipp | 33 +-
branches/release/boost/test/impl/interaction_based.ipp | 3
branches/release/boost/test/impl/logged_expectations.ipp | 2
branches/release/boost/test/impl/results_collector.ipp | 6
branches/release/boost/test/impl/results_reporter.ipp | 2
branches/release/boost/test/impl/test_tools.ipp | 20
branches/release/boost/test/impl/unit_test_main.ipp | 14
branches/release/boost/test/impl/unit_test_parameters.ipp | 451 ++++++++++++++++++++++++---------------
branches/release/boost/test/impl/unit_test_suite.ipp | 14
branches/release/boost/test/mock_object.hpp | 2
branches/release/boost/test/parameterized_test.hpp | 2
branches/release/boost/test/predicate_result.hpp | 5
branches/release/boost/test/test_case_template.hpp | 140 ------------
branches/release/boost/test/test_tools.hpp | 28 +-
branches/release/boost/test/unit_test_log.hpp | 4
branches/release/boost/test/unit_test_suite.hpp | 32 ++
branches/release/boost/test/unit_test_suite_impl.hpp | 80 +++++++
branches/release/boost/test/utils/basic_cstring/basic_cstring.hpp | 18
branches/release/boost/test/utils/class_properties.hpp | 4
branches/release/boost/test/utils/fixed_mapping.hpp | 2
branches/release/boost/test/utils/foreach.hpp | 2
branches/release/boost/test/utils/iterator/token_iterator.hpp | 2
branches/release/boost/test/utils/named_params.hpp | 59 ++++-
branches/release/boost/test/utils/runtime/argument.hpp | 11
branches/release/boost/test/utils/runtime/cla/argument_factory.hpp | 12
branches/release/boost/test/utils/runtime/cla/basic_parameter.hpp | 13
branches/release/boost/test/utils/runtime/cla/char_parameter.hpp | 2
branches/release/boost/test/utils/runtime/cla/char_parameter.ipp | 4
branches/release/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp | 4
branches/release/boost/test/utils/runtime/cla/dual_name_parameter.hpp | 16 +
branches/release/boost/test/utils/runtime/cla/id_policy.hpp | 36 +-
branches/release/boost/test/utils/runtime/cla/id_policy.ipp | 30 +-
branches/release/boost/test/utils/runtime/cla/iface/argument_factory.hpp | 2
branches/release/boost/test/utils/runtime/cla/iface/id_policy.hpp | 11
branches/release/boost/test/utils/runtime/cla/modifier.hpp | 12
branches/release/boost/test/utils/runtime/cla/named_parameter.ipp | 51 ++-
branches/release/boost/test/utils/runtime/cla/parameter.hpp | 8
branches/release/boost/test/utils/runtime/cla/parser.hpp | 2
branches/release/boost/test/utils/runtime/cla/parser.ipp | 9
branches/release/boost/test/utils/runtime/cla/positional_parameter.hpp | 2
branches/release/boost/test/utils/runtime/cla/typed_parameter.hpp | 6
branches/release/boost/test/utils/runtime/config.hpp | 12
branches/release/boost/test/utils/runtime/env/environment.hpp | 4
branches/release/boost/test/utils/runtime/env/fwd.hpp | 4
branches/release/boost/test/utils/runtime/env/variable.hpp | 10
branches/release/boost/test/utils/runtime/file/config_file_iterator.cpp | 7
branches/release/libs/test/build/Jamfile.v2 | 42 ++
branches/release/libs/test/example/Jamfile.v2 | 4
branches/release/libs/test/example/test_case_template_example.cpp | 3
branches/release/libs/test/test/Jamfile.v2 | 33 ++
branches/release/libs/test/test/basic_cstring_test.cpp | 1
branches/release/libs/test/test/test_files/errors_handling_test.pattern | 12
branches/release/libs/test/test/test_files/errors_handling_test.pattern2 | 12
branches/release/libs/test/test/test_files/test_tools_test.pattern | 112 ++++----
branches/release/libs/test/test/test_fp_comparisons.cpp | 9
branches/release/libs/test/test/test_tools_test.cpp | 5
branches/release/libs/test/test/token_iterator_test.cpp | 2
branches/release/libs/test/tools/console_test_runner/src/console_test_runner.cpp | 2
68 files changed, 1035 insertions(+), 655 deletions(-)
Modified: branches/release/boost/test/detail/enable_warnings.hpp
==============================================================================
--- branches/release/boost/test/detail/enable_warnings.hpp (original)
+++ branches/release/boost/test/detail/enable_warnings.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -13,8 +13,8 @@
// ***************************************************************************
#ifdef BOOST_MSVC
-# pragma warning(default: 4511) // copy constructor could not be generated
-# pragma warning(default: 4512) // assignment operator could not be generated
+# pragma warning(default: 4511) // copy constructor can't not be generated
+# pragma warning(default: 4512) // assignment operator can't not be generated
# pragma warning(default: 4100) // unreferenced formal parameter
# pragma warning(default: 4996) // <symbol> was declared deprecated
# pragma warning(default: 4355) // 'this' : used in base member initializer list
@@ -24,5 +24,7 @@
# pragma warning(default: 4290) // C++ exception specification ignored except to ...
# pragma warning(default: 4180) // qualifier applied to function type has no meaning; ignored
# pragma warning(default: 4275) // non dll-interface class ... used as base for dll-interface class ...
+# pragma warning(default: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
+# pragma warning(default: 4511) // 'class' : copy constructor could not be generated
# pragma warning(pop)
#endif
Modified: branches/release/boost/test/detail/global_typedef.hpp
==============================================================================
--- branches/release/boost/test/detail/global_typedef.hpp (original)
+++ branches/release/boost/test/detail/global_typedef.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -32,11 +32,11 @@
//____________________________________________________________________________//
-enum report_level { CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT, INV_REPORT_LEVEL };
+enum report_level { INV_REPORT_LEVEL, CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT };
//____________________________________________________________________________//
-enum output_format { CLF /* compiler log format */, XML /* XML */ };
+enum output_format { INV_OF, CLF /* compiler log format */, XML /* XML */ };
//____________________________________________________________________________//
@@ -45,6 +45,7 @@
//____________________________________________________________________________//
typedef unsigned long test_unit_id;
+
const test_unit_id INV_TEST_UNIT_ID = 0xFFFFFFFF;
const test_unit_id MAX_TEST_CASE_ID = 0xFFFFFFFE;
const test_unit_id MIN_TEST_CASE_ID = 0x00010000;
@@ -53,6 +54,8 @@
//____________________________________________________________________________//
+namespace ut_detail {
+
inline test_unit_type
test_id_2_unit_type( test_unit_id id )
{
@@ -61,6 +64,19 @@
//____________________________________________________________________________//
+// helper templates to prevent ODR violations
+template<class T>
+struct static_constant {
+ static T value;
+};
+
+template<class T>
+T static_constant<T>::value;
+
+//____________________________________________________________________________//
+
+} // namespace ut_detail
+
} // namespace unit_test
} // namespace boost
Modified: branches/release/boost/test/detail/suppress_warnings.hpp
==============================================================================
--- branches/release/boost/test/detail/suppress_warnings.hpp (original)
+++ branches/release/boost/test/detail/suppress_warnings.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -14,8 +14,8 @@
#ifdef BOOST_MSVC
# pragma warning(push)
-# pragma warning(disable: 4511) // copy constructor could not be generated
-# pragma warning(disable: 4512) // assignment operator could not be generated
+# pragma warning(disable: 4511) // copy constructor can't not be generated
+# pragma warning(disable: 4512) // assignment operator can't not be generated
# pragma warning(disable: 4100) // unreferenced formal parameter
# pragma warning(disable: 4996) // <symbol> was declared deprecated
# pragma warning(disable: 4355) // 'this' : used in base member initializer list
@@ -25,5 +25,7 @@
# pragma warning(disable: 4290) // C++ exception specification ignored except to ...
# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
+# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
+# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated
#endif
Modified: branches/release/boost/test/detail/unit_test_parameters.hpp
==============================================================================
--- branches/release/boost/test/detail/unit_test_parameters.hpp (original)
+++ branches/release/boost/test/detail/unit_test_parameters.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -32,7 +32,7 @@
namespace runtime_config {
-void BOOST_TEST_DECL init( int* argc, char** argv );
+void BOOST_TEST_DECL init( int& argc, char** argv );
unit_test::log_level BOOST_TEST_DECL log_level();
bool BOOST_TEST_DECL no_result_code();
Modified: branches/release/boost/test/detail/workaround.hpp
==============================================================================
--- branches/release/boost/test/detail/workaround.hpp (original)
+++ branches/release/boost/test/detail/workaround.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -41,6 +41,9 @@
return res;
}
+
+//____________________________________________________________________________//
+
#else
using std::distance;
#endif
Modified: branches/release/boost/test/floating_point_comparison.hpp
==============================================================================
--- branches/release/boost/test/floating_point_comparison.hpp (original)
+++ branches/release/boost/test/floating_point_comparison.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -15,9 +15,15 @@
#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
-#include <boost/limits.hpp> // for std::numeric_limits
-
+// Boost.Test
+#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/utils/class_properties.hpp>
+#include <boost/test/predicate_result.hpp>
+
+// Boost
+#include <boost/limits.hpp> // for std::numeric_limits
+#include <boost/numeric/conversion/conversion_traits.hpp> // for numeric::conversion_traits
+#include <boost/static_assert.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -79,12 +85,12 @@
safe_fpt_division( FPT f1, FPT f2 )
{
// Avoid overflow.
- if( f2 < static_cast<FPT>(1) && f1 > f2*fpt_limits<FPT>::max_value() )
+ if( (f2 < static_cast<FPT>(1)) && (f1 > f2*fpt_limits<FPT>::max_value()) )
return fpt_limits<FPT>::max_value();
// Avoid underflow.
- if( f1 == static_cast<FPT>(0) ||
- f2 > static_cast<FPT>(1) && f1 < f2*fpt_limits<FPT>::min_value() )
+ if( (f1 == static_cast<FPT>(0)) ||
+ ((f2 > static_cast<FPT>(1)) && (f1 < f2*fpt_limits<FPT>::min_value())) )
return static_cast<FPT>(0);
return f1/f2;
@@ -166,28 +172,38 @@
floating_point_comparison_type fpc_type = FPC_STRONG )
: p_fraction_tolerance( tt_detail::fpt_abs( static_cast<FPT>(0.01)*tolerance.m_value ) )
, p_strong_or_weak( fpc_type == FPC_STRONG )
+ , m_report_modifier( 100. )
{}
template<typename ToleranceBaseType>
explicit close_at_tolerance( fraction_tolerance_t<ToleranceBaseType> tolerance,
floating_point_comparison_type fpc_type = FPC_STRONG )
: p_fraction_tolerance( tt_detail::fpt_abs( tolerance.m_value ) )
, p_strong_or_weak( fpc_type == FPC_STRONG )
+ , m_report_modifier( 1. )
{}
- bool operator()( FPT left, FPT right ) const
+ predicate_result operator()( FPT left, FPT right ) const
{
FPT diff = tt_detail::fpt_abs( left - right );
FPT d1 = tt_detail::safe_fpt_division( diff, tt_detail::fpt_abs( right ) );
FPT d2 = tt_detail::safe_fpt_division( diff, tt_detail::fpt_abs( left ) );
- return p_strong_or_weak
- ? (d1 <= p_fraction_tolerance.get() && d2 <= p_fraction_tolerance.get())
- : (d1 <= p_fraction_tolerance.get() || d2 <= p_fraction_tolerance.get());
+ predicate_result res( p_strong_or_weak
+ ? (d1 <= p_fraction_tolerance.get() && d2 <= p_fraction_tolerance.get())
+ : (d1 <= p_fraction_tolerance.get() || d2 <= p_fraction_tolerance.get()) );
+
+ if( !res )
+ res.message() << (( d1 <= p_fraction_tolerance.get() ? d2 : d1 ) * m_report_modifier);
+
+ return res;
}
// Public properties
readonly_property<FPT> p_fraction_tolerance;
readonly_property<bool> p_strong_or_weak;
+private:
+ // Data members
+ FPT m_report_modifier;
};
//____________________________________________________________________________//
@@ -200,20 +216,31 @@
// Public typedefs
typedef bool result_type;
- template<typename FPT, typename ToleranceBaseType>
- bool
- operator()( FPT left, FPT right, percent_tolerance_t<ToleranceBaseType> tolerance,
- floating_point_comparison_type fpc_type = FPC_STRONG )
+ template<typename FPT1, typename FPT2, typename ToleranceBaseType>
+ predicate_result
+ operator()( FPT1 left, FPT2 right, percent_tolerance_t<ToleranceBaseType> tolerance,
+ floating_point_comparison_type fpc_type = FPC_STRONG ) const
{
+ // deduce "better" type from types of arguments being compared
+ // if one type is floating and the second integral we use floating type and
+ // value of integral type is promoted to the floating. The same for float and double
+ // But we don't want to compare two values of integral types using this tool.
+ typedef typename numeric::conversion_traits<FPT1,FPT2>::supertype FPT;
+ BOOST_STATIC_ASSERT( !is_integral<FPT>::value );
+
close_at_tolerance<FPT> pred( tolerance, fpc_type );
return pred( left, right );
}
- template<typename FPT, typename ToleranceBaseType>
- bool
- operator()( FPT left, FPT right, fraction_tolerance_t<ToleranceBaseType> tolerance,
- floating_point_comparison_type fpc_type = FPC_STRONG )
+ template<typename FPT1, typename FPT2, typename ToleranceBaseType>
+ predicate_result
+ operator()( FPT1 left, FPT2 right, fraction_tolerance_t<ToleranceBaseType> tolerance,
+ floating_point_comparison_type fpc_type = FPC_STRONG ) const
{
+ // same as in a comment above
+ typedef typename numeric::conversion_traits<FPT1,FPT2>::supertype FPT;
+ BOOST_STATIC_ASSERT( !is_integral<FPT>::value );
+
close_at_tolerance<FPT> pred( tolerance, fpc_type );
return pred( left, right );
@@ -221,7 +248,7 @@
};
namespace {
-check_is_close_t check_is_close;
+check_is_close_t const& check_is_close = unit_test::ut_detail::static_constant<check_is_close_t>::value;
}
//____________________________________________________________________________//
@@ -236,14 +263,14 @@
template<typename FPT>
bool
- operator()( FPT fpv, FPT tolerance )
+ operator()( FPT fpv, FPT tolerance ) const
{
return tt_detail::fpt_abs( fpv ) < tt_detail::fpt_abs( tolerance );
}
};
namespace {
-check_is_small_t check_is_small;
+check_is_small_t const& check_is_small = unit_test::ut_detail::static_constant<check_is_small_t>::value;
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/framework.hpp
==============================================================================
--- branches/release/boost/test/framework.hpp (original)
+++ branches/release/boost/test/framework.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -70,7 +70,7 @@
template<typename UnitType>
UnitType& get( test_unit_id id )
{
- return static_cast<UnitType&>( get( id, (test_unit_type)UnitType::type ) );
+ return static_cast<UnitType&>( get( id, static_cast<test_unit_type>(UnitType::type) ) );
}
// test initiation
@@ -94,6 +94,10 @@
setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {}
};
+#define BOOST_TEST_SETUP_ASSERT( cond, msg ) if( cond ) {} else throw unit_test::framework::setup_error( msg )
+
+struct nothing_to_test {}; // not really an error
+
} // namespace framework
} // unit_test
Modified: branches/release/boost/test/impl/debug.ipp
==============================================================================
--- branches/release/boost/test/impl/debug.ipp (original)
+++ branches/release/boost/test/impl/debug.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -834,8 +834,8 @@
bool created = !!::CreateProcessA(
NULL, // pointer to name of executable module; NULL - use the one in command line
cmd_line, // pointer to command line string
- NULL, // pointer to process security attributes; NULL - debugger's handle couldn't be inherited
- NULL, // pointer to thread security attributes; NULL - debugger's handle couldn't be inherited
+ NULL, // pointer to process security attributes; NULL - debugger's handle can't be inherited
+ NULL, // pointer to thread security attributes; NULL - debugger's handle can't be inherited
true, // debugger inherit opened handles
0, // priority flags; 0 - normal priority
NULL, // pointer to new environment block; NULL - use this process environment
Modified: branches/release/boost/test/impl/exception_safety.ipp
==============================================================================
--- branches/release/boost/test/impl/exception_safety.ipp (original)
+++ branches/release/boost/test/impl/exception_safety.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -166,7 +166,7 @@
, m_forced_exception_point( 1 )
, m_exec_path_point( 0 )
, m_exec_path_counter( 1 )
-, m_break_exec_path( (unsigned)-1 )
+, m_break_exec_path( static_cast<unsigned>(-1) )
, m_invairant_failed( false )
{
framework::register_observer( *this );
@@ -447,7 +447,7 @@
unsigned i;
for( i = 0; i < std::min<std::size_t>( it->m_alloc.size, 8 ); i++ ) {
- unsigned char c = ((unsigned char*)it->m_alloc.ptr)[i];
+ unsigned char c = static_cast<unsigned char*>(it->m_alloc.ptr)[i];
if( (std::isprint)( c ) )
formatter << c;
else
@@ -457,7 +457,7 @@
formatter << "> ";
for( i = 0; i < std::min<std::size_t>( it->m_alloc.size, 8 ); i++ ) {
- unsigned c = ((unsigned char*)it->m_alloc.ptr)[i];
+ unsigned c = static_cast<unsigned char*>(it->m_alloc.ptr)[i];
formatter << std::hex << std::uppercase << c << ' ';
}
@@ -491,7 +491,7 @@
if( m_invairant_failed )
formatter << " and ";
- formatter << (unsigned int)m_memory_in_use.size() << " memory leak";
+ formatter << static_cast<unsigned int>(m_memory_in_use.size()) << " memory leak";
if( m_memory_in_use.size() > 1 )
formatter << 's';
}
Modified: branches/release/boost/test/impl/execution_monitor.ipp
==============================================================================
--- branches/release/boost/test/impl/execution_monitor.ipp (original)
+++ branches/release/boost/test/impl/execution_monitor.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -114,8 +114,16 @@
#endif
# if !defined(NDEBUG) && defined(_MSC_VER) && !defined(UNDER_CE)
-# define BOOST_TEST_USE_DEBUG_MS_CRT
# include <crtdbg.h>
+# define BOOST_TEST_CRT_HOOK_TYPE _CRT_REPORT_HOOK
+# define BOOST_TEST_CRT_ASSERT _CRT_ASSERT
+# define BOOST_TEST_CRT_ERROR _CRT_ERROR
+# define BOOST_TEST_CRT_SET_HOOK(H) _CrtSetReportHook(H)
+# else
+# define BOOST_TEST_CRT_HOOK_TYPE void*
+# define BOOST_TEST_CRT_ASSERT 2
+# define BOOST_TEST_CRT_ERROR 1
+# define BOOST_TEST_CRT_SET_HOOK(H) (void*)(H)
# endif
# if !BOOST_WORKAROUND(_MSC_VER, >= 1400 ) || defined(UNDER_CE)
@@ -144,6 +152,25 @@
# include <signal.h>
# include <setjmp.h>
+# if defined(__FreeBSD__)
+
+# ifndef SIGPOLL
+# define SIGPOLL SIGIO
+# endif
+
+# if (__FreeBSD_version < 70100)
+
+# define ILL_ILLADR 0 // ILL_RESAD_FAULT
+# define ILL_PRVOPC ILL_PRIVIN_FAULT
+# define ILL_ILLOPN 2 // ILL_RESOP_FAULT
+# define ILL_COPROC ILL_FPOP_FAULT
+
+# define BOOST_TEST_LIMITED_SIGNAL_DETAILS
+# define BOOST_TEST_IGNORE_SIGCHLD
+
+# endif
+# endif
+
# if !defined(__CYGWIN__) && !defined(__QNXNTO__)
# define BOOST_TEST_USE_ALT_STACK
# endif
@@ -200,7 +227,9 @@
va_list args;
va_start( args, format );
- BOOST_TEST_VSNPRINTF( buf, sizeof(buf), format, args );
+ BOOST_TEST_VSNPRINTF( buf, sizeof(buf)-1, format, args );
+ buf[sizeof(buf)-1] = 0;
+
va_end( args );
throw execution_exception( ec, buf );
@@ -290,46 +319,53 @@
switch( m_sig_info->si_signo ) {
case SIGILL:
switch( m_sig_info->si_code ) {
+#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case ILL_ILLOPC:
report_error( execution_exception::system_fatal_error,
"signal: illegal opcode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
- case ILL_ILLOPN:
+ case ILL_ILLTRP:
report_error( execution_exception::system_fatal_error,
- "signal: illegal operand; address of failing instruction: 0x%08lx",
+ "signal: illegal trap; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
- case ILL_ILLADR:
+ case ILL_PRVREG:
report_error( execution_exception::system_fatal_error,
- "signal: illegal addressing mode; address of failing instruction: 0x%08lx",
+ "signal: privileged register; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
- case ILL_ILLTRP:
+ case ILL_BADSTK:
report_error( execution_exception::system_fatal_error,
- "signal: illegal trap; address of failing instruction: 0x%08lx",
+ "signal: internal stack error; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
- case ILL_PRVOPC:
+#endif
+ case ILL_ILLOPN:
report_error( execution_exception::system_fatal_error,
- "signal: privileged opcode; address of failing instruction: 0x%08lx",
+ "signal: illegal operand; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
- case ILL_PRVREG:
+ case ILL_ILLADR:
report_error( execution_exception::system_fatal_error,
- "signal: privileged register; address of failing instruction: 0x%08lx",
+ "signal: illegal addressing mode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
- case ILL_COPROC:
+ case ILL_PRVOPC:
report_error( execution_exception::system_fatal_error,
- "signal: co-processor error; address of failing instruction: 0x%08lx",
+ "signal: privileged opcode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
- case ILL_BADSTK:
+ case ILL_COPROC:
report_error( execution_exception::system_fatal_error,
- "signal: internal stack error; address of failing instruction: 0x%08lx",
+ "signal: co-processor error; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
+ default:
+ report_error( execution_exception::system_fatal_error,
+ "signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)",
+ m_sig_info->si_addr, m_sig_info->si_code );
+ break;
}
break;
@@ -375,11 +411,17 @@
"signal: subscript out of range; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
+ default:
+ report_error( execution_exception::system_error,
+ "signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)",
+ m_sig_info->si_addr, m_sig_info->si_code );
+ break;
}
break;
case SIGSEGV:
switch( m_sig_info->si_code ) {
+#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case SEGV_MAPERR:
report_error( execution_exception::system_fatal_error,
"memory access violation at address: 0x%08lx: no mapping at fault address",
@@ -390,11 +432,18 @@
"memory access violation at address: 0x%08lx: invalid permissions",
m_sig_info->si_addr );
break;
+#endif
+ default:
+ report_error( execution_exception::system_fatal_error,
+ "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)",
+ m_sig_info->si_addr, m_sig_info->si_code );
+ break;
}
break;
case SIGBUS:
switch( m_sig_info->si_code ) {
+#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case BUS_ADRALN:
report_error( execution_exception::system_fatal_error,
"memory access violation at address: 0x%08lx: invalid address alignment",
@@ -410,11 +459,18 @@
"memory access violation at address: 0x%08lx: object specific hardware error",
m_sig_info->si_addr );
break;
+#endif
+ default:
+ report_error( execution_exception::system_fatal_error,
+ "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)",
+ m_sig_info->si_addr, m_sig_info->si_code );
+ break;
}
break;
case SIGCHLD:
switch( m_sig_info->si_code ) {
+#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case CLD_EXITED:
report_error( execution_exception::system_error,
"child has exited; pid: %d; uid: %d; exit value: %d",
@@ -445,6 +501,12 @@
"stopped child had continued; pid: %d; uid: %d; exit value: %d",
(int)m_sig_info->si_pid, (int)m_sig_info->si_uid, (int)m_sig_info->si_status );
break;
+#endif
+ default:
+ report_error( execution_exception::system_error,
+ "signal: SIGCHLD, si_code: %d (child process has terminated; pid: %d; uid: %d; exit value: %d)",
+ (int)m_sig_info->si_pid, (int)m_sig_info->si_uid, (int)m_sig_info->si_status, m_sig_info->si_code );
+ break;
}
break;
@@ -452,6 +514,7 @@
case SIGPOLL:
switch( m_sig_info->si_code ) {
+#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case POLL_IN:
report_error( execution_exception::system_error,
"data input available; band event %d",
@@ -484,6 +547,12 @@
(int)m_sig_info->si_band );
break;
#endif
+#endif
+ default:
+ report_error( execution_exception::system_error,
+ "signal: SIGPOLL, si_code: %d (asynchronous I/O event occured; band event %d)",
+ (int)m_sig_info->si_band, m_sig_info->si_code );
+ break;
}
break;
@@ -520,7 +589,8 @@
typedef struct sigaction* sigaction_ptr;
public:
//Constructor
- explicit signal_action( int sig, bool install, bool attach_dbg, char* alt_stack );
+ signal_action();
+ signal_action( int sig, bool install, bool attach_dbg, char* alt_stack );
~signal_action();
private:
@@ -533,6 +603,12 @@
//____________________________________________________________________________//
+signal_action::signal_action()
+: m_installed( false )
+{}
+
+//____________________________________________________________________________//
+
signal_action::signal_action( int sig, bool install, bool attach_dbg, char* alt_stack )
: m_sig( sig )
, m_installed( install )
@@ -609,9 +685,7 @@
signal_action m_SEGV_action;
signal_action m_BUS_action;
signal_action m_CHLD_action;
-#ifdef BOOST_TEST_CATCH_SIGPOLL
signal_action m_POLL_action;
-#endif
signal_action m_ABRT_action;
signal_action m_ALRM_action;
@@ -634,7 +708,9 @@
, m_FPE_action ( SIGFPE , catch_system_errors, attach_dbg, alt_stack )
, m_SEGV_action( SIGSEGV, catch_system_errors, attach_dbg, alt_stack )
, m_BUS_action ( SIGBUS , catch_system_errors, attach_dbg, alt_stack )
+#ifndef BOOST_TEST_IGNORE_SIGCHLD
, m_CHLD_action( SIGCHLD, catch_system_errors, attach_dbg, alt_stack )
+#endif
#ifdef BOOST_TEST_CATCH_SIGPOLL
, m_POLL_action( SIGPOLL, catch_system_errors, attach_dbg, alt_stack )
#endif
@@ -695,7 +771,10 @@
static bool ignore_sigchild( siginfo_t* info )
{
- return info->si_signo == SIGCHLD && info->si_code == CLD_EXITED
+ return info->si_signo == SIGCHLD
+#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
+ && info->si_code == CLD_EXITED
+#endif
#ifdef BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE
;
#else
@@ -807,7 +886,7 @@
static void
seh_catch_preventer( unsigned int /* id */, _EXCEPTION_POINTERS* /* exps */ )
{
- throw;
+ throw;
}
//____________________________________________________________________________//
@@ -941,21 +1020,19 @@
//____________________________________________________________________________//
-#if defined(BOOST_TEST_USE_DEBUG_MS_CRT)
-
// ************************************************************************** //
// ************** assert_reporting_function ************** //
// ************************************************************************** //
int BOOST_TEST_CALL_DECL
-assert_reporting_function( int reportType, char* userMessage, int* retVal )
+assert_reporting_function( int reportType, char* userMessage, int* )
{
switch( reportType ) {
- case _CRT_ASSERT:
+ case BOOST_TEST_CRT_ASSERT:
detail::report_error( execution_exception::user_error, userMessage );
return 1; // return value and retVal are not important since we never reach this line
- case _CRT_ERROR:
+ case BOOST_TEST_CRT_ERROR:
detail::report_error( execution_exception::system_error, userMessage );
return 1; // return value and retVal are not important since we never reach this line
@@ -964,8 +1041,6 @@
}
} // assert_reporting_function
-#endif
-
//____________________________________________________________________________//
void BOOST_TEST_CALL_DECL
@@ -1015,6 +1090,7 @@
execution_monitor::catch_signals( unit_test::callback0<int> const& F )
{
_invalid_parameter_handler old_iph = _invalid_parameter_handler();
+ BOOST_TEST_CRT_HOOK_TYPE old_crt_hook;
if( !p_catch_system_errors )
_set_se_translator( &detail::seh_catch_preventer );
@@ -1022,9 +1098,7 @@
if( !!p_detect_fp_exceptions )
detail::switch_fp_exceptions( true );
-#ifdef BOOST_TEST_USE_DEBUG_MS_CRT
- _CrtSetReportHook( &detail::assert_reporting_function );
-#endif
+ old_crt_hook = BOOST_TEST_CRT_SET_HOOK( &detail::assert_reporting_function );
old_iph = _set_invalid_parameter_handler(
reinterpret_cast<_invalid_parameter_handler>( &detail::invalid_param_handler ) );
@@ -1047,6 +1121,8 @@
if( !!p_detect_fp_exceptions )
detail::switch_fp_exceptions( false );
+ BOOST_TEST_CRT_SET_HOOK( old_crt_hook );
+
_set_invalid_parameter_handler( old_iph );
}
}
Modified: branches/release/boost/test/impl/framework.ipp
==============================================================================
--- branches/release/boost/test/impl/framework.ipp (original)
+++ branches/release/boost/test/impl/framework.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -127,10 +127,10 @@
test_unit_store::value_type const& tu = *m_test_units.begin();
// the delete will erase this element from map
- if( test_id_2_unit_type( tu.second->p_id ) == tut_suite )
- delete (test_suite const*)tu.second;
+ if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == tut_suite )
+ delete static_cast<test_suite const*>(tu.second);
else
- delete (test_case const*)tu.second;
+ delete static_cast<test_case const*>(tu.second);
}
}
@@ -219,7 +219,11 @@
namespace {
+#if defined(__CYGWIN__)
+framework_impl& s_frk_impl() { static framework_impl* the_inst = 0; if(!the_inst) the_inst = new framework_impl; return *the_inst; }
+#else
framework_impl& s_frk_impl() { static framework_impl the_inst; return the_inst; }
+#endif
} // local namespace
@@ -230,7 +234,7 @@
void
init( init_unit_test_func init_func, int argc, char* argv[] )
{
- runtime_config::init( &argc, argv );
+ runtime_config::init( argc, argv );
// set the log level and format
unit_test_log.set_threshold_level( runtime_config::log_level() );
@@ -282,13 +286,11 @@
void
register_test_unit( test_case* tc )
{
- if( tc->p_id != INV_TEST_UNIT_ID )
- throw setup_error( BOOST_TEST_L( "test case already registered" ) );
+ BOOST_TEST_SETUP_ASSERT( tc->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test case already registered" ) );
test_unit_id new_id = s_frk_impl().m_next_test_case_id;
- if( new_id == MAX_TEST_CASE_ID )
- throw setup_error( BOOST_TEST_L( "too many test cases" ) );
+ BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_CASE_ID, BOOST_TEST_L( "too many test cases" ) );
typedef framework_impl::test_unit_store::value_type map_value_type;
@@ -303,13 +305,11 @@
void
register_test_unit( test_suite* ts )
{
- if( ts->p_id != INV_TEST_UNIT_ID )
- throw setup_error( BOOST_TEST_L( "test suite already registered" ) );
+ BOOST_TEST_SETUP_ASSERT( ts->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test suite already registered" ) );
test_unit_id new_id = s_frk_impl().m_next_test_suite_id;
- if( new_id == MAX_TEST_SUITE_ID )
- throw setup_error( BOOST_TEST_L( "too many test suites" ) );
+ BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_SUITE_ID, BOOST_TEST_L( "too many test suites" ) );
typedef framework_impl::test_unit_store::value_type map_value_type;
s_frk_impl().m_test_units.insert( map_value_type( new_id, ts ) );
@@ -401,10 +401,9 @@
test_case_counter tcc;
traverse_test_tree( id, tcc );
- if( tcc.p_count == 0 )
- throw setup_error( runtime_config::test_to_run().is_empty()
- ? BOOST_TEST_L( "test tree is empty" )
- : BOOST_TEST_L( "no test cases matching filter" ) );
+ BOOST_TEST_SETUP_ASSERT( tcc.p_count != 0 , runtime_config::test_to_run().is_empty()
+ ? BOOST_TEST_L( "test tree is empty" )
+ : BOOST_TEST_L( "no test cases matching filter" ) );
bool call_start_finish = !continue_test || !s_frk_impl().m_test_in_progress;
bool was_in_progress = s_frk_impl().m_test_in_progress;
@@ -428,7 +427,7 @@
case 0:
break;
case 1: {
- unsigned int seed = (unsigned int)std::time( 0 );
+ unsigned int seed = static_cast<unsigned int>( std::time( 0 ) );
BOOST_TEST_MESSAGE( "Test cases order is shuffled using seed: " << seed );
std::srand( seed );
break;
Modified: branches/release/boost/test/impl/interaction_based.ipp
==============================================================================
--- branches/release/boost/test/impl/interaction_based.ipp (original)
+++ branches/release/boost/test/impl/interaction_based.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -66,8 +66,7 @@
if( reset ) {
if( new_ptr ) {
- if( ptr != &dummy )
- throw unit_test::framework::setup_error( BOOST_TEST_L( "Couldn't run two interation based test the same time" ) );
+ BOOST_TEST_SETUP_ASSERT( ptr == &dummy, BOOST_TEST_L( "Can't run two interation based test the same time" ) );
ptr = new_ptr;
}
Modified: branches/release/boost/test/impl/logged_expectations.ipp
==============================================================================
--- branches/release/boost/test/impl/logged_expectations.ipp (original)
+++ branches/release/boost/test/impl/logged_expectations.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -85,7 +85,7 @@
m_log_file.open( log_file_name.begin(), test_or_log ? std::ios::in : std::ios::out );
BOOST_REQUIRE_MESSAGE( m_log_file.is_open(),
- "Couldn't open expectations log file " << log_file_name
+ "Can't open expectations log file " << log_file_name
<< " for " << ( m_test_or_log ? "reading" : "writing") );
if( m_test_or_log ) {
Modified: branches/release/boost/test/impl/results_collector.ipp
==============================================================================
--- branches/release/boost/test/impl/results_collector.ipp (original)
+++ branches/release/boost/test/impl/results_collector.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -215,9 +215,9 @@
if( !num_failures_match )
BOOST_TEST_MESSAGE( "Test case " << tu.p_name << " has fewer failures than expected" );
- bool has_any_assertions = tr.p_aborted || (tr.p_assertions_failed != 0) || (tr.p_assertions_passed != 0);
- if( !has_any_assertions )
- BOOST_TEST_MESSAGE( "Test case " << tu.p_name << " doesn't include any assertions" );
+ bool run_any_assertions = tr.p_aborted || (tr.p_assertions_failed != 0) || (tr.p_assertions_passed != 0);
+ if( !run_any_assertions )
+ BOOST_TEST_MESSAGE( "Test case " << tu.p_name << " did not run any assertions" );
}
}
Modified: branches/release/boost/test/impl/results_reporter.ipp
==============================================================================
--- branches/release/boost/test/impl/results_reporter.ipp (original)
+++ branches/release/boost/test/impl/results_reporter.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -130,6 +130,8 @@
case XML:
set_format( new output::xml_report_formatter );
break;
+ default:
+ break;
}
}
Modified: branches/release/boost/test/impl/test_tools.ipp
==============================================================================
--- branches/release/boost/test/impl/test_tools.ipp (original)
+++ branches/release/boost/test/impl/test_tools.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -60,7 +60,7 @@
void
print_log_value<char>::operator()( std::ostream& ostr, char t )
{
- if( (std::isprint)( (unsigned char)t ) )
+ if( (std::isprint)( static_cast<unsigned char>(t) ) )
ostr << '\'' << t << '\'';
else
ostr << std::hex
@@ -69,7 +69,7 @@
#else
<< "0x"
#endif
- << (int)t;
+ << static_cast<int>(t);
}
//____________________________________________________________________________//
@@ -84,7 +84,7 @@
#else
<< "0x"
#endif
- << (int)t;
+ << static_cast<int>(t);
}
//____________________________________________________________________________//
@@ -227,18 +227,16 @@
unit_test_log << unit_test::log::begin( file_name, line_num ) << ll;
- unit_test_log << "difference between " << arg1_descr << "{" << *arg1_val << "}"
- << " and " << arg2_descr << "{" << *arg2_val << "}"
- << ( tl == PASS ? " doesn't exceed " : " exceeds " )
+ unit_test_log << "difference{" << pr.message() << (ct == CHECK_CLOSE ? "%" : "")
+ << "} between " << arg1_descr << "{" << *arg1_val
+ << "} and " << arg2_descr << "{" << *arg2_val
+ << ( tl == PASS ? "} doesn't exceed " : "} exceeds " )
<< *toler_val;
if( ct == CHECK_CLOSE )
unit_test_log << "%";
va_end( args );
- if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
-
unit_test_log << unit_test::log::end();
break;
}
@@ -451,7 +449,7 @@
m_pimpl->m_pattern.open( pattern_file_name.begin(), m );
BOOST_WARN_MESSAGE( m_pimpl->m_pattern.is_open(),
- "Couldn't open pattern file " << pattern_file_name
+ "Can't open pattern file " << pattern_file_name
<< " for " << (match_or_save ? "reading" : "writing") );
}
@@ -528,7 +526,7 @@
if( !m_pimpl->m_pattern.is_open() ) {
result = false;
- result.message() << "Pattern file could not be opened!";
+ result.message() << "Pattern file can't be opened!";
}
else {
if( m_pimpl->m_match_or_save ) {
Modified: branches/release/boost/test/impl/unit_test_main.ipp
==============================================================================
--- branches/release/boost/test/impl/unit_test_main.ipp (original)
+++ branches/release/boost/test/impl/unit_test_main.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -23,7 +23,8 @@
#include <boost/test/detail/unit_test_parameters.hpp>
-#if !defined(__BORLANDC__) && !BOOST_WORKAROUND( BOOST_MSVC, < 1300 )
+#if !defined(__BORLANDC__) && !BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) && !BOOST_WORKAROUND( __SUNPRO_CC, < 0x5100 )
+#define BOOST_TEST_SUPPORT_RUN_BY_NAME
#include <boost/test/utils/iterator/token_iterator.hpp>
#endif
@@ -100,13 +101,13 @@
const_string m_value;
};
// Constructor
-#if defined(__BORLANDC__) || BOOST_WORKAROUND( BOOST_MSVC, < 1300 )
+#ifndef BOOST_TEST_SUPPORT_RUN_BY_NAME
explicit test_case_filter( const_string ) : m_depth( 0 ) {}
#else
- explicit test_case_filter( const_string tc_to_tun )
+ explicit test_case_filter( const_string tc_to_run )
: m_depth( 0 )
{
- string_token_iterator tit( tc_to_tun, (dropped_delimeters = "/", kept_delimeters = dt_none) );
+ string_token_iterator tit( tc_to_run, (dropped_delimeters = "/", kept_delimeters = dt_none) );
while( tit != string_token_iterator() ) {
m_filters.push_back(
@@ -186,9 +187,12 @@
results_reporter::make_report();
return runtime_config::no_result_code()
- ? boost::exit_success
+ ? boost::exit_success
: results_collector.results( framework::master_test_suite().p_id ).result_code();
}
+ catch( framework::nothing_to_test const& ) {
+ return boost::exit_success;
+ }
catch( framework::internal_error const& ex ) {
results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl;
Modified: branches/release/boost/test/impl/unit_test_parameters.ipp
==============================================================================
--- branches/release/boost/test/impl/unit_test_parameters.ipp (original)
+++ branches/release/boost/test/impl/unit_test_parameters.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -25,6 +25,22 @@
#include <boost/test/utils/basic_cstring/io.hpp>
#include <boost/test/utils/fixed_mapping.hpp>
#include <boost/test/debug.hpp>
+#include <boost/test/framework.hpp>
+
+// Boost.Runtime.Param
+#include <boost/test/utils/runtime/cla/dual_name_parameter.hpp>
+#include <boost/test/utils/runtime/cla/parser.hpp>
+
+namespace rt = boost::runtime;
+namespace cla = rt::cla;
+
+
+#ifndef UNDER_CE
+#include <boost/test/utils/runtime/env/variable.hpp>
+
+namespace env = rt::env;
+#endif
+
// Boost
#include <boost/config.hpp>
@@ -35,6 +51,7 @@
// STL
#include <map>
#include <cstdlib>
+#include <iostream>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -48,130 +65,14 @@
namespace unit_test {
-namespace {
-
-// framework parameters and there corresponding command-line arguments
-literal_string LOG_LEVEL = "BOOST_TEST_LOG_LEVEL";
-literal_string NO_RESULT_CODE = "BOOST_TEST_RESULT_CODE";
-literal_string REPORT_LEVEL = "BOOST_TEST_REPORT_LEVEL";
-literal_string TESTS_TO_RUN = "BOOST_TESTS_TO_RUN";
-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 DETECT_FP_EXCEPT = "BOOST_TEST_DETECT_FP_EXCEPTIONS";
-literal_string REPORT_FORMAT = "BOOST_TEST_REPORT_FORMAT";
-literal_string LOG_FORMAT = "BOOST_TEST_LOG_FORMAT";
-literal_string OUTPUT_FORMAT = "BOOST_TEST_OUTPUT_FORMAT";
-literal_string DETECT_MEM_LEAK = "BOOST_TEST_DETECT_MEMORY_LEAK";
-literal_string RANDOM_SEED = "BOOST_TEST_RANDOM";
-literal_string BREAK_EXEC_PATH = "BOOST_TEST_BREAK_EXEC_PATH";
-
-unit_test::log_level s_log_level;
-bool s_no_result_code;
-unit_test::report_level s_report_level;
-const_string s_tests_to_run;
-const_string s_exec_path_to_break;
-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;
-bool s_detect_fp_except;
-output_format s_report_format;
-output_format s_log_format;
-long s_detect_mem_leaks;
-unsigned int s_random_seed;
-
// ************************************************************************** //
-// ************** runtime_config ************** //
+// ************** input operations for unit_test's enums ************** //
// ************************************************************************** //
-const_string
-retrieve_framework_parameter( const_string parameter_name, int* argc, char** argv )
+std::istream&
+operator>>( std::istream& in, unit_test::log_level& ll )
{
- static fixed_mapping<const_string,const_string> parameter_2_cla_name_map(
- LOG_LEVEL , "--log_level",
- NO_RESULT_CODE , "--result_code",
- REPORT_LEVEL , "--report_level",
- TESTS_TO_RUN , "--run_test",
- SAVE_TEST_PATTERN , "--save_pattern",
- 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",
- DETECT_FP_EXCEPT , "--detect_fp_exceptions",
- REPORT_FORMAT , "--report_format",
- LOG_FORMAT , "--log_format",
- OUTPUT_FORMAT , "--output_format",
- DETECT_MEM_LEAK , "--detect_memory_leaks",
- RANDOM_SEED , "--random",
- BREAK_EXEC_PATH , "--break_exec_path",
-
- ""
- );
-
- // first try to find parameter among command line arguments if present
- if( argc ) {
- // locate corresponding cla name
- const_string cla_name = parameter_2_cla_name_map[parameter_name];
-
- if( !cla_name.is_empty() ) {
- for( int i = 1; i < *argc; ++i ) {
- if( cla_name == const_string( argv[i], cla_name.size() ) && argv[i][cla_name.size()] == '=' ) {
- const_string result = argv[i] + cla_name.size() + 1;
-
- for( int j = i; j < *argc; ++j ) {
- argv[j] = argv[j+1];
- }
- --(*argc);
-
- return result;
- }
- }
- }
- }
-
- return std::getenv( parameter_name.begin() );
-}
-
-long interpret_long( const_string from )
-{
- bool negative = false;
- long res = 0;
-
- if( first_char( from ) == '-' ) {
- negative = true;
- from.trim_left( 1 );
- }
-
- const_string::iterator it = from.begin();
- for( ;it != from.end(); ++it ) {
- int d = *it - '0';
-
- res = 10 * res + d;
- }
-
- if( negative )
- res = -res;
-
- return res;
-}
-
-} // local namespace
-
-//____________________________________________________________________________//
-
-namespace runtime_config {
-
-void
-init( int* argc, char** argv )
-{
- fixed_mapping<const_string,unit_test::log_level,case_ins_less<char const> > log_level_name(
+ static 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,
@@ -185,8 +86,22 @@
"nothing" , log_nothing,
invalid_log_level
- );
+ );
+
+ std::string val;
+ in >> val;
+
+ ll = log_level_name[val];
+ BOOST_TEST_SETUP_ASSERT( ll != unit_test::invalid_log_level, "invalid log level " + val );
+
+ return in;
+}
+//____________________________________________________________________________//
+
+std::istream&
+operator>>( std::istream& in, unit_test::report_level& rl )
+{
fixed_mapping<const_string,unit_test::report_level,case_ins_less<char const> > report_level_name (
"confirm", CONFIRMATION_REPORT,
"short", SHORT_REPORT,
@@ -194,57 +109,221 @@
"no", NO_REPORT,
INV_REPORT_LEVEL
- );
+ );
- fixed_mapping<const_string,output_format,case_ins_less<char const> > output_format_name (
- "HRF", CLF,
- "CLF", CLF,
- "XML", XML,
-
- CLF
- );
-
- s_no_result_code = retrieve_framework_parameter( NO_RESULT_CODE, argc, argv ) == "no";
- s_save_pattern = retrieve_framework_parameter( SAVE_TEST_PATTERN, argc, argv ) == "yes";
- s_show_build_info = retrieve_framework_parameter( BUILD_INFO, argc, argv ) == "yes";
- s_show_progress = retrieve_framework_parameter( SHOW_PROGRESS, argc, argv ) == "yes";
-#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP
- s_catch_sys_errors = retrieve_framework_parameter( CATCH_SYS_ERRORS, argc, argv ) == "yes";
-#else
- s_catch_sys_errors = retrieve_framework_parameter( CATCH_SYS_ERRORS, argc, argv ) != "no";
-#endif
- s_use_alt_stack = retrieve_framework_parameter( USE_ALT_STACK, argc, argv ) != "no";
- s_detect_fp_except = retrieve_framework_parameter( DETECT_FP_EXCEPT, argc, argv ) == "yes";
- 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 );
-
- const_string rs_str = retrieve_framework_parameter( RANDOM_SEED, argc, argv );
- s_random_seed = rs_str.is_empty() ? 0 : lexical_cast<unsigned int>( rs_str );
-
- s_log_level = log_level_name[retrieve_framework_parameter( LOG_LEVEL, argc, argv )];
- s_report_level = report_level_name[retrieve_framework_parameter( REPORT_LEVEL, argc, argv )];
-
- s_report_format = output_format_name[retrieve_framework_parameter( REPORT_FORMAT, argc, argv )];
- s_log_format = output_format_name[retrieve_framework_parameter( LOG_FORMAT, argc, argv )];
-
- const_string output_format = retrieve_framework_parameter( OUTPUT_FORMAT, argc, argv );
- if( !output_format.is_empty() ) {
- s_report_format = output_format_name[output_format];
- s_log_format = output_format_name[output_format];
+ std::string val;
+ in >> val;
+
+ rl = report_level_name[val];
+ BOOST_TEST_SETUP_ASSERT( rl != INV_REPORT_LEVEL, "invalid report level " + val );
+
+ return in;
+}
+
+//____________________________________________________________________________//
+
+std::istream&
+operator>>( std::istream& in, unit_test::output_format& of )
+{
+ fixed_mapping<const_string,unit_test::output_format,case_ins_less<char const> > output_format_name (
+ "HRF", unit_test::CLF,
+ "CLF", unit_test::CLF,
+ "XML", unit_test::XML,
+
+ unit_test::INV_OF
+ );
+
+ std::string val;
+ in >> val;
+
+ of = output_format_name[val];
+ BOOST_TEST_SETUP_ASSERT( of != unit_test::INV_OF, "invalid output format " + val );
+
+ return in;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** runtime_config ************** //
+// ************************************************************************** //
+
+namespace runtime_config {
+
+namespace {
+
+// framework parameters and corresponding command-line arguments
+std::string AUTO_START_DBG = "auto_start_dbg";
+std::string BREAK_EXEC_PATH = "break_exec_path";
+std::string BUILD_INFO = "build_info";
+std::string CATCH_SYS_ERRORS = "catch_system_errors";
+std::string DETECT_FP_EXCEPT = "detect_fp_exceptions";
+std::string DETECT_MEM_LEAKS = "detect_memory_leaks";
+std::string LOG_FORMAT = "log_format";
+std::string LOG_LEVEL = "log_level";
+std::string OUTPUT_FORMAT = "output_format";
+std::string RANDOM_SEED = "random";
+std::string REPORT_FORMAT = "report_format";
+std::string REPORT_LEVEL = "report_level";
+std::string RESULT_CODE = "result_code";
+std::string TESTS_TO_RUN = "run_test";
+std::string SAVE_TEST_PATTERN = "save_pattern";
+std::string SHOW_PROGRESS = "show_progress";
+std::string USE_ALT_STACK = "use_alt_stack";
+
+fixed_mapping<const_string,const_string> parameter_2_env_var(
+ AUTO_START_DBG , "BOOST_TEST_AUTO_START_DBG",
+ BREAK_EXEC_PATH , "BOOST_TEST_BREAK_EXEC_PATH",
+ BUILD_INFO , "BOOST_TEST_BUILD_INFO",
+ CATCH_SYS_ERRORS , "BOOST_TEST_CATCH_SYSTEM_ERRORS",
+ DETECT_FP_EXCEPT , "BOOST_TEST_DETECT_FP_EXCEPTIONS",
+ DETECT_MEM_LEAKS , "BOOST_TEST_DETECT_MEMORY_LEAK",
+ LOG_FORMAT , "BOOST_TEST_LOG_FORMAT",
+ LOG_LEVEL , "BOOST_TEST_LOG_LEVEL",
+ OUTPUT_FORMAT , "BOOST_TEST_OUTPUT_FORMAT",
+ RANDOM_SEED , "BOOST_TEST_RANDOM",
+ REPORT_FORMAT , "BOOST_TEST_REPORT_FORMAT",
+ REPORT_LEVEL , "BOOST_TEST_REPORT_LEVEL",
+ RESULT_CODE , "BOOST_TEST_RESULT_CODE",
+ TESTS_TO_RUN , "BOOST_TESTS_TO_RUN",
+ SAVE_TEST_PATTERN , "BOOST_TEST_SAVE_PATTERN",
+ SHOW_PROGRESS , "BOOST_TEST_SHOW_PROGRESS",
+ USE_ALT_STACK , "BOOST_TEST_USE_ALT_STACK",
+
+ ""
+);
+
+//____________________________________________________________________________//
+
+// storage for the CLAs
+cla::parser s_cla_parser;
+std::string s_empty;
+
+output_format s_report_format;
+output_format s_log_format;
+
+//____________________________________________________________________________//
+
+template<typename T>
+T
+retrieve_parameter( const_string parameter_name, cla::parser const& s_cla_parser, T const& default_value = T(), T const& optional_value = T() )
+{
+ rt::const_argument_ptr arg = s_cla_parser[parameter_name];
+ if( arg ) {
+ if( rtti::type_id<T>() == rtti::type_id<bool>() ||
+ !static_cast<cla::parameter const&>( arg->p_formal_parameter.get() ).p_optional_value )
+ return s_cla_parser.get<T>( parameter_name );
+
+ optional<T> val = s_cla_parser.get<optional<T> >( parameter_name );
+ if( val )
+ return *val;
+ else
+ return optional_value;
}
- 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 );
+ boost::optional<T> v;
+
+#ifndef UNDER_CE
+ env::get( parameter_2_env_var[parameter_name], v );
+#endif
+
+ if( v )
+ return *v;
+ else
+ return default_value;
+}
+
+//____________________________________________________________________________//
+
+} // local namespace
+
+void
+init( int& argc, char** argv )
+{
+ using namespace cla;
+
+ try {
+ s_cla_parser - cla::ignore_mismatch
+ << cla::dual_name_parameter<bool>( AUTO_START_DBG + "|d" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Automatically starts debugger if system level error (signal) occurs")
+ << cla::named_parameter<std::string>( BREAK_EXEC_PATH )
+ - (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,
+ cla::description = "For the exception safety testing allows to break at specific execution path")
+ << cla::dual_name_parameter<bool>( BUILD_INFO + "|i" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Shows library build information" )
+ << cla::dual_name_parameter<bool>( CATCH_SYS_ERRORS + "|s" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Allows to switch between catching and ignoring system errors (signals)")
+ << cla::named_parameter<bool>( DETECT_FP_EXCEPT )
+ - (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,
+ cla::description = "Allows to switch between catching and ignoring floating point exceptions")
+ << cla::named_parameter<long>( DETECT_MEM_LEAKS )
+ - (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,
+ cla::description = "Allows to switch between catching and ignoring memory leaks")
+ << cla::dual_name_parameter<unit_test::output_format>( LOG_FORMAT + "|f" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Specifies log format")
+ << cla::dual_name_parameter<unit_test::log_level>( LOG_LEVEL + "|l" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Specifies log level")
+ << cla::dual_name_parameter<unit_test::output_format>( OUTPUT_FORMAT + "|o" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Specifies output format (both log and report)")
+ << cla::dual_name_parameter<int>( RANDOM_SEED + "|a" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,cla::optional_value,
+ cla::description = "Allows to switch between sequential and random order of test units execution.\n"
+ "Optionally allows to specify concrete seed for random number generator")
+ << cla::dual_name_parameter<unit_test::output_format>( REPORT_FORMAT + "|m" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Specifies report format")
+ << cla::dual_name_parameter<unit_test::report_level>(REPORT_LEVEL + "|r")
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Specifies report level")
+ << cla::dual_name_parameter<bool>( RESULT_CODE + "|c" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Allows to disable test modules's result code generation")
+ << cla::dual_name_parameter<std::string>( TESTS_TO_RUN + "|t" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Allows to filter which test units to run")
+ << cla::named_parameter<bool>( SAVE_TEST_PATTERN )
+ - (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,
+ cla::description = "Allows to switch between saving and matching against test pattern file")
+ << cla::dual_name_parameter<bool>( SHOW_PROGRESS + "|p" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Turns on progress display")
+ << cla::named_parameter<bool>( USE_ALT_STACK )
+ - (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,
+ cla::description = "Turns on/off usage of an alternative stack for signal handling")
+
+ << cla::dual_name_parameter<bool>( "help|?" )
+ - (cla::prefix = "--|-",cla::separator = "=",cla::guess_name,cla::optional,
+ cla::description = "this help message")
+ ;
+
+ s_cla_parser.parse( argc, argv );
+
+ if( s_cla_parser["help"] ) {
+ s_cla_parser.help( std::cout );
+ throw framework::nothing_to_test();
+ }
+
+ s_report_format = retrieve_parameter( REPORT_FORMAT, s_cla_parser, unit_test::CLF );
+ s_log_format = retrieve_parameter( LOG_FORMAT, s_cla_parser, unit_test::CLF );
- const_string dbg = retrieve_framework_parameter( AUTO_START_DBG, argc, argv );
+ unit_test::output_format of = retrieve_parameter( OUTPUT_FORMAT, s_cla_parser, unit_test::INV_OF );
- if( dbg.is_empty() || dbg == "no" )
- s_auto_start_dbg = false;
- else {
- s_auto_start_dbg = true;
+ if( of != unit_test::INV_OF )
+ s_report_format = s_log_format = of;
+ }
+ catch( rt::logic_error const& ex ) {
+ std::ostringstream err;
+
+ err << "Fail to process runtime parameters: " << ex.msg() << std::endl;
+ s_cla_parser.usage( err );
- if( dbg != "yes" )
- debug::set_debugger( dbg );
+ throw framework::setup_error( err.str() );
}
}
@@ -253,7 +332,7 @@
unit_test::log_level
log_level()
{
- return s_log_level;
+ return retrieve_parameter( LOG_LEVEL, s_cla_parser, unit_test::log_all_errors );
}
//____________________________________________________________________________//
@@ -261,7 +340,7 @@
bool
no_result_code()
{
- return s_no_result_code;
+ return !retrieve_parameter( RESULT_CODE, s_cla_parser, true );
}
//____________________________________________________________________________//
@@ -269,7 +348,7 @@
unit_test::report_level
report_level()
{
- return s_report_level;
+ return retrieve_parameter( REPORT_LEVEL, s_cla_parser, unit_test::CONFIRMATION_REPORT );
}
//____________________________________________________________________________//
@@ -277,7 +356,9 @@
const_string
test_to_run()
{
- return s_tests_to_run;
+ static std::string s_test_to_run = retrieve_parameter( TESTS_TO_RUN, s_cla_parser, s_empty );
+
+ return s_test_to_run;
}
//____________________________________________________________________________//
@@ -285,7 +366,9 @@
const_string
break_exec_path()
{
- return s_exec_path_to_break;
+ static std::string s_break_exec_path = retrieve_parameter( BREAK_EXEC_PATH, s_cla_parser, s_empty );
+
+ return s_break_exec_path;
}
//____________________________________________________________________________//
@@ -293,7 +376,7 @@
bool
save_pattern()
{
- return s_save_pattern;
+ return retrieve_parameter( SAVE_TEST_PATTERN, s_cla_parser, false );
}
//____________________________________________________________________________//
@@ -301,7 +384,7 @@
bool
show_progress()
{
- return s_show_progress;
+ return retrieve_parameter( SHOW_PROGRESS, s_cla_parser, false );
}
//____________________________________________________________________________//
@@ -309,7 +392,7 @@
bool
show_build_info()
{
- return s_show_build_info;
+ return retrieve_parameter( BUILD_INFO, s_cla_parser, false );
}
//____________________________________________________________________________//
@@ -317,7 +400,13 @@
bool
catch_sys_errors()
{
- return s_catch_sys_errors;
+ return retrieve_parameter( CATCH_SYS_ERRORS, s_cla_parser,
+#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP
+ false
+#else
+ true
+#endif
+ );
}
//____________________________________________________________________________//
@@ -325,7 +414,9 @@
bool
auto_start_dbg()
{
- return s_auto_start_dbg;
+ // !! set debugger as an option
+ return retrieve_parameter( AUTO_START_DBG, s_cla_parser, false );
+;
}
//____________________________________________________________________________//
@@ -333,7 +424,7 @@
bool
use_alt_stack()
{
- return s_use_alt_stack;
+ return retrieve_parameter( USE_ALT_STACK, s_cla_parser, true );
}
//____________________________________________________________________________//
@@ -341,7 +432,7 @@
bool
detect_fp_exceptions()
{
- return s_detect_fp_except;
+ return retrieve_parameter( DETECT_FP_EXCEPT, s_cla_parser, false );
}
//____________________________________________________________________________//
@@ -365,7 +456,7 @@
long
detect_memory_leaks()
{
- return s_detect_mem_leaks;
+ return retrieve_parameter( DETECT_MEM_LEAKS, s_cla_parser, static_cast<long>(1) );
}
//____________________________________________________________________________//
@@ -373,7 +464,7 @@
int
random_seed()
{
- return s_random_seed;
+ return retrieve_parameter( RANDOM_SEED, s_cla_parser, 0, 1 );
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/impl/unit_test_suite.ipp
==============================================================================
--- branches/release/boost/test/impl/unit_test_suite.ipp (original)
+++ branches/release/boost/test/impl/unit_test_suite.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -9,8 +9,8 @@
//
// Version : $Revision$
//
-// Description : privide core implementation for Unit Test Framework.
-// Extensions could be provided in separate files
+// Description : privides core implementation for Unit Test Framework.
+// Extensions can be provided in separate files
// ***************************************************************************
#ifndef BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
@@ -104,7 +104,7 @@
// ************************************************************************** //
test_case::test_case( const_string name, callback0<> const& test_func )
-: test_unit( name, (test_unit_type)type )
+: test_unit( name, static_cast<test_unit_type>(type) )
, m_test_func( test_func )
{
// !! weirdest MSVC BUG; try to remove this statement; looks like it eats first token of next statement
@@ -123,7 +123,7 @@
//____________________________________________________________________________//
test_suite::test_suite( const_string name )
-: test_unit( name, (test_unit_type)type )
+: test_unit( name, static_cast<test_unit_type>(type) )
{
framework::register_test_unit( this );
}
@@ -161,7 +161,7 @@
void
test_suite::remove( test_unit_id id )
{
- std::vector<test_unit_id>::iterator it = std::find( m_members.begin(), m_members.begin(), id );
+ std::vector<test_unit_id>::iterator it = std::find( m_members.begin(), m_members.end(), id );
if( it != m_members.end() )
m_members.erase( it );
@@ -173,7 +173,7 @@
test_suite::get( const_string tu_name ) const
{
BOOST_TEST_FOREACH( test_unit_id, id, m_members ) {
- if( tu_name == framework::get( id, test_id_2_unit_type( id ) ).p_name.get() )
+ if( tu_name == framework::get( id, ut_detail::test_id_2_unit_type( id ) ).p_name.get() )
return id;
}
@@ -228,7 +228,7 @@
void
traverse_test_tree( test_unit_id id, test_tree_visitor& V )
{
- if( test_id_2_unit_type( id ) == tut_case )
+ if( ut_detail::test_id_2_unit_type( id ) == tut_case )
traverse_test_tree( framework::get<test_case>( id ), V );
else
traverse_test_tree( framework::get<test_suite>( id ), V );
Modified: branches/release/boost/test/mock_object.hpp
==============================================================================
--- branches/release/boost/test/mock_object.hpp (original)
+++ branches/release/boost/test/mock_object.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -146,7 +146,7 @@
public:
static mock_object& prototype()
{
- static mock_object p( (dummy*)0 );
+ static mock_object p( reinterpret_cast<dummy*>(0) );
return p;
}
Modified: branches/release/boost/test/parameterized_test.hpp
==============================================================================
--- branches/release/boost/test/parameterized_test.hpp (original)
+++ branches/release/boost/test/parameterized_test.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -82,7 +82,7 @@
, m_par_end( par_end )
{}
- test_unit* next() const
+ virtual test_unit* next() const
{
if( m_par_begin == m_par_end )
return (test_unit*)0;
Modified: branches/release/boost/test/predicate_result.hpp
==============================================================================
--- branches/release/boost/test/predicate_result.hpp (original)
+++ branches/release/boost/test/predicate_result.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -41,6 +41,9 @@
class BOOST_TEST_DECL predicate_result {
typedef unit_test::const_string const_string;
+ struct dummy { void nonnull() {}; };
+ typedef void (dummy::*safe_bool)();
+
public:
// Constructor
predicate_result( bool pv_ )
@@ -50,8 +53,10 @@
template<typename BoolConvertable>
predicate_result( BoolConvertable const& pv_ ) : p_predicate_value( !!pv_ ) {}
+ // Access methods
bool operator!() const { return !p_predicate_value; }
void operator=( bool pv_ ) { p_predicate_value.value = pv_; }
+ operator safe_bool() const { return !!p_predicate_value ? &dummy::nonnull : 0; }
// Public properties
BOOST_READONLY_PROPERTY( bool, (predicate_result) ) p_predicate_value;
Modified: branches/release/boost/test/test_case_template.hpp
==============================================================================
--- branches/release/boost/test/test_case_template.hpp (original)
+++ branches/release/boost/test/test_case_template.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -9,143 +9,7 @@
//
// Version : $Revision$
//
-// Description : implements support for test cases templates instantiated with
-// sequence of test types
+// Description : deprecated
// ***************************************************************************
-#ifndef BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
-#define BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
-
-// Boost
-#include <boost/mpl/for_each.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/type.hpp>
-#include <boost/type_traits/is_const.hpp>
-
-// STL
-#include <typeinfo>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \
- boost::unit_test::ut_detail::template_test_case_gen<name,typelist >( \
- BOOST_TEST_STRINGIZE( name ) ) \
-/**/
-
-//____________________________________________________________________________//
-
-#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \
-template<typename type_name> \
-void BOOST_JOIN( name, _impl )( boost::type<type_name>* ); \
- \
-struct name { \
- template<typename TestType> \
- static void run( boost::type<TestType>* frwrd = 0 ) \
- { \
- BOOST_JOIN( name, _impl )( frwrd ); \
- } \
-}; \
- \
-template<typename type_name> \
-void BOOST_JOIN( name, _impl )( boost::type<type_name>* ) \
-/**/
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace unit_test {
-
-namespace ut_detail {
-
-// ************************************************************************** //
-// ************** test_case_template_invoker ************** //
-// ************************************************************************** //
-
-template<typename TestCaseTemplate,typename TestType>
-class test_case_template_invoker {
-public:
- void operator()() { TestCaseTemplate::run( (boost::type<TestType>*)0 ); }
-};
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** generate_test_case_4_type ************** //
-// ************************************************************************** //
-
-template<typename Generator,typename TestCaseTemplate>
-struct generate_test_case_4_type {
- explicit generate_test_case_4_type( const_string tc_name, Generator& G )
- : m_test_case_name( tc_name )
- , m_holder( G )
- {}
-
- template<typename TestType>
- void operator()( mpl::identity<TestType> )
- {
- std::string full_name;
- assign_op( full_name, m_test_case_name, 0 );
- full_name += '<';
- full_name += typeid(TestType).name();
- if( boost::is_const<TestType>::value )
- full_name += " const";
- full_name += '>';
-
- m_holder.m_test_cases.push_back(
- new test_case( full_name, test_case_template_invoker<TestCaseTemplate,TestType>() ) );
- }
-
-private:
- // Data members
- const_string m_test_case_name;
- Generator& m_holder;
-};
-
-// ************************************************************************** //
-// ************** test_case_template ************** //
-// ************************************************************************** //
-
-template<typename TestCaseTemplate,typename TestTypesList>
-class template_test_case_gen : public test_unit_generator {
-public:
- // Constructor
- template_test_case_gen( const_string tc_name )
- {
- typedef generate_test_case_4_type<template_test_case_gen<TestCaseTemplate,TestTypesList>,
- TestCaseTemplate
- > single_test_gen;
- mpl::for_each<TestTypesList,mpl::make_identity<mpl::_> >( single_test_gen( tc_name, *this ) );
- }
-
- test_unit* next() const
- {
- if( m_test_cases.empty() )
- return 0;
-
- test_unit* res = m_test_cases.front();
- m_test_cases.pop_front();
-
- return res;
- }
-
- // Data members
- mutable std::list<test_unit*> m_test_cases;
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-} // unit_test
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
-
+#include <boost/test/unit_test.hpp>
Modified: branches/release/boost/test/test_tools.hpp
==============================================================================
--- branches/release/boost/test/test_tools.hpp (original)
+++ branches/release/boost/test/test_tools.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -78,7 +78,7 @@
P, \
::boost::unit_test::lazy_ostream::instance() << check_descr, \
BOOST_TEST_L(__FILE__), \
- (std::size_t)__LINE__, \
+ static_cast<std::size_t>(__LINE__), \
::boost::test_tools::tt_detail::TL, \
::boost::test_tools::tt_detail::CT \
/**/
@@ -306,7 +306,7 @@
typedef unit_test::const_string const_string;
-namespace { bool const dummy_cond = false; }
+namespace { bool dummy_cond = false; }
// ************************************************************************** //
// ************** print_log_value ************** //
@@ -319,9 +319,9 @@
// avoid warning: 'boost::test_tools::<unnamed>::dummy_cond' defined but not used
if (::boost::test_tools::dummy_cond) {}
- typedef typename mpl::or_<is_array<T>,is_function<T>,is_abstract<T> >::type couldnt_use_nl;
+ typedef typename mpl::or_<is_array<T>,is_function<T>,is_abstract<T> >::type cant_use_nl;
- set_precision( ostr, couldnt_use_nl() );
+ set_precision( ostr, cant_use_nl() );
ostr << t; // by default print the value
}
@@ -485,15 +485,15 @@
#define TEMPL_PARAMS( z, m, dummy ) , typename BOOST_JOIN( Arg, m )
#define FUNC_PARAMS( z, m, dummy ) \
- , BOOST_JOIN( Arg, m ) const& BOOST_JOIN( arg, m ) \
- , char const* BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
+ , BOOST_JOIN( Arg, m ) const& BOOST_JOIN( arg, m ) \
+ , char const* BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
/**/
#define PRED_PARAMS( z, m, dummy ) BOOST_PP_COMMA_IF( m ) BOOST_JOIN( arg, m )
#define ARG_INFO( z, m, dummy ) \
- , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
- , &(const unit_test::lazy_ostream&)(unit_test::lazy_ostream::instance() \
+ , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \
+ , &static_cast<const unit_test::lazy_ostream&>(unit_test::lazy_ostream::instance() \
<< ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \
/**/
@@ -539,15 +539,15 @@
//____________________________________________________________________________//
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 equal_impl( char* left, char const* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
+inline predicate_result equal_impl( char const* left, char* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
+inline predicate_result equal_impl( char* left, char* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
#if !defined( BOOST_NO_CWCHAR )
predicate_result BOOST_TEST_DECL 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 ); }
+inline predicate_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); }
+inline predicate_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); }
+inline predicate_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); }
#endif
//____________________________________________________________________________//
Modified: branches/release/boost/test/unit_test_log.hpp
==============================================================================
--- branches/release/boost/test/unit_test_log.hpp (original)
+++ branches/release/boost/test/unit_test_log.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -157,7 +157,7 @@
#define BOOST_TEST_PASSPOINT() \
::boost::unit_test::unit_test_log.set_checkpoint( \
BOOST_TEST_L(__FILE__), \
- (std::size_t)__LINE__ ) \
+ static_cast<std::size_t>(__LINE__) ) \
/**/
//____________________________________________________________________________//
@@ -165,7 +165,7 @@
#define BOOST_TEST_CHECKPOINT( M ) \
::boost::unit_test::unit_test_log.set_checkpoint( \
BOOST_TEST_L(__FILE__), \
- (std::size_t)__LINE__, \
+ static_cast<std::size_t>(__LINE__), \
(::boost::wrap_stringstream().ref() << M).str() ) \
/**/
Modified: branches/release/boost/test/unit_test_suite.hpp
==============================================================================
--- branches/release/boost/test/unit_test_suite.hpp (original)
+++ branches/release/boost/test/unit_test_suite.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -17,7 +17,6 @@
// Boost.Test
#include <boost/test/unit_test_suite_impl.hpp>
-#include <boost/test/test_case_template.hpp>
#include <boost/test/framework.hpp>
//____________________________________________________________________________//
@@ -144,6 +143,35 @@
/**/
// ************************************************************************** //
+// ************** BOOST_TEST_CASE_TEMPLATE ************** //
+// ************************************************************************** //
+
+#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \
+ boost::unit_test::ut_detail::template_test_case_gen<name,typelist >( \
+ BOOST_TEST_STRINGIZE( name ) ) \
+/**/
+
+// ************************************************************************** //
+// ************** BOOST_TEST_CASE_TEMPLATE_FUNCTION ************** //
+// ************************************************************************** //
+
+#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \
+template<typename type_name> \
+void BOOST_JOIN( name, _impl )( boost::type<type_name>* ); \
+ \
+struct name { \
+ template<typename TestType> \
+ static void run( boost::type<TestType>* frwrd = 0 ) \
+ { \
+ BOOST_JOIN( name, _impl )( frwrd ); \
+ } \
+}; \
+ \
+template<typename type_name> \
+void BOOST_JOIN( name, _impl )( boost::type<type_name>* ) \
+/**/
+
+// ************************************************************************** //
// ************** BOOST_GLOBAL_FIXURE ************** //
// ************************************************************************** //
@@ -163,7 +191,7 @@
} // unit_test
} // namespace boost
-// Intentionally is in global namespace, so that FIXURE_TEST_SUITE could reset it in user code.
+// Intentionally is in global namespace, so that FIXURE_TEST_SUITE can reset it in user code.
typedef ::boost::unit_test::ut_detail::nil_t BOOST_AUTO_TEST_CASE_FIXTURE;
// ************************************************************************** //
Modified: branches/release/boost/test/unit_test_suite_impl.hpp
==============================================================================
--- branches/release/boost/test/unit_test_suite_impl.hpp (original)
+++ branches/release/boost/test/unit_test_suite_impl.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -26,8 +26,13 @@
// Boost
#include <boost/shared_ptr.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/type.hpp>
+#include <boost/type_traits/is_const.hpp>
// STL
+#include <typeinfo> // for typeid
#include <string> // for std::string
#include <list> // for std::list
#include <vector> // for std::vector
@@ -342,6 +347,81 @@
F* m_fixure;
};
+// ************************************************************************** //
+// ************** test_case_template_invoker ************** //
+// ************************************************************************** //
+
+template<typename TestCaseTemplate,typename TestType>
+class test_case_template_invoker {
+public:
+ void operator()() { TestCaseTemplate::run( (boost::type<TestType>*)0 ); }
+};
+
+// ************************************************************************** //
+// ************** generate_test_case_4_type ************** //
+// ************************************************************************** //
+
+template<typename Generator,typename TestCaseTemplate>
+struct generate_test_case_4_type {
+ explicit generate_test_case_4_type( const_string tc_name, Generator& G )
+ : m_test_case_name( tc_name )
+ , m_holder( G )
+ {}
+
+ template<typename TestType>
+ void operator()( mpl::identity<TestType> )
+ {
+ std::string full_name;
+ assign_op( full_name, m_test_case_name, 0 );
+ full_name += '<';
+ full_name += typeid(TestType).name();
+ if( boost::is_const<TestType>::value )
+ full_name += " const";
+ full_name += '>';
+
+ m_holder.m_test_cases.push_back(
+ new test_case( full_name, test_case_template_invoker<TestCaseTemplate,TestType>() ) );
+ }
+
+private:
+ // Data members
+ const_string m_test_case_name;
+ Generator& m_holder;
+};
+
+// ************************************************************************** //
+// ************** test_case_template ************** //
+// ************************************************************************** //
+
+template<typename TestCaseTemplate,typename TestTypesList>
+class template_test_case_gen : public test_unit_generator {
+public:
+ // Constructor
+ template_test_case_gen( const_string tc_name )
+ {
+ typedef generate_test_case_4_type<template_test_case_gen<TestCaseTemplate,TestTypesList>,
+ TestCaseTemplate
+ > single_test_gen;
+ mpl::for_each<TestTypesList,mpl::make_identity<mpl::_> >( single_test_gen( tc_name, *this ) );
+ }
+
+ virtual test_unit* next() const
+ {
+ if( m_test_cases.empty() )
+ return 0;
+
+ test_unit* res = m_test_cases.front();
+ m_test_cases.pop_front();
+
+ return res;
+ }
+
+ // Data members
+ mutable std::list<test_unit*> m_test_cases;
+};
+
+//____________________________________________________________________________//
+
} // namespace ut_detail
} // unit_test
Modified: branches/release/boost/test/utils/basic_cstring/basic_cstring.hpp
==============================================================================
--- branches/release/boost/test/utils/basic_cstring/basic_cstring.hpp (original)
+++ branches/release/boost/test/utils/basic_cstring/basic_cstring.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -57,7 +57,7 @@
// !! should also present reverse_iterator, const_reverse_iterator
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
- enum npos_type { npos = (size_type)-1 };
+ enum npos_type { npos = static_cast<size_type>(-1) };
#else
// IBM/VisualAge version 6 is not able to handle enums larger than 4 bytes.
// But size_type is 8 bytes in 64bit mode.
@@ -218,7 +218,7 @@
basic_cstring<CharT>::at( size_type index ) const
{
if( m_begin + index >= m_end )
- return (value_type)0;
+ return static_cast<value_type>(0);
return m_begin[index];
}
@@ -306,7 +306,7 @@
iterator it;
for( it = begin(); it != end(); ++it ) {
- if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == (pointer)0 )
+ if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
@@ -351,7 +351,7 @@
iterator it;
for( it = end()-1; it != begin()-1; --it ) {
- if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == (pointer)0 )
+ if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
@@ -514,7 +514,7 @@
basic_cstring<CharT>::find( basic_cstring<CharT> str ) const
{
if( str.is_empty() || str.size() > size() )
- return (size_type)npos;
+ return static_cast<size_type>(npos);
const_iterator it = begin();
const_iterator last = end() - str.size() + 1;
@@ -526,7 +526,7 @@
++it;
}
- return it == last ? (size_type)npos : it - begin();
+ return it == last ? static_cast<size_type>(npos) : it - begin();
}
//____________________________________________________________________________//
@@ -536,7 +536,7 @@
basic_cstring<CharT>::rfind( basic_cstring<CharT> str ) const
{
if( str.is_empty() || str.size() > size() )
- return (size_type)npos;
+ return static_cast<size_type>(npos);
const_iterator it = end() - str.size();
const_iterator last = begin()-1;
@@ -687,7 +687,7 @@
{
typedef typename basic_cstring<CharT>::value_type string_value_type;
- return source.is_empty() ? (string_value_type)0 : *source.begin();
+ return source.is_empty() ? static_cast<string_value_type>(0) : *source.begin();
}
//____________________________________________________________________________//
@@ -702,7 +702,7 @@
{
typedef typename basic_cstring<CharT>::value_type string_value_type;
- return source.is_empty() ? (string_value_type)0 : *(source.end()-1);
+ return source.is_empty() ? static_cast<string_value_type>(0) : *(source.end()-1);
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/utils/class_properties.hpp
==============================================================================
--- branches/release/boost/test/utils/class_properties.hpp (original)
+++ branches/release/boost/test/utils/class_properties.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -48,11 +48,7 @@
protected:
typedef typename call_traits<PropertyType>::const_reference read_access_t;
typedef typename call_traits<PropertyType>::param_type write_param_t;
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
- typedef typename add_pointer<PropertyType const>::type address_res_t;
-#else
typedef typename add_pointer<typename add_const<PropertyType>::type>::type address_res_t;
-#endif
public:
// Constructor
class_property() : value( PropertyType() ) {}
Modified: branches/release/boost/test/utils/fixed_mapping.hpp
==============================================================================
--- branches/release/boost/test/utils/fixed_mapping.hpp (original)
+++ branches/release/boost/test/utils/fixed_mapping.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -36,7 +36,7 @@
namespace unit_test {
// configurable maximum fixed sized mapping size supported by this header.
-// You could redefine it before inclusion of this file.
+// You can redefine it before inclusion of this file.
#ifndef MAX_MAP_SIZE
#define MAX_MAP_SIZE 20
#endif
Modified: branches/release/boost/test/utils/foreach.hpp
==============================================================================
--- branches/release/boost/test/utils/foreach.hpp (original)
+++ branches/release/boost/test/utils/foreach.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -11,7 +11,7 @@
// Version : $Revision$
//
// Description : this is an abridged version of an excelent BOOST_FOREACH facility
-// presented by Eric Niebler. I am so fond of it so I couldn't wait till it
+// presented by Eric Niebler. I am so fond of it so I can't wait till it
// going to be accepted into Boost. Also I need version with less number of dependencies
// and more portable. This version doesn't support rvalues and will reeveluate it's
// parameters, but should be good enough for my purposes.
Modified: branches/release/boost/test/utils/iterator/token_iterator.hpp
==============================================================================
--- branches/release/boost/test/utils/iterator/token_iterator.hpp (original)
+++ branches/release/boost/test/utils/iterator/token_iterator.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -192,7 +192,7 @@
: m_is_dropped( dt_isspace )
, m_is_kept( dt_ispunct )
, m_keep_empty_tokens( false )
- , m_tokens_left( (std::size_t)-1 )
+ , m_tokens_left( static_cast<std::size_t>(-1) )
, m_token_produced( false )
{
}
Modified: branches/release/boost/test/utils/named_params.hpp
==============================================================================
--- branches/release/boost/test/utils/named_params.hpp (original)
+++ branches/release/boost/test/utils/named_params.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -23,6 +23,8 @@
#include <boost/test/utils/rtti.hpp>
#include <boost/test/utils/assign_op.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
@@ -64,9 +66,17 @@
struct nil {
template<typename T>
+#if defined(__GNUC__) || defined(__HP_aCC) || defined(__EDG__) || defined(__SUNPRO_CC)
operator T() const
+#else
+ operator T const&() const
+#endif
{ report_access_to_invalid_parameter(); static T* v = 0; return *v; }
+ template<typename T>
+ T any_cast() const
+ { report_access_to_invalid_parameter(); static typename remove_reference<T>::type* v = 0; return *v; }
+
template<typename Arg1>
nil operator()( Arg1 const& )
{ report_access_to_invalid_parameter(); return nil(); }
@@ -82,6 +92,10 @@
// Visitation support
template<typename Visitor>
void apply_to( Visitor& V ) const {}
+
+ static nil& inst() { static nil s_inst; return s_inst; }
+private:
+ nil() {}
};
// ************************************************************************** //
@@ -102,23 +116,31 @@
// ************************************************************************** //
template<typename NP, typename Rest = nil>
-struct named_parameter_combine : Rest, named_parameter_base<named_parameter_combine<NP,Rest> > {
+struct named_parameter_combine
+: Rest
+, named_parameter_base<named_parameter_combine<NP,Rest> > {
typedef typename NP::ref_type res_type;
typedef named_parameter_combine<NP,Rest> self_type;
// Constructor
named_parameter_combine( NP const& np, Rest const& r )
- : Rest( r ), m_param( np ) {}
+ : Rest( r )
+ , m_param( np )
+ {}
// Access methods
res_type operator[]( keyword<typename NP::id,true> kw ) const { return m_param[kw]; }
res_type operator[]( keyword<typename NP::id,false> kw ) const { return m_param[kw]; }
using Rest::operator[];
- bool has( keyword<typename NP::id,false> ) const { return true; }
+ bool has( keyword<typename NP::id,false> kw ) const { return m_param.has( kw ); }
using Rest::has;
-#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
+ void erase( keyword<typename NP::id,false> kw ) const { m_param.erase( kw ); }
+ using Rest::erase;
+
+#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) || \
+ BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0610))
template<typename NP>
named_parameter_combine<NP,self_type> operator,( NP const& np ) const
{ return named_parameter_combine<NP,self_type>( np, *this ); }
@@ -142,30 +164,42 @@
} // namespace nfp_detail
// ************************************************************************** //
-// ************** named_parameter_combine ************** //
+// ************** named_parameter ************** //
// ************************************************************************** //
template<typename T, typename unique_id,typename ReferenceType=T&>
struct named_parameter
: nfp_detail::named_parameter_base<named_parameter<T, unique_id,ReferenceType> >
{
+ typedef nfp_detail::nil nil_t;
typedef T data_type;
typedef ReferenceType ref_type;
typedef unique_id id;
// Constructor
- explicit named_parameter( ref_type v ) : m_value( v ) {}
+ explicit named_parameter( ref_type v )
+ : m_value( v )
+ , m_erased( false )
+ {}
+ named_parameter( named_parameter const& np )
+ : m_value( np.m_value )
+ , m_erased( np.m_erased )
+ {}
// Access methods
- ref_type operator[]( keyword<unique_id,true> ) const { return m_value; }
- ref_type operator[]( keyword<unique_id,false> ) const { return m_value; }
+ ref_type operator[]( keyword<unique_id,true> ) const { return m_erased ? nil_t::inst().template any_cast<ref_type>() : m_value; }
+ ref_type operator[]( keyword<unique_id,false> ) const { return m_erased ? nil_t::inst().template any_cast<ref_type>() : m_value; }
template<typename UnknownId>
- nfp_detail::nil operator[]( keyword<UnknownId,false> ) const { return nfp_detail::nil(); }
+ nil_t operator[]( keyword<UnknownId,false> ) const { return nil_t::inst(); }
- bool has( keyword<unique_id,false> ) const { return true; }
+ bool has( keyword<unique_id,false> ) const { return !m_erased; }
template<typename UnknownId>
bool has( keyword<UnknownId,false> ) const { return false; }
+ void erase( keyword<unique_id,false> ) const { m_erased = true; }
+ template<typename UnknownId>
+ void erase( keyword<UnknownId,false> ) const {}
+
// Visitation support
template<typename Visitor>
void apply_to( Visitor& V ) const
@@ -176,6 +210,7 @@
private:
// Data members
ref_type m_value;
+ mutable bool m_erased;
};
//____________________________________________________________________________//
@@ -186,7 +221,7 @@
namespace nfp_detail {
typedef named_parameter<char, struct no_params_type_t,char> no_params_type;
-}
+} // namespace nfp_detail
namespace {
nfp_detail::no_params_type no_params( '\0' );
@@ -269,7 +304,7 @@
{
using namespace unit_test;
- assign_op( target, src, 0 );
+ assign_op( target, src, static_cast<int>(0) );
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/utils/runtime/argument.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/argument.hpp (original)
+++ branches/release/boost/test/utils/runtime/argument.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -35,10 +35,15 @@
// ************** runtime::argument ************** //
// ************************************************************************** //
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable:4244)
+#endif
+
class argument {
public:
// Constructor
- argument( parameter const& p, rtti::id_t value_type )
+ argument( parameter const& p, call_traits<rtti::id_t>::param_type value_type )
: p_formal_parameter( p )
, p_value_type( value_type )
{}
@@ -94,6 +99,10 @@
return static_cast<typed_argument<T>&>( arg ).p_value.value;
}
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
//____________________________________________________________________________//
} // namespace BOOST_RT_PARAM_NAMESPACE
Modified: branches/release/boost/test/utils/runtime/cla/argument_factory.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/argument_factory.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/argument_factory.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -147,16 +147,16 @@
m_value_handler( p, *value );
if( !p.p_multiplicable )
- arg.reset( p.p_optional_value
- ? (argument*)new typed_argument<boost::optional<T> >( p, value )
- : (argument*)new typed_argument<T>( p, *value ) );
+ arg.reset( p.p_optional_value && (rtti::type_id<T>() != rtti::type_id<bool>())
+ ? static_cast<argument*>(new typed_argument<boost::optional<T> >( p, value ))
+ : static_cast<argument*>(new typed_argument<T>( p, *value )) );
else {
typedef std::list<boost::optional<T> > optional_list;
if( !arg )
arg.reset( p.p_optional_value
- ? (argument*)new typed_argument<optional_list>( p )
- : (argument*)new typed_argument<std::list<T> >( p ) );
+ ? static_cast<argument*>(new typed_argument<optional_list>( p ))
+ : static_cast<argument*>(new typed_argument<std::list<T> >( p )) );
if( p.p_optional_value ) {
optional_list& values = arg_value<optional_list>( *arg );
@@ -204,7 +204,7 @@
inline void
typed_argument_factory<T>::argument_usage_info( format_stream& fs )
{
- rt_cla_detail::argument_value_usage( fs, 0, (T*)0 );
+ rt_cla_detail::argument_value_usage( fs, 0, reinterpret_cast<T*>(0) );
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/utils/runtime/cla/basic_parameter.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/basic_parameter.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/basic_parameter.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -23,6 +23,9 @@
// Boost.Test
#include <boost/test/utils/rtti.hpp>
+// Boost
+#include <boost/utility/base_from_member.hpp>
+
namespace boost {
namespace BOOST_RT_PARAM_NAMESPACE {
@@ -34,11 +37,12 @@
// ************************************************************************** //
template<typename T, typename IdPolicy>
-class basic_parameter : public typed_parameter<T> {
+class basic_parameter : private base_from_member<IdPolicy>, public typed_parameter<T> {
public:
// Constructors
explicit basic_parameter( cstring n )
- : typed_parameter<T>( m_id_policy )
+ : base_from_member<IdPolicy>()
+ , typed_parameter<T>( base_from_member<IdPolicy>::member )
{
this->accept_modifier( name = n );
}
@@ -49,11 +53,8 @@
{
typed_parameter<T>::accept_modifier( m );
- m_id_policy.accept_modifier( m );
+ base_from_member<IdPolicy>::member.accept_modifier( m );
}
-
-private:
- IdPolicy m_id_policy;
};
//____________________________________________________________________________//
Modified: branches/release/boost/test/utils/runtime/cla/char_parameter.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/char_parameter.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/char_parameter.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -47,7 +47,7 @@
{
basic_naming_policy::accept_modifier( m );
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_name.size() <= 1, "Invalid parameter name " << m_name );
+ BOOST_RT_PARAM_VALIDATE_LOGIC( p_name->size() <= 1, "Invalid parameter name " << p_name );
}
};
Modified: branches/release/boost/test/utils/runtime/cla/char_parameter.ipp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/char_parameter.ipp (original)
+++ branches/release/boost/test/utils/runtime/cla/char_parameter.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -34,7 +34,7 @@
char_name_policy::char_name_policy()
: basic_naming_policy( rtti::type_id<char_name_policy>() )
{
- assign_op( m_prefix, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 );
+ assign_op( p_prefix.value, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 );
}
//____________________________________________________________________________//
@@ -43,7 +43,7 @@
char_name_policy::conflict_with( identification_policy const& id ) const
{
return id.p_type_id == p_type_id &&
- m_name == static_cast<char_name_policy const&>( id ).m_name;
+ p_name == static_cast<char_name_policy const&>( id ).p_name;
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -27,7 +27,7 @@
#include <boost/lexical_cast.hpp>
// STL
-// !! could we eliminate these includes?
+// !! can we eliminate these includes?
#include <list>
namespace boost {
@@ -66,7 +66,7 @@
inline void
argument_value_usage( format_stream& fs, int, bool* = 0 )
{
- fs << BOOST_RT_PARAM_CSTRING_LITERAL( "[yes|y|no|n]" );
+ fs << BOOST_RT_PARAM_CSTRING_LITERAL( "yes|y|no|n" );
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/utils/runtime/cla/dual_name_parameter.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/dual_name_parameter.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/dual_name_parameter.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -35,18 +35,26 @@
public:
dual_name_policy();
- // Accept modifer
+ // Accept modifier
template<typename Modifier>
void accept_modifier( Modifier const& m )
{
- if( m.has( prefix ) )
+ if( m.has( prefix ) ) {
set_prefix( m[prefix] );
+ m.erase( prefix );
+ }
- if( m.has( name ) )
+ if( m.has( name ) ) {
set_name( m[name] );
+ m.erase( name );
+ }
- if( m.has( separator ) )
+ if( m.has( separator ) ) {
set_separator( m[separator] );
+ m.erase( separator );
+ }
+
+ dual_id_policy<dual_name_policy,string_name_policy,char_name_policy>::accept_modifier( m );
}
private:
void set_prefix( cstring );
Modified: branches/release/boost/test/utils/runtime/cla/id_policy.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/id_policy.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/id_policy.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -41,23 +41,28 @@
class basic_naming_policy : public identification_policy {
public:
+ // Public properties
+ unit_test::readwrite_property<dstring> p_prefix;
+ unit_test::readwrite_property<dstring> p_name;
+ unit_test::readwrite_property<dstring> p_separator;
+
// Policy interface
- virtual bool responds_to( cstring name ) const { return m_name == name; }
- virtual cstring id_2_report() const { return m_name; }
+ virtual bool responds_to( cstring name ) const { return p_name == name; }
+ virtual cstring id_2_report() const { return p_name.get(); }
virtual void usage_info( format_stream& fs ) const;
virtual bool matching( parameter const& p, argv_traverser& tr, bool primary ) const;
- // Accept modifer
+ // Accept modifier
template<typename Modifier>
void accept_modifier( Modifier const& m )
{
- nfp::optionally_assign( m_prefix, m, prefix );
- nfp::optionally_assign( m_name, m, name );
- nfp::optionally_assign( m_separator, m, separator );
+ nfp::optionally_assign( p_prefix.value, m, prefix );
+ nfp::optionally_assign( p_name.value, m, name );
+ nfp::optionally_assign( p_separator.value, m, separator );
}
protected:
- explicit basic_naming_policy( rtti::id_t const& dyn_type )
+ explicit basic_naming_policy( call_traits<rtti::id_t>::param_type dyn_type )
: identification_policy( dyn_type )
{}
BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~basic_naming_policy() {}
@@ -65,12 +70,7 @@
// Naming policy interface
virtual bool match_prefix( argv_traverser& tr ) const;
virtual bool match_name( argv_traverser& tr ) const;
- virtual bool match_separator( argv_traverser& tr ) const;
-
- // Data members
- dstring m_prefix;
- dstring m_name;
- dstring m_separator;
+ virtual bool match_separator( argv_traverser& tr, bool optional_value ) const;
};
// ************************************************************************** //
@@ -94,7 +94,7 @@
}
virtual bool conflict_with( identification_policy const& id_p ) const
{
- return m_primary.conflict_with( id_p ) || m_secondary.conflict_with( id_p );
+ return id_p.conflict_with( m_primary ) || id_p.conflict_with( m_secondary );
}
virtual cstring id_2_report() const
{
@@ -113,6 +113,14 @@
return m_primary.matching( p, tr, primary ) || m_secondary.matching( p, tr, primary );
}
+ // Accept modifier
+ template<typename Modifier>
+ void accept_modifier( Modifier const& m )
+ {
+ m_primary.accept_modifier( m );
+ m_secondary.accept_modifier( m );
+ }
+
protected:
BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~dual_id_policy() {}
Modified: branches/release/boost/test/utils/runtime/cla/id_policy.ipp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/id_policy.ipp (original)
+++ branches/release/boost/test/utils/runtime/cla/id_policy.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -19,6 +19,7 @@
#include <boost/test/utils/runtime/config.hpp>
#include <boost/test/utils/runtime/cla/id_policy.hpp>
+#include <boost/test/utils/runtime/cla/parameter.hpp>
namespace boost {
@@ -33,9 +34,9 @@
BOOST_RT_PARAM_INLINE void
basic_naming_policy::usage_info( format_stream& fs ) const
{
- fs << m_prefix << m_name << m_separator;
+ fs << p_prefix << p_name << p_separator;
- if( m_separator.empty() )
+ if( p_separator->empty() )
fs << BOOST_RT_PARAM_LITERAL( ' ' );
}
@@ -44,10 +45,10 @@
BOOST_RT_PARAM_INLINE bool
basic_naming_policy::match_prefix( argv_traverser& tr ) const
{
- if( !tr.match_front( m_prefix ) )
+ if( !tr.match_front( p_prefix.get() ) )
return false;
- tr.trim( m_prefix.size() );
+ tr.trim( p_prefix->size() );
return true;
}
@@ -56,29 +57,34 @@
BOOST_RT_PARAM_INLINE bool
basic_naming_policy::match_name( argv_traverser& tr ) const
{
- if( !tr.match_front( m_name ) )
+ if( !tr.match_front( p_name.get() ) )
return false;
- tr.trim( m_name.size() );
+ tr.trim( p_name->size() );
return true;
}
//____________________________________________________________________________//
BOOST_RT_PARAM_INLINE bool
-basic_naming_policy::match_separator( argv_traverser& tr ) const
+basic_naming_policy::match_separator( argv_traverser& tr, bool optional_value ) const
{
- if( m_separator.empty() ) {
+ if( p_separator->empty() ) {
if( !tr.token().is_empty() )
return false;
tr.trim( 1 );
}
else {
- if( !tr.match_front( m_separator ) )
+ if( !tr.match_front( p_separator.get() ) ) {
+ // if parameter has optional value separator is optional as well
+ if( optional_value && ( tr.eoi() || tr.match_front( ' ' ) ) ) {
+ return true;
+ }
return false;
+ }
- tr.trim( m_separator.size() );
+ tr.trim( p_separator->size() );
}
return true;
@@ -87,7 +93,7 @@
//____________________________________________________________________________//
BOOST_RT_PARAM_INLINE bool
-basic_naming_policy::matching( parameter const&, argv_traverser& tr, bool ) const
+basic_naming_policy::matching( parameter const& p, argv_traverser& tr, bool ) const
{
if( !match_prefix( tr ) )
return false;
@@ -95,7 +101,7 @@
if( !match_name( tr ) )
return false;
- if( !match_separator( tr ) )
+ if( !match_separator( tr, p.p_optional_value ) )
return false;
return true;
Modified: branches/release/boost/test/utils/runtime/cla/iface/argument_factory.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/iface/argument_factory.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/iface/argument_factory.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -30,7 +30,7 @@
// ************************************************************************** //
// ************** argument_factory ************** //
// ************************************************************************** //
-// another name could be argument production policy
+// another name can be argument production policy
class argument_factory {
public:
Modified: branches/release/boost/test/utils/runtime/cla/iface/id_policy.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/iface/id_policy.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/iface/id_policy.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -34,6 +34,11 @@
// ************** identification_policy ************** //
// ************************************************************************** //
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable:4244)
+#endif
+
class identification_policy {
public:
// Public properties
@@ -49,12 +54,16 @@
protected:
// Constructor
- explicit identification_policy( rtti::id_t const& dyn_type )
+ explicit identification_policy( call_traits<rtti::id_t>::param_type dyn_type )
: p_type_id( dyn_type )
{}
BOOST_TEST_PROTECTED_VIRTUAL ~identification_policy() {}
};
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
} // namespace cla
} // namespace BOOST_RT_PARAM_NAMESPACE
Modified: branches/release/boost/test/utils/runtime/cla/modifier.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/modifier.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/modifier.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -34,17 +34,17 @@
namespace {
nfp::typed_keyword<bool,struct optional_t> optional_m;
-nfp::named_parameter<bool const,optional_t> optional( true );
+nfp::named_parameter<bool,optional_t,bool> optional( true );
nfp::typed_keyword<bool,struct required_t> required_m;
-nfp::named_parameter<bool const,required_t> required( true );
+nfp::named_parameter<bool,required_t,bool> required( true );
nfp::typed_keyword<bool,struct multiplicable_t> multiplicable_m;
-nfp::named_parameter<bool const,multiplicable_t> multiplicable( true );
+nfp::named_parameter<bool,multiplicable_t,bool> multiplicable( true );
nfp::typed_keyword<bool,struct guess_name_t> guess_name_m;
-nfp::named_parameter<bool const,guess_name_t> guess_name( true );
+nfp::named_parameter<bool,guess_name_t,bool> guess_name( true );
nfp::typed_keyword<bool,struct ignore_mismatch_t> ignore_mismatch_m;
-nfp::named_parameter<bool const,ignore_mismatch_t> ignore_mismatch( true );
+nfp::named_parameter<bool,ignore_mismatch_t,bool> ignore_mismatch( true );
nfp::typed_keyword<bool,struct optional_value_t> optional_value_m;
-nfp::named_parameter<bool const,optional_value_t> optional_value( true );
+nfp::named_parameter<bool,optional_value_t,bool> optional_value( true );
nfp::typed_keyword<char_type,struct input_separator_t> input_separator;
nfp::typed_keyword<cstring,struct prefix_t> prefix;
Modified: branches/release/boost/test/utils/runtime/cla/named_parameter.ipp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/named_parameter.ipp (original)
+++ branches/release/boost/test/utils/runtime/cla/named_parameter.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -39,7 +39,7 @@
: basic_naming_policy( rtti::type_id<string_name_policy>() )
, m_guess_name( false )
{
- assign_op( m_prefix, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 );
+ assign_op( p_prefix.value, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 );
}
//____________________________________________________________________________//
@@ -49,39 +49,53 @@
{
std::pair<cstring::iterator,dstring::const_iterator> mm_pos;
- mm_pos = unit_test::mismatch( name.begin(), name.end(), m_name.begin(), m_name.end() );
+ mm_pos = unit_test::mismatch( name.begin(), name.end(), p_name->begin(), p_name->end() );
- return mm_pos.first == name.end() && (m_guess_name || (mm_pos.second == m_name.end()) );
+ return mm_pos.first == name.end() && (m_guess_name || (mm_pos.second == p_name->end()) );
}
//____________________________________________________________________________//
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable:4244)
+#endif
+
BOOST_RT_PARAM_INLINE bool
string_name_policy::conflict_with( identification_policy const& id ) const
{
if( id.p_type_id == p_type_id ) {
string_name_policy const& snp = static_cast<string_name_policy const&>( id );
- if( m_name.empty() || snp.m_name.empty() )
+ if( p_name->empty() || snp.p_name->empty() )
+ return false;
+
+ if( p_prefix != snp.p_prefix )
return false;
std::pair<dstring::const_iterator,dstring::const_iterator> mm_pos =
- unit_test::mismatch( m_name.begin(), m_name.end(), snp.m_name.begin(), snp.m_name.end() );
+ unit_test::mismatch( p_name->begin(), p_name->end(), snp.p_name->begin(), snp.p_name->end() );
- return mm_pos.first != m_name.begin() && // there is common substring
- (m_guess_name || (mm_pos.first == m_name.end()) ) && // that match me
- (snp.m_guess_name || (mm_pos.second == snp.m_name.end()) ); // and snp
+ return mm_pos.first != p_name->begin() && // there is common substring
+ ((m_guess_name && (mm_pos.second == snp.p_name->end()) ) || // that match other guy and I am guessing
+ (snp.m_guess_name && (mm_pos.first == p_name->end()) )); // or me and the other guy is
}
if( id.p_type_id == rtti::type_id<char_name_policy>() ) {
char_name_policy const& cnp = static_cast<char_name_policy const&>( id );
-
- return m_guess_name && unit_test::first_char( cstring( m_name ) ) == unit_test::first_char( cnp.id_2_report() );
+
+ return m_guess_name &&
+ (p_prefix == cnp.p_prefix) &&
+ unit_test::first_char( cstring( p_name ) ) == unit_test::first_char( cstring( cnp.p_name ) );
}
return false;
}
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
//____________________________________________________________________________//
BOOST_RT_PARAM_INLINE bool
@@ -89,18 +103,17 @@
{
if( !m_guess_name )
return basic_naming_policy::match_name( tr );
- else {
- cstring in = tr.input();
- std::pair<cstring::iterator,dstring::const_iterator> mm_pos;
-
- mm_pos = unit_test::mismatch( in.begin(), in.end(), m_name.begin(), m_name.end() );
+ cstring in = tr.input();
- if( mm_pos.first == in.begin() )
- return false;
+ std::pair<cstring::iterator,dstring::const_iterator> mm_pos;
+
+ mm_pos = unit_test::mismatch( in.begin(), in.end(), p_name->begin(), p_name->end() );
- tr.trim( mm_pos.first - in.begin() );
- }
+ if( mm_pos.first == in.begin() )
+ return false;
+
+ tr.trim( mm_pos.first - in.begin() );
return true;
}
Modified: branches/release/boost/test/utils/runtime/cla/parameter.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/parameter.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/parameter.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -42,10 +42,10 @@
class parameter : public BOOST_RT_PARAM_NAMESPACE::parameter {
public:
- parameter( identification_policy& ID, argument_factory& F )
+ parameter( identification_policy& ID, argument_factory& F, bool optional_value = false )
: p_optional( false )
, p_multiplicable( false )
- , p_optional_value( false )
+ , p_optional_value( optional_value )
, m_id_policy( ID )
, m_arg_factory( F )
{}
@@ -89,7 +89,7 @@
{
return (id_2_report() == p.id_2_report() && !id_2_report().is_empty()) ||
m_id_policy.conflict_with( p.m_id_policy ) ||
- p.m_id_policy.conflict_with( m_id_policy );
+ ((m_id_policy.p_type_id != p.m_id_policy.p_type_id) && p.m_id_policy.conflict_with( m_id_policy ));
}
cstring id_2_report() const { return m_id_policy.id_2_report(); }
void usage_info( format_stream& fs ) const
@@ -113,7 +113,7 @@
// argument production based on different source
void produce_argument( argv_traverser& tr )
{
- m_id_policy.matching( *this, tr, true ); // !! could we save this position somehow
+ m_id_policy.matching( *this, tr, true ); // !! can we save this position somehow
m_actual_argument = m_arg_factory.produce_using( *this, tr );
}
void produce_argument( parser const& p )
Modified: branches/release/boost/test/utils/runtime/cla/parser.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/parser.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/parser.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -64,7 +64,7 @@
private:
// Data members;
parser& m_parser;
- Modifier const& m_modifiers;
+ Modifier const& m_modifiers;
};
}
Modified: branches/release/boost/test/utils/runtime/cla/parser.ipp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/parser.ipp (original)
+++ branches/release/boost/test/utils/runtime/cla/parser.ipp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -83,8 +83,7 @@
parser::operator<<( parameter_ptr new_param )
{
BOOST_TEST_FOREACH( parameter_ptr, old_param, m_parameters ) {
- BOOST_RT_PARAM_VALIDATE_LOGIC( !old_param->conflict_with( *new_param ) &&
- !new_param->conflict_with( *old_param ),
+ BOOST_RT_PARAM_VALIDATE_LOGIC( !old_param->conflict_with( *new_param ),
BOOST_RT_PARAM_LITERAL( "Definition of parameter " ) << new_param->id_2_report() <<
BOOST_RT_PARAM_LITERAL( " conflicts with defintion of parameter " ) << old_param->id_2_report() );
}
@@ -103,7 +102,7 @@
m_program_name.assign( argv[0] );
dstring::size_type pos = m_program_name.find_last_of( BOOST_RT_PARAM_LITERAL( "/\\" ) );
- if( pos != cstring::npos )
+ if( pos != static_cast<dstring::size_type>(cstring::npos) )
m_program_name.erase( 0, pos+1 );
}
@@ -176,9 +175,7 @@
}
}
- BOOST_RT_PARAM_VALIDATE_LOGIC( found_param, BOOST_RT_PARAM_LITERAL( "Unknown parameter: " ) << string_id );
-
- return found_param->actual_argument();
+ return found_param ? found_param->actual_argument() : argument_ptr();
}
//____________________________________________________________________________//
Modified: branches/release/boost/test/utils/runtime/cla/positional_parameter.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/positional_parameter.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/positional_parameter.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -27,7 +27,7 @@
namespace cla {
// ************************************************************************** //
-// ************** single_name_policy ************** //
+// ************** trivial_id_policy ************** //
// ************************************************************************** //
class trivial_id_policy : public identification_policy {
Modified: branches/release/boost/test/utils/runtime/cla/typed_parameter.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/cla/typed_parameter.hpp (original)
+++ branches/release/boost/test/utils/runtime/cla/typed_parameter.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -40,7 +40,9 @@
template<typename T>
class typed_parameter : public cla::parameter {
public:
- explicit typed_parameter( identification_policy& ID ) : cla::parameter( ID, m_arg_factory ) {}
+ explicit typed_parameter( identification_policy& ID )
+ : cla::parameter( ID, m_arg_factory, rtti::type_id<T>() == rtti::type_id<bool>() )
+ {}
// parameter properties modification
template<typename Modifier>
@@ -51,7 +53,7 @@
m_arg_factory.accept_modifier( m );
BOOST_RT_PARAM_VALIDATE_LOGIC( !p_optional || !m_arg_factory.m_value_generator,
- BOOST_RT_PARAM_LITERAL( "couldn't define a value generator for optional parameter " ) << id_2_report() );
+ BOOST_RT_PARAM_LITERAL( "can't define a value generator for optional parameter " ) << id_2_report() );
}
private:
Modified: branches/release/boost/test/utils/runtime/config.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/config.hpp (original)
+++ branches/release/boost/test/utils/runtime/config.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -44,6 +44,10 @@
# endif
#endif
+#ifdef __SUNPRO_CC
+extern int putenv(char*);
+#endif
+
namespace boost {
namespace BOOST_RT_PARAM_NAMESPACE {
@@ -63,7 +67,8 @@
typedef std::basic_ostream<char_type> out_stream;
#endif
-#if defined(__COMO__)
+#ifndef UNDER_CE
+#if defined(__COMO__) && 0
inline void
putenv_impl( cstring name, cstring value )
{
@@ -85,11 +90,12 @@
putenv( const_cast<char*>( fs.str().c_str() ) );
}
#endif
+#endif
#define BOOST_RT_PARAM_LITERAL( l ) l
#define BOOST_RT_PARAM_CSTRING_LITERAL( l ) cstring( l, sizeof( l ) - 1 )
#define BOOST_RT_PARAM_GETENV getenv
-#define BOOST_RT_PARAM_PUTENV putenv_impl
+#define BOOST_RT_PARAM_PUTENV ::boost::BOOST_RT_PARAM_NAMESPACE::putenv_impl
#define BOOST_RT_PARAM_EXCEPTION_INHERIT_STD
//____________________________________________________________________________//
@@ -103,6 +109,7 @@
typedef wrap_wstringstream format_stream;
typedef std::wostream out_stream;
+#ifndef UNDER_CE
inline void
putenv_impl( cstring name, cstring value )
{
@@ -115,6 +122,7 @@
using namespace std;
wputenv( const_cast<wchar_t*>( fs.str().c_str() ) );
}
+#endif
#define BOOST_RT_PARAM_LITERAL( l ) L ## l
#define BOOST_RT_PARAM_CSTRING_LITERAL( l ) cstring( L ## l, sizeof( L ## l )/sizeof(wchar_t) - 1 )
Modified: branches/release/boost/test/utils/runtime/env/environment.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/env/environment.hpp (original)
+++ branches/release/boost/test/utils/runtime/env/environment.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -15,6 +15,10 @@
#ifndef BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER
#define BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER
+#ifdef UNDER_CE
+#error Windows CE does not support environment variables.
+#endif
+
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
#include <boost/test/utils/runtime/fwd.hpp>
Modified: branches/release/boost/test/utils/runtime/env/fwd.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/env/fwd.hpp (original)
+++ branches/release/boost/test/utils/runtime/env/fwd.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -15,6 +15,10 @@
#ifndef BOOST_RT_ENV_FWD_HPP_062604GER
#define BOOST_RT_ENV_FWD_HPP_062604GER
+#ifdef UNDER_CE
+#error Windows CE does not support environment variables.
+#endif
+
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
Modified: branches/release/boost/test/utils/runtime/env/variable.hpp
==============================================================================
--- branches/release/boost/test/utils/runtime/env/variable.hpp (original)
+++ branches/release/boost/test/utils/runtime/env/variable.hpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -15,6 +15,10 @@
#ifndef BOOST_RT_ENV_VARIABLE_HPP_062604GER
#define BOOST_RT_ENV_VARIABLE_HPP_062604GER
+#ifdef UNDER_CE
+#error Windows CE does not support environment variables.
+#endif
+
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
#include <boost/test/utils/runtime/fwd.hpp>
@@ -100,7 +104,13 @@
// access methods
T const& value() const { return variable_base::value<T>(); }
+#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) || \
+ BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0593))
+ template<typename T>
+ void value( boost::optional<T>& res ) const { variable_base::value( res ); }
+#else
using variable_base::value;
+#endif
// Value assignment
template<typename V>
Modified: branches/release/boost/test/utils/runtime/file/config_file_iterator.cpp
==============================================================================
--- branches/release/boost/test/utils/runtime/file/config_file_iterator.cpp (original)
+++ branches/release/boost/test/utils/runtime/file/config_file_iterator.cpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -18,7 +18,10 @@
#include <boost/test/utils/runtime/file/config_file_iterator.hpp>
#include <boost/test/utils/runtime/validation.hpp>
+#ifndef UNDER_CE
#include <boost/test/utils/runtime/env/environment.hpp>
+#endif
+
// Boost
#include <boost/utility.hpp>
@@ -155,7 +158,7 @@
}
}
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_RT_PARAM_LITERAL( "couldn't open file " ) << file_name );
+ BOOST_RT_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_RT_PARAM_LITERAL( "can't open file " ) << file_name );
}
//____________________________________________________________________________//
@@ -352,7 +355,9 @@
if( it == m_symbols_table.end() ) {
boost::optional<cstring> macro_value; // !! variable actually may have different type
+ #ifndef UNDER_CE
env::get( macro_name, macro_value );
+ #endif
BOOST_RT_PARAM_VALIDATE_LOGIC( macro_value || ignore_missing || !m_detect_missing_macro,
BOOST_RT_PARAM_LITERAL( "Unknown macro \"" ) << macro_name << BOOST_RT_PARAM_LITERAL( "\"" ) );
Modified: branches/release/libs/test/build/Jamfile.v2
==============================================================================
--- branches/release/libs/test/build/Jamfile.v2 (original)
+++ branches/release/libs/test/build/Jamfile.v2 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -9,11 +9,13 @@
: requirements <link>shared:<define>BOOST_TEST_DYN_LINK=1
<toolset>msvc:<asynch-exceptions>on
<toolset>borland:<cxxflags>-w-8080
- # Disable Warning about boost::noncopyable not being exported
- <link>shared,<toolset>msvc:<cxxflags>-wd4275
+ # Disable Warning about boost::noncopyable not being exported
+ <link>shared,<toolset>msvc:<cxxflags>-wd4275
+ <toolset>msvc:<cxxflags>-wd4671
+ <toolset>msvc:<cxxflags>-wd4673
+ <warnings>all
: usage-requirements
<define>BOOST_TEST_NO_AUTO_LINK=1
- <link>shared:<define>BOOST_TEST_DYN_LINK=1
# Disable Warning about boost::noncopyable not being exported
<link>shared,<toolset>msvc:<cxxflags>-wd4275
;
@@ -66,12 +68,33 @@
xml_report_formatter
;
-lib boost_prg_exec_monitor : $(PRG_EXEC_MON_SOURCES).cpp ;
+lib boost_prg_exec_monitor
+ : # sources
+ $(PRG_EXEC_MON_SOURCES).cpp
+ : # requirements
+ : # default build
+ : # usage-requirements
+ <link>shared:<define>BOOST_TEST_DYN_LINK=1
+ ;
-lib boost_test_exec_monitor : $(TEST_EXEC_MON_SOURCES).cpp : <link>static ;
+lib boost_test_exec_monitor
+ : # sources
+ $(TEST_EXEC_MON_SOURCES).cpp
+ : # requirements
+ <link>static
+ : # default build
+ : # usage-requirements
+ <link>shared:<define>BOOST_TEST_DYN_LINK=1
+ ;
-lib boost_unit_test_framework : $(UTF_SOURCES).cpp ;
-
+lib boost_unit_test_framework
+ : # sources
+ $(UTF_SOURCES).cpp
+ : # requirements
+ : # default build
+ : # usage-requirements
+ <link>shared:<define>BOOST_TEST_DYN_LINK=1
+ ;
alias minimal : : : :
<toolset>msvc:<asynch-exceptions>on
@@ -81,8 +104,7 @@
<toolset>msvc:<asynch-exceptions>on
;
-
boost-install boost_prg_exec_monitor
boost_test_exec_monitor
- boost_unit_test_framework ;
-
\ No newline at end of file
+ boost_unit_test_framework ;
+
\ No newline at end of file
Modified: branches/release/libs/test/example/Jamfile.v2
==============================================================================
--- branches/release/libs/test/example/Jamfile.v2 (original)
+++ branches/release/libs/test/example/Jamfile.v2 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -59,4 +59,8 @@
[ run named_param_example.cpp ]
[ run const_string_test.cpp ]
+
+ [ run-fail external_main_example_1.cpp unit_test_framework ]
+ [ run-fail external_main_example_2.cpp unit_test_framework ]
+ [ run-fail external_main_example_3.cpp ]
;
Modified: branches/release/libs/test/example/test_case_template_example.cpp
==============================================================================
--- branches/release/libs/test/example/test_case_template_example.cpp (original)
+++ branches/release/libs/test/example/test_case_template_example.cpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -10,8 +10,7 @@
# pragma warning(disable: C4345)
#endif
-#include <boost/test/test_tools.hpp>
-#include <boost/test/test_case_template.hpp>
+#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;
// Boost.MPL
Modified: branches/release/libs/test/test/Jamfile.v2
==============================================================================
--- branches/release/libs/test/test/Jamfile.v2 (original)
+++ branches/release/libs/test/test/Jamfile.v2 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -22,7 +22,29 @@
<toolset>borland:<cxxflags>-w-8080
<toolset>msvc-6.5:<link>static
<toolset>msvc-8.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <warnings>all
+ : $(test-name)
+ ] ;
+}
+
+rule test-btl-lib-mt ( test-rule : test-name : lib-name ? : pattern_file * : source_files * : extra-libs ? )
+{
+ source_files ?= $(test-name).cpp ;
+
+ return [ $(test-rule) $(source_files) ../build//$(lib-name) $(extra-libs)
+ : #args
+ : $(pattern_file)
+ : #<stlport-iostream>on
+ # Activating -pedantic finds more gotchas
+ # Unfortunately, this warns about the use of "long long" in gcc's own stdlib
+ # So deactivate those warnings again
+ <toolset>gcc:<cxxflags>-pedantic
+ <toolset>gcc:<cxxflags>-Wno-long-long
+ <toolset>borland:<cxxflags>-w-8080
+ <toolset>msvc-6.5:<link>static
+ <toolset>msvc-8.0:<define>_SCL_SECURE_NO_DEPRECATE
<define>BOOST_TEST_NO_AUTO_LINK=1 # requirements
+ <threading>multi
: $(test-name)
] ;
}
@@ -34,7 +56,7 @@
;
test-suite "prg_exec_monitor_test"
- : [ test-btl-lib run-fail : prg_exec_fail1 : boost_prg_exec_monitor/<link>static ]
+ : [ test-btl-lib run-fail : prg_exec_fail1 : included ]
[ test-btl-lib run-fail : prg_exec_fail2 : boost_prg_exec_monitor/<link>static ]
[ test-btl-lib run-fail : prg_exec_fail3 : boost_prg_exec_monitor/<link>static ]
[ test-btl-lib run-fail : prg_exec_fail4 : boost_prg_exec_monitor/<link>static ]
@@ -59,12 +81,15 @@
[ test-btl-lib run : token_iterator_test : boost_unit_test_framework ]
[ test-btl-lib run : boost_check_equal_str : boost_unit_test_framework ]
[ test-btl-lib run : test_tree_management_test : boost_unit_test_framework ]
- [ test-btl-lib run : sync_access_test : boost_unit_test_framework/<link>static : : : /boost/thread//boost_thread ]
+ ;
- ;
+test-suite "multithreaded_test"
+ :
+ [ test-btl-lib-mt run : sync_access_test : boost_unit_test_framework/<link>static : : : /boost/thread//boost_thread ]
+ ;
# A target that runs all the tests
alias test : basics_test prg_exec_monitor_test unit_test_framework_test ;
# Only run tests when explicitly requested
-# explicit test basics_test prg_exec_monitor_test unit_test_framework_test ;
+# explicit test basics_test prg_exec_monitor_test unit_test_framework_test ;
Modified: branches/release/libs/test/test/basic_cstring_test.cpp
==============================================================================
--- branches/release/libs/test/test/basic_cstring_test.cpp (original)
+++ branches/release/libs/test/test/basic_cstring_test.cpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -14,6 +14,7 @@
#ifdef _MSC_VER
#pragma warning(disable: 4996)
+#pragma warning(disable: 4267)
#endif
// Boost.Test
Modified: branches/release/libs/test/test/test_files/errors_handling_test.pattern
==============================================================================
--- branches/release/libs/test/test/test_files/errors_handling_test.pattern (original)
+++ branches/release/libs/test/test/test_files/errors_handling_test.pattern 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -11,7 +11,7 @@
Entering test case "error_on_demand"
message
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -19,7 +19,7 @@
Entering test case "error_on_demand"
107: warning in "error_on_demand": warning
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -72,7 +72,7 @@
Entering test case "error_on_demand"
message
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -80,7 +80,7 @@
Entering test case "error_on_demand"
107: warning in "error_on_demand": warning
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -130,13 +130,13 @@
log level: log_messages; error type: user message;
message
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
===========================
log level: log_messages; error type: user warning;
107: warning in "error_on_demand": warning
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
===========================
log level: log_messages; error type: user non-fatal error;
Modified: branches/release/libs/test/test/test_files/errors_handling_test.pattern2
==============================================================================
--- branches/release/libs/test/test/test_files/errors_handling_test.pattern2 (original)
+++ branches/release/libs/test/test/test_files/errors_handling_test.pattern2 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -11,7 +11,7 @@
Entering test case "error_on_demand"
message
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -19,7 +19,7 @@
Entering test case "error_on_demand"
107: warning in "error_on_demand": warning
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -55,7 +55,7 @@
Entering test case "error_on_demand"
message
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -63,7 +63,7 @@
Entering test case "error_on_demand"
107: warning in "error_on_demand": warning
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
Leaving test case "error_on_demand"
===========================
@@ -96,13 +96,13 @@
log level: log_messages; error type: user message;
message
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
===========================
log level: log_messages; error type: user warning;
107: warning in "error_on_demand": warning
-Test case error_on_demand doesn't include any assertions
+Test case error_on_demand did not run any assertions
===========================
log level: log_messages; error type: user non-fatal error;
Deleted: branches/release/libs/test/test/test_files/test_fp_comparisons.pattern
==============================================================================
--- branches/release/libs/test/test/test_files/test_fp_comparisons.pattern 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
+++ (empty file)
@@ -1,30 +0,0 @@
-152: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-20} exceeds 1e-05%
-153: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-30} exceeds 1e-05%
-154: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{-1e-10} exceeds 0.1%
-155: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{0.123457} exceeds 0.0001%
-159: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{-0.123457} exceeds 0.001%
-163: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.23456e-10} and fp2{1.23457e-11} exceeds 0.001%
-164: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.111e-10} and fp2{1.112e-10} exceeds 0.08999%
-165: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.112e-10} and fp2{1.111e-10} exceeds 0.08999%
-170: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1} and fp2{1.0002} exceeds 0.011%
-152: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-20} exceeds 1e-05%
-153: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-30} exceeds 1e-05%
-154: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{-1e-10} exceeds 0.1%
-155: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{0.123457} exceeds 0.0001%
-159: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{-0.123457} exceeds 0.001%
-163: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.23456e-10} and fp2{1.23457e-11} exceeds 0.001%
-164: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.111e-10} and fp2{1.112e-10} exceeds 0.08999%
-165: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.112e-10} and fp2{1.111e-10} exceeds 0.08999%
-170: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1} and fp2{1.0002} exceeds 0.011%
-152: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-20} exceeds 1e-05%
-153: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-30} exceeds 1e-05%
-154: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{-1e-10} exceeds 0.1%
-155: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{0.123457} exceeds 0.0001%
-159: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{-0.123457} exceeds 0.001%
-163: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.23456e-10} and fp2{1.23457e-11} exceeds 0.001%
-164: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.111e-10} and fp2{1.112e-10} exceeds 0.08999%
-165: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.112e-10} and fp2{1.111e-10} exceeds 0.08999%
-170: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1} and fp2{1.0002} exceeds 0.011%
-204: error in "test_CHECK_SMALL": absolute value of 1e-6{1e-06} exceeds 1e-07
-219: error in "test_close_at_tolerance": difference between fp1{1.00000001} and fp2{1.00000002} exceeds 1e-06%
-226: error in "test_close_at_tolerance": check close_at_tolerance<double>( epsilon )( fp1, fp2 ) failed for ( 1.23456e-10, 1.23457e-10 )
Modified: branches/release/libs/test/test/test_files/test_tools_test.pattern
==============================================================================
--- branches/release/libs/test/test/test_files/test_tools_test.pattern (original)
+++ branches/release/libs/test/test/test_files/test_tools_test.pattern 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -1,63 +1,63 @@
-131: warning in "test_BOOST_WARN": condition sizeof(int) == sizeof(short) is not satisfied
-134: info: check sizeof(unsigned char) == sizeof(char) passed
-156: error in "test_BOOST_CHECK": check false failed
-157: error in "test_BOOST_CHECK": check 1==2 failed
-158: error in "test_BOOST_CHECK": check i==1 failed
-161: info: check i==2 passed
-168: error in "test_BOOST_REQUIRE": not aborted
-170: fatal error in "test_BOOST_REQUIRE": critical check false failed
-174: fatal error in "test_BOOST_REQUIRE": critical check j > 5 failed
-177: info: check j < 5 passed
-177: error in "test_BOOST_REQUIRE": not aborted
-191: info: check 'object size 33 is too small' passed
-208: error in "test_BOOST_CHECK_MESSAGE": Well, may be that what I believe in
-210: error in "test_BOOST_CHECK_MESSAGE": Checking predicate failed. Some explanation
-213: info: check 'Could it fail?' passed
-218: error in "test_BOOST_CHECK_MESSAGE": Comparing 1 and 2: some explanation
-225: fatal error in "test_BOOST_REQUIRE_MESSAGE": Here we should stop
-228: info: check 'That's OK' passed
-228: error in "test_BOOST_REQUIRE_MESSAGE": not aborted
-235: error in "test_BOOST_ERROR": Fail to miss an error
-242: fatal error in "test_BOOST_FAIL": No! No! Show must go on.
-258: error in "test_BOOST_CHECK_THROW": exception my_exception is expected
-261: warning in "test_BOOST_CHECK_THROW": exception my_exception is expected
-264: fatal error in "test_BOOST_CHECK_THROW": exception my_exception is expected
-267: info: check 'exception my_exception is caught' passed
-274: error in "test_BOOST_CHECK_EXCEPTION": incorrect exception my_exception is caught
-277: info: check 'incorrect exception my_exception is caught' passed
-287: error in "test_BOOST_CHECK_NO_THROW": exception thrown by throw my_exception()
-333: error in "test_BOOST_CHECK_EQUAL": check i == j failed [1 != 2]
-339: error in "test_BOOST_CHECK_EQUAL": check str1 == str2 failed [test1 != test12]
-342: error in "test_BOOST_CHECK_EQUAL": check i+1 == j failed [4 != 2]
-345: info: check str1 == str3+1 passed
-354: fatal error in "test_BOOST_CHECK_EQUAL": critical check str1 == str2 failed [test != null string]
-360: warning in "test_BOOST_CHECK_EQUAL": condition b1 == b2 is not satisfied [B(1) != B(2)]
-366: error in "test_BOOST_CHECK_EQUAL": check c1 == c3 failed [C(0,100) != C(1,102)]. Index mismatch
-367: error in "test_BOOST_CHECK_EQUAL": check c1 == c2 failed [C(0,100) != C(0,101)]. Id mismatch
-371: error in "test_BOOST_CHECK_EQUAL": check ch1 == ch2 failed [0xfffffffe != 0xfffffffd]
-382: error in "test_BOOST_CHECK_LOGICAL_EXPR": check ++i != j failed [2 == 2]
-384: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i < j failed [2 >= 2]
-385: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i > j failed [2 <= 2]
-392: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i <= j failed [3 > 2]
-393: error in "test_BOOST_CHECK_LOGICAL_EXPR": check j >= i failed [2 < 3]
-398: error in "test_BOOST_CHECK_LOGICAL_EXPR": check str1 != str2 failed [test1 == test1]
-428: error in "test_BOOST_CHECK_PREDICATE": check is_even( i ) failed for ( 17 )
-431: error in "test_BOOST_CHECK_PREDICATE": check not_equal_to<int>()( i, 17 ) failed for ( 17, 17 )
-437: warning in "test_BOOST_CHECK_PREDICATE": condition moo( 12, i, j ) is not satisfied for ( 12, 17, 15 )
-445: error in "test_BOOST_CHECK_PREDICATE": check compare_lists( l1, l2 ) failed for ( , ). Different sizes [2!=0]
-456: error in "test_BOOST_REQUIRE_PREDICATE": not aborted
-458: fatal error in "test_BOOST_REQUIRE_PREDICATE": critical check less_equal<int>()( arg2, arg1 ) failed for ( 2, 1 )
-479: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+7 } failed.
+136: warning in "test_BOOST_WARN": condition sizeof(int) == sizeof(short) is not satisfied
+139: info: check sizeof(unsigned char) == sizeof(char) passed
+161: error in "test_BOOST_CHECK": check false failed
+162: error in "test_BOOST_CHECK": check 1==2 failed
+163: error in "test_BOOST_CHECK": check i==1 failed
+166: info: check i==2 passed
+173: error in "test_BOOST_REQUIRE": not aborted
+175: fatal error in "test_BOOST_REQUIRE": critical check false failed
+179: fatal error in "test_BOOST_REQUIRE": critical check j > 5 failed
+182: info: check j < 5 passed
+182: error in "test_BOOST_REQUIRE": not aborted
+196: info: check 'object size 33 is too small' passed
+213: error in "test_BOOST_CHECK_MESSAGE": Well, may be that what I believe in
+215: error in "test_BOOST_CHECK_MESSAGE": Checking predicate failed. Some explanation
+218: info: check 'Could it fail?' passed
+223: error in "test_BOOST_CHECK_MESSAGE": Comparing 1 and 2: some explanation
+230: fatal error in "test_BOOST_REQUIRE_MESSAGE": Here we should stop
+233: info: check 'That's OK' passed
+233: error in "test_BOOST_REQUIRE_MESSAGE": not aborted
+240: error in "test_BOOST_ERROR": Fail to miss an error
+247: fatal error in "test_BOOST_FAIL": No! No! Show must go on.
+263: error in "test_BOOST_CHECK_THROW": exception my_exception is expected
+266: warning in "test_BOOST_CHECK_THROW": exception my_exception is expected
+269: fatal error in "test_BOOST_CHECK_THROW": exception my_exception is expected
+272: info: check 'exception my_exception is caught' passed
+279: error in "test_BOOST_CHECK_EXCEPTION": incorrect exception my_exception is caught
+282: info: check 'incorrect exception my_exception is caught' passed
+292: error in "test_BOOST_CHECK_NO_THROW": exception thrown by throw my_exception()
+338: error in "test_BOOST_CHECK_EQUAL": check i == j failed [1 != 2]
+344: error in "test_BOOST_CHECK_EQUAL": check str1 == str2 failed [test1 != test12]
+347: error in "test_BOOST_CHECK_EQUAL": check i+1 == j failed [4 != 2]
+350: info: check str1 == str3+1 passed
+359: fatal error in "test_BOOST_CHECK_EQUAL": critical check str1 == str2 failed [test != null string]
+365: warning in "test_BOOST_CHECK_EQUAL": condition b1 == b2 is not satisfied [B(1) != B(2)]
+371: error in "test_BOOST_CHECK_EQUAL": check c1 == c3 failed [C(0,100) != C(1,102)]. Index mismatch
+372: error in "test_BOOST_CHECK_EQUAL": check c1 == c2 failed [C(0,100) != C(0,101)]. Id mismatch
+376: error in "test_BOOST_CHECK_EQUAL": check ch1 == ch2 failed [0xfffffffe != 0xfffffffd]
+387: error in "test_BOOST_CHECK_LOGICAL_EXPR": check ++i != j failed [2 == 2]
+389: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i < j failed [2 >= 2]
+390: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i > j failed [2 <= 2]
+397: error in "test_BOOST_CHECK_LOGICAL_EXPR": check i <= j failed [3 > 2]
+398: error in "test_BOOST_CHECK_LOGICAL_EXPR": check j >= i failed [2 < 3]
+403: error in "test_BOOST_CHECK_LOGICAL_EXPR": check str1 != str2 failed [test1 == test1]
+433: error in "test_BOOST_CHECK_PREDICATE": check is_even( i ) failed for ( 17 )
+436: error in "test_BOOST_CHECK_PREDICATE": check not_equal_to<int>()( i, 17 ) failed for ( 17, 17 )
+442: warning in "test_BOOST_CHECK_PREDICATE": condition moo( 12, i, j ) is not satisfied for ( 12, 17, 15 )
+450: error in "test_BOOST_CHECK_PREDICATE": check compare_lists( l1, l2 ) failed for ( , ). Different sizes [2!=0]
+461: error in "test_BOOST_REQUIRE_PREDICATE": not aborted
+463: fatal error in "test_BOOST_REQUIRE_PREDICATE": critical check less_equal<int>()( arg2, arg1 ) failed for ( 2, 1 )
+484: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+7 } failed.
Mismatch in a position 2: 4 != 3
Mismatch in a position 5: 7 != 6
-480: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+2 } failed.
+485: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+2 } failed.
Collections size mismatch: 7 != 2
-489: error in "test_BOOST_CHECK_BITWISE_EQUAL": check (char)0x06 =.= (char)0x16 failed.
+494: error in "test_BOOST_CHECK_BITWISE_EQUAL": check (char)0x06 =.= (char)0x16 failed.
Mismatch in a position 4
-492: warning in "test_BOOST_CHECK_BITWISE_EQUAL": condition (char)0x26 =.= (char)0x04 is not satisfied.
+497: warning in "test_BOOST_CHECK_BITWISE_EQUAL": condition (char)0x26 =.= (char)0x04 is not satisfied.
Mismatch in a position 1
Mismatch in a position 5
-495: fatal error in "test_BOOST_CHECK_BITWISE_EQUAL": critical check (char)0x26 =.= (int)0x26 failed.
+500: fatal error in "test_BOOST_CHECK_BITWISE_EQUAL": critical check (char)0x26 =.= (int)0x26 failed.
Operands bit sizes mismatch: 8 != 32
still testing
1+1=2
@@ -66,6 +66,6 @@
0x14
20
0: fatal error in "test_BOOST_TEST_CHECKPOINT": C string: some error
-530: last checkpoint: Going to do a silly things
+535: last checkpoint: Going to do a silly things
0: fatal error in "test_BOOST_TEST_PASSPOINT": unknown type
-541: last checkpoint
+546: last checkpoint
Modified: branches/release/libs/test/test/test_fp_comparisons.cpp
==============================================================================
--- branches/release/libs/test/test/test_fp_comparisons.cpp (original)
+++ branches/release/libs/test/test/test_fp_comparisons.cpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -133,6 +133,15 @@
//____________________________________________________________________________//
+BOOST_AUTO_TEST_CASE( test_type_mismatch )
+{
+ BOOST_CHECK_CLOSE_FRACTION( 2, 2.1, 0.06 );
+ BOOST_CHECK_CLOSE( 2.1, 2, 6 );
+ BOOST_CHECK_CLOSE( 2.1, 2.f, 6 );
+}
+
+//____________________________________________________________________________//
+
BOOST_AUTO_TEST_CASE( test_CHECK_SMALL )
{
BOOST_CHECK_SMALL( 1e-6, 1e-5 );
Modified: branches/release/libs/test/test/test_tools_test.cpp
==============================================================================
--- branches/release/libs/test/test/test_tools_test.cpp (original)
+++ branches/release/libs/test/test/test_tools_test.cpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -31,6 +31,11 @@
#include <iostream>
#include <iomanip>
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4702) // unreachable code
+#endif
+
using namespace boost::unit_test;
using namespace boost::test_tools;
Modified: branches/release/libs/test/test/token_iterator_test.cpp
==============================================================================
--- branches/release/libs/test/test/token_iterator_test.cpp (original)
+++ branches/release/libs/test/test/token_iterator_test.cpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -153,7 +153,7 @@
moo( utf::make_range_token_iterator( b, e, (utf::kept_delimeters = utf::dt_isspace, utf::dropped_delimeters = "2" )) );
}
-inline char loo( char c ) { return (std::toupper)( c ); }
+inline char loo( char c ) { return (char)(std::toupper)( c ); }
BOOST_AUTO_TEST_CASE( test_make_range_token_iterator )
{
Modified: branches/release/libs/test/tools/console_test_runner/src/console_test_runner.cpp
==============================================================================
--- branches/release/libs/test/tools/console_test_runner/src/console_test_runner.cpp (original)
+++ branches/release/libs/test/tools/console_test_runner/src/console_test_runner.cpp 2009-07-04 02:36:59 EDT (Sat, 04 Jul 2009)
@@ -154,7 +154,7 @@
init_func = dyn_lib::locate_symbol<init_func_ptr>( test_lib_handle, init_func_name );
if( !init_func )
- throw std::logic_error( std::string("Couldn't locate test initilization function ")
+ throw std::logic_error( std::string("Can't locate test initilization function ")
.append( init_func_name )
.append( ": " )
.append( dyn_lib::error() ) );
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk