summaryrefslogtreecommitdiff
path: root/boost/test
diff options
context:
space:
mode:
Diffstat (limited to 'boost/test')
-rw-r--r--boost/test/auto_unit_test.hpp12
-rw-r--r--boost/test/data/config.hpp48
-rw-r--r--boost/test/data/dataset.hpp19
-rw-r--r--boost/test/data/generators.hpp19
-rw-r--r--boost/test/data/monomorphic.hpp26
-rw-r--r--boost/test/data/monomorphic/array.hpp113
-rw-r--r--boost/test/data/monomorphic/collection.hpp125
-rw-r--r--boost/test/data/monomorphic/dataset.hpp174
-rw-r--r--boost/test/data/monomorphic/fwd.hpp314
-rw-r--r--boost/test/data/monomorphic/generate.hpp116
-rw-r--r--boost/test/data/monomorphic/generators.hpp20
-rw-r--r--boost/test/data/monomorphic/generators/keywords.hpp39
-rw-r--r--boost/test/data/monomorphic/generators/random.hpp198
-rw-r--r--boost/test/data/monomorphic/generators/xrange.hpp221
-rw-r--r--boost/test/data/monomorphic/grid.hpp226
-rw-r--r--boost/test/data/monomorphic/join.hpp194
-rw-r--r--boost/test/data/monomorphic/singleton.hpp137
-rw-r--r--boost/test/data/monomorphic/zip.hpp240
-rw-r--r--boost/test/data/size.hpp145
-rw-r--r--boost/test/data/test_case.hpp195
-rw-r--r--boost/test/debug.hpp111
-rw-r--r--boost/test/debug_config.hpp14
-rw-r--r--boost/test/detail/config.hpp39
-rw-r--r--boost/test/detail/enable_warnings.hpp19
-rw-r--r--boost/test/detail/fwd_decl.hpp11
-rw-r--r--boost/test/detail/global_typedef.hpp54
-rw-r--r--boost/test/detail/log_level.hpp11
-rw-r--r--boost/test/detail/pp_variadic.hpp49
-rw-r--r--boost/test/detail/suppress_warnings.hpp19
-rw-r--r--boost/test/detail/throw_exception.hpp69
-rw-r--r--boost/test/detail/unit_test_parameters.hpp69
-rw-r--r--boost/test/detail/workaround.hpp19
-rw-r--r--boost/test/exception_safety.hpp187
-rw-r--r--boost/test/execution_monitor.hpp523
-rw-r--r--boost/test/floating_point_comparison.hpp284
-rw-r--r--boost/test/framework.hpp236
-rw-r--r--boost/test/impl/compiler_log_formatter.ipp119
-rw-r--r--boost/test/impl/cpp_main.ipp41
-rw-r--r--boost/test/impl/debug.ipp73
-rw-r--r--boost/test/impl/decorator.ipp202
-rw-r--r--boost/test/impl/exception_safety.ipp537
-rw-r--r--boost/test/impl/execution_monitor.ipp635
-rw-r--r--boost/test/impl/framework.ipp1076
-rw-r--r--boost/test/impl/interaction_based.ipp90
-rw-r--r--boost/test/impl/logged_expectations.ipp246
-rw-r--r--boost/test/impl/plain_report_formatter.ipp103
-rw-r--r--boost/test/impl/progress_monitor.ipp89
-rw-r--r--boost/test/impl/results_collector.ipp126
-rw-r--r--boost/test/impl/results_reporter.ipp22
-rw-r--r--boost/test/impl/test_main.ipp21
-rw-r--r--boost/test/impl/test_tools.ipp431
-rw-r--r--boost/test/impl/test_tree.ipp459
-rw-r--r--boost/test/impl/unit_test_log.ipp89
-rw-r--r--boost/test/impl/unit_test_main.ipp288
-rw-r--r--boost/test/impl/unit_test_monitor.ipp42
-rw-r--r--boost/test/impl/unit_test_parameters.ipp379
-rw-r--r--boost/test/impl/unit_test_suite.ipp346
-rw-r--r--boost/test/impl/xml_log_formatter.ipp82
-rw-r--r--boost/test/impl/xml_report_formatter.ipp29
-rw-r--r--boost/test/included/execution_monitor.hpp21
-rw-r--r--boost/test/included/prg_exec_monitor.hpp4
-rw-r--r--boost/test/included/test_exec_monitor.hpp13
-rw-r--r--boost/test/included/unit_test.hpp17
-rw-r--r--boost/test/included/unit_test_framework.hpp12
-rw-r--r--boost/test/interaction_based.hpp262
-rw-r--r--boost/test/logged_expectations.hpp74
-rw-r--r--boost/test/minimal.hpp39
-rw-r--r--boost/test/mock_object.hpp328
-rw-r--r--boost/test/output/compiler_log_formatter.hpp19
-rw-r--r--boost/test/output/plain_report_formatter.hpp10
-rw-r--r--boost/test/output/xml_log_formatter.hpp22
-rw-r--r--boost/test/output/xml_report_formatter.hpp12
-rw-r--r--boost/test/output_test_stream.hpp76
-rw-r--r--boost/test/parameterized_test.hpp85
-rw-r--r--boost/test/predicate_result.hpp86
-rw-r--r--boost/test/prg_exec_monitor.hpp35
-rw-r--r--boost/test/progress_monitor.hpp42
-rw-r--r--boost/test/results_collector.hpp80
-rw-r--r--boost/test/results_reporter.hpp72
-rw-r--r--boost/test/test_case_template.hpp12
-rw-r--r--boost/test/test_exec_monitor.hpp33
-rw-r--r--boost/test/test_tools.hpp736
-rw-r--r--boost/test/tools/assertion.hpp407
-rw-r--r--boost/test/tools/assertion_result.hpp90
-rw-r--r--boost/test/tools/collection_comparison_op.hpp375
-rw-r--r--boost/test/tools/context.hpp65
-rw-r--r--boost/test/tools/cstring_comparison_op.hpp91
-rw-r--r--boost/test/tools/detail/bitwise_manip.hpp123
-rw-r--r--boost/test/tools/detail/expression_holder.hpp70
-rw-r--r--boost/test/tools/detail/fwd.hpp121
-rw-r--r--boost/test/tools/detail/indirections.hpp94
-rw-r--r--boost/test/tools/detail/it_pair.hpp74
-rw-r--r--boost/test/tools/detail/lexicographic_manip.hpp69
-rw-r--r--boost/test/tools/detail/per_element_manip.hpp69
-rw-r--r--boost/test/tools/detail/print_helper.hpp199
-rw-r--r--boost/test/tools/detail/tolerance_manip.hpp130
-rw-r--r--boost/test/tools/floating_point_comparison.hpp315
-rw-r--r--boost/test/tools/fpc_op.hpp224
-rw-r--r--boost/test/tools/fpc_tolerance.hpp103
-rw-r--r--boost/test/tools/interface.hpp376
-rw-r--r--boost/test/tools/old/impl.hpp358
-rw-r--r--boost/test/tools/old/interface.hpp278
-rw-r--r--boost/test/tools/output_test_stream.hpp96
-rw-r--r--boost/test/tree/auto_registration.hpp53
-rw-r--r--boost/test/tree/decorator.hpp277
-rw-r--r--boost/test/tree/fixture.hpp116
-rw-r--r--boost/test/tree/global_fixture.hpp68
-rw-r--r--boost/test/tree/observer.hpp (renamed from boost/test/test_observer.hpp)33
-rw-r--r--boost/test/tree/test_case_counter.hpp54
-rw-r--r--boost/test/tree/test_case_template.hpp144
-rw-r--r--boost/test/tree/test_unit.hpp275
-rw-r--r--boost/test/tree/traverse.hpp58
-rw-r--r--boost/test/tree/visitor.hpp52
-rw-r--r--boost/test/unit_test.hpp20
-rw-r--r--boost/test/unit_test_log.hpp47
-rw-r--r--boost/test/unit_test_log_formatter.hpp213
-rw-r--r--boost/test/unit_test_monitor.hpp37
-rw-r--r--boost/test/unit_test_parameters.hpp92
-rw-r--r--boost/test/unit_test_suite.hpp230
-rw-r--r--boost/test/unit_test_suite_impl.hpp434
-rw-r--r--boost/test/utils/algorithm.hpp61
-rw-r--r--boost/test/utils/assign_op.hpp12
-rw-r--r--boost/test/utils/basic_cstring/basic_cstring.hpp149
-rw-r--r--boost/test/utils/basic_cstring/basic_cstring_fwd.hpp12
-rw-r--r--boost/test/utils/basic_cstring/bcs_char_traits.hpp18
-rw-r--r--boost/test/utils/basic_cstring/compare.hpp50
-rw-r--r--boost/test/utils/basic_cstring/io.hpp8
-rw-r--r--boost/test/utils/callback.hpp310
-rw-r--r--boost/test/utils/class_properties.hpp38
-rw-r--r--boost/test/utils/custom_manip.hpp14
-rw-r--r--boost/test/utils/fixed_mapping.hpp14
-rw-r--r--boost/test/utils/foreach.hpp61
-rw-r--r--boost/test/utils/is_cstring.hpp58
-rw-r--r--boost/test/utils/is_forward_iterable.hpp152
-rw-r--r--boost/test/utils/iterator/ifstream_line_iterator.hpp13
-rw-r--r--boost/test/utils/iterator/input_iterator_facade.hpp19
-rw-r--r--boost/test/utils/iterator/istream_line_iterator.hpp14
-rw-r--r--boost/test/utils/iterator/token_iterator.hpp28
-rw-r--r--boost/test/utils/lazy_ostream.hpp74
-rw-r--r--boost/test/utils/named_params.hpp101
-rw-r--r--boost/test/utils/nullstream.hpp15
-rw-r--r--boost/test/utils/rtti.hpp15
-rw-r--r--boost/test/utils/runtime/argument.hpp14
-rw-r--r--boost/test/utils/runtime/cla/argument_factory.hpp62
-rw-r--r--boost/test/utils/runtime/cla/argv_traverser.cpp8
-rw-r--r--boost/test/utils/runtime/cla/argv_traverser.hpp24
-rw-r--r--boost/test/utils/runtime/cla/argv_traverser.ipp61
-rw-r--r--boost/test/utils/runtime/cla/basic_parameter.hpp20
-rw-r--r--boost/test/utils/runtime/cla/char_parameter.cpp8
-rw-r--r--boost/test/utils/runtime/cla/char_parameter.hpp28
-rw-r--r--boost/test/utils/runtime/cla/char_parameter.ipp24
-rw-r--r--boost/test/utils/runtime/cla/detail/argument_value_usage.hpp29
-rw-r--r--boost/test/utils/runtime/cla/dual_name_parameter.cpp8
-rw-r--r--boost/test/utils/runtime/cla/dual_name_parameter.hpp26
-rw-r--r--boost/test/utils/runtime/cla/dual_name_parameter.ipp32
-rw-r--r--boost/test/utils/runtime/cla/fwd.hpp16
-rw-r--r--boost/test/utils/runtime/cla/id_policy.cpp8
-rw-r--r--boost/test/utils/runtime/cla/id_policy.hpp30
-rw-r--r--boost/test/utils/runtime/cla/id_policy.ipp34
-rw-r--r--boost/test/utils/runtime/cla/iface/argument_factory.hpp16
-rw-r--r--boost/test/utils/runtime/cla/iface/id_policy.hpp12
-rw-r--r--boost/test/utils/runtime/cla/modifier.hpp16
-rw-r--r--boost/test/utils/runtime/cla/named_parameter.cpp8
-rw-r--r--boost/test/utils/runtime/cla/named_parameter.hpp28
-rw-r--r--boost/test/utils/runtime/cla/named_parameter.ipp40
-rw-r--r--boost/test/utils/runtime/cla/parameter.hpp29
-rw-r--r--boost/test/utils/runtime/cla/parser.cpp10
-rw-r--r--boost/test/utils/runtime/cla/parser.hpp29
-rw-r--r--boost/test/utils/runtime/cla/parser.ipp109
-rw-r--r--boost/test/utils/runtime/cla/positional_parameter.hpp26
-rw-r--r--boost/test/utils/runtime/cla/typed_parameter.hpp24
-rw-r--r--boost/test/utils/runtime/cla/validation.cpp8
-rw-r--r--boost/test/utils/runtime/cla/validation.hpp28
-rw-r--r--boost/test/utils/runtime/cla/validation.ipp40
-rw-r--r--boost/test/utils/runtime/cla/value_generator.hpp16
-rw-r--r--boost/test/utils/runtime/cla/value_handler.hpp16
-rw-r--r--boost/test/utils/runtime/config.hpp66
-rw-r--r--boost/test/utils/runtime/configuration.hpp14
-rw-r--r--boost/test/utils/runtime/env/environment.cpp10
-rw-r--r--boost/test/utils/runtime/env/environment.hpp31
-rw-r--r--boost/test/utils/runtime/env/environment.ipp52
-rw-r--r--boost/test/utils/runtime/env/fwd.hpp21
-rw-r--r--boost/test/utils/runtime/env/modifier.hpp12
-rw-r--r--boost/test/utils/runtime/env/variable.hpp22
-rw-r--r--boost/test/utils/runtime/file/config_file.cpp22
-rw-r--r--boost/test/utils/runtime/file/config_file.hpp22
-rw-r--r--boost/test/utils/runtime/file/config_file_iterator.cpp152
-rw-r--r--boost/test/utils/runtime/file/config_file_iterator.hpp22
-rw-r--r--boost/test/utils/runtime/fwd.hpp14
-rw-r--r--boost/test/utils/runtime/interpret_argument_value.hpp42
-rw-r--r--boost/test/utils/runtime/parameter.hpp14
-rw-r--r--boost/test/utils/runtime/trace.hpp16
-rw-r--r--boost/test/utils/runtime/validation.hpp37
-rw-r--r--boost/test/utils/setcolor.hpp117
-rw-r--r--boost/test/utils/trivial_singleton.hpp33
-rw-r--r--boost/test/utils/wrap_stringstream.hpp16
-rw-r--r--boost/test/utils/xml_printer.hpp34
197 files changed, 13759 insertions, 6973 deletions
diff --git a/boost/test/auto_unit_test.hpp b/boost/test/auto_unit_test.hpp
index c99316888e..df41743962 100644
--- a/boost/test/auto_unit_test.hpp
+++ b/boost/test/auto_unit_test.hpp
@@ -1,15 +1,13 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : deprecated
+//! @file
+//! @brief Deprecated header.
+//! @deprecated Use @c boost/test/unit_test.hpp instead.
// ***************************************************************************
#ifndef BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER
diff --git a/boost/test/data/config.hpp b/boost/test/data/config.hpp
new file mode 100644
index 0000000000..bedfae5de0
--- /dev/null
+++ b/boost/test/data/config.hpp
@@ -0,0 +1,48 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief common dataset macros
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_CONFIG_HPP_112611GER
+#define BOOST_TEST_DATA_CONFIG_HPP_112611GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/detail/throw_exception.hpp>
+
+// STL
+#include <stdexcept> // for std::logic_error
+
+
+// availability on features: preprocessed by doxygen
+
+#if defined(BOOST_NO_CXX11_HDR_RANDOM) || defined(BOOST_TEST_DOXYGEN_DOC__)
+//! Defined when the random dataset feature is not available
+#define BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE
+
+#endif
+
+
+#if defined(BOOST_NO_CXX11_HDR_TUPLE) || defined(BOOST_TEST_DOXYGEN_DOC__)
+
+//! Defined when grid composition of datasets is not available
+#define BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE
+
+//! Defined when zip composition of datasets is not available
+#define BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE
+
+#endif
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_DS_ERROR( msg ) BOOST_TEST_IMPL_THROW( std::logic_error( msg ) )
+#define BOOST_TEST_DS_ASSERT( cond, msg ) if( cond ) {} else BOOST_TEST_DS_ERROR( msg )
+
+#endif // BOOST_TEST_DATA_CONFIG_HPP_112611GER
+
diff --git a/boost/test/data/dataset.hpp b/boost/test/data/dataset.hpp
new file mode 100644
index 0000000000..390cf5bf3f
--- /dev/null
+++ b/boost/test/data/dataset.hpp
@@ -0,0 +1,19 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief dataset interfaces
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_DATASET_HPP_102211GER
+#define BOOST_TEST_DATA_DATASET_HPP_102211GER
+
+// Boost.Test
+#include <boost/test/data/monomorphic.hpp>
+
+#endif // BOOST_TEST_DATA_DATASET_HPP_102211GER
+
diff --git a/boost/test/data/generators.hpp b/boost/test/data/generators.hpp
new file mode 100644
index 0000000000..ff8ad07400
--- /dev/null
+++ b/boost/test/data/generators.hpp
@@ -0,0 +1,19 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief specific generators
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
+#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
+
+// Boost.Test
+#include <boost/test/data/monomorphic/generators/xrange.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
+
diff --git a/boost/test/data/monomorphic.hpp b/boost/test/data/monomorphic.hpp
new file mode 100644
index 0000000000..487b2a9cce
--- /dev/null
+++ b/boost/test/data/monomorphic.hpp
@@ -0,0 +1,26 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief Monomorphic dataset interfaces
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER
+#define BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER
+
+// Boost.Test
+#include <boost/test/data/monomorphic/array.hpp>
+#include <boost/test/data/monomorphic/collection.hpp>
+#include <boost/test/data/monomorphic/generate.hpp>
+#include <boost/test/data/monomorphic/generators.hpp>
+#include <boost/test/data/monomorphic/grid.hpp>
+#include <boost/test/data/monomorphic/join.hpp>
+#include <boost/test/data/monomorphic/singleton.hpp>
+#include <boost/test/data/monomorphic/zip.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER
+
diff --git a/boost/test/data/monomorphic/array.hpp b/boost/test/data/monomorphic/array.hpp
new file mode 100644
index 0000000000..87c55e7653
--- /dev/null
+++ b/boost/test/data/monomorphic/array.hpp
@@ -0,0 +1,113 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+///@file
+///Defines monomorphic dataset based on C type arrays
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
+#define BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/monomorphic/dataset.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+// ************************************************************************** //
+// ************** array ************** //
+// ************************************************************************** //
+
+/// Dataset view of an C array
+template<typename T>
+class array : public monomorphic::dataset<T> {
+ typedef monomorphic::dataset<T> base;
+ typedef typename base::iter_ptr iter_ptr;
+
+ struct iterator : public base::iterator {
+ // Constructor
+ explicit iterator( T const* begin, data::size_t size )
+ : m_it( begin )
+ , m_singleton( size == 1 )
+ {}
+
+ // forward iterator interface
+ virtual T const& operator*() { return *m_it; }
+ virtual void operator++() { if( !m_singleton ) ++m_it; }
+
+ private:
+ // Data members
+ T const* m_it;
+ bool m_singleton;
+ };
+
+public:
+ enum { arity = 1 };
+
+ // Constructor
+ array( T const* arr, std::size_t size )
+ : m_arr( arr )
+ , m_size( size )
+ {}
+
+ // dataset interface
+ virtual data::size_t size() const { return m_size; }
+ virtual iter_ptr begin() const { return boost::make_shared<iterator>( m_arr, m_size ); }
+
+private:
+ // Data members
+ T const* m_arr;
+ std::size_t m_size;
+};
+
+//____________________________________________________________________________//
+
+//! An array dataset is a dataset
+template<typename T>
+struct is_dataset<array<T> > : mpl::true_ {};
+
+} // namespace monomorphic
+
+
+//! @overload boost::unit_test::data::make()
+template<typename T, std::size_t size>
+inline monomorphic::array< typename boost::remove_const<T>::type > make( T (&a)[size] )
+{
+ return monomorphic::array< typename boost::remove_const<T>::type >( a, size );
+}
+
+//! @overload boost::unit_test::data::make()
+template<typename T, std::size_t size>
+inline monomorphic::array< typename boost::remove_const<T>::type > make( T const (&a)[size] )
+{
+ return monomorphic::array<T>( a, size );
+}
+
+template<typename T, std::size_t size>
+inline monomorphic::array< typename boost::remove_const<T>::type > make( T a[size] )
+{
+ return monomorphic::array<T>( a, size );
+}
+
+
+//____________________________________________________________________________//
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
+
diff --git a/boost/test/data/monomorphic/collection.hpp b/boost/test/data/monomorphic/collection.hpp
new file mode 100644
index 0000000000..5666a62f8d
--- /dev/null
+++ b/boost/test/data/monomorphic/collection.hpp
@@ -0,0 +1,125 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+///@file
+///Defines monomorphic dataset based on forward iterable sequence
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER
+#define BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/monomorphic/dataset.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+// ************************************************************************** //
+// ************** collection ************** //
+// ************************************************************************** //
+
+
+//!@brief Dataset from a forward iterable container (collection)
+//!
+//! This dataset is applicable to any container implementing a forward iterator. Note that
+//! container with one element will be considered as singletons.
+//! This dataset is constructible with the @ref boost::unit_test::data::make function.
+//!
+//! For compilers supporting r-value references, the collection is moved instead of copied.
+template<typename C>
+class collection : public monomorphic::dataset<typename boost::decay<C>::type::value_type> {
+ typedef typename boost::decay<C>::type col_type;
+ typedef typename col_type::value_type T;
+ typedef monomorphic::dataset<T> base;
+ typedef typename base::iter_ptr iter_ptr;
+
+ struct iterator : public base::iterator {
+ // Constructor
+ explicit iterator( collection<C> const& owner )
+ : m_iter( owner.col().begin() )
+ , m_singleton( owner.col().size() == 1 )
+ {}
+
+ // forward iterator interface
+ virtual T const& operator*() { return *m_iter; }
+ virtual void operator++() { if( !m_singleton ) ++m_iter; }
+
+ private:
+ // Data members
+ typename col_type::const_iterator m_iter;
+ bool m_singleton;
+ };
+
+public:
+ enum { arity = 1 };
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ //! Constructor
+ //! The collection is moved
+ explicit collection( C&& col ) : m_col( std::forward<C>(col) ) {}
+
+ //! Move constructor
+ collection( collection&& c ) : m_col( std::forward<C>( c.m_col ) ) {}
+#else
+ //! Constructor
+ //! The collection is copied
+ explicit collection( C const& col ) : m_col( col ) {}
+#endif
+
+ //! Returns the underlying collection
+ C const& col() const { return m_col; }
+
+ // dataset interface
+ virtual data::size_t size() const { return m_col.size(); }
+ virtual iter_ptr begin() const { return boost::make_shared<iterator>( *this ); }
+
+private:
+ // Data members
+ C m_col;
+};
+
+//____________________________________________________________________________//
+
+//! A collection from a forward iterable container is a dataset.
+template<typename C>
+struct is_dataset<collection<C> > : mpl::true_ {};
+
+} // namespace monomorphic
+
+//! @overload boost::unit_test::data::make()
+template<typename C>
+inline typename BOOST_TEST_ENABLE_IF<is_forward_iterable<C>::value,
+ monomorphic::collection<C> >::type
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+make( C&& c )
+{
+ return monomorphic::collection<C>( std::forward<C>(c) );
+}
+#else
+make( C const& c )
+{
+ return monomorphic::collection<C>( c );
+}
+#endif
+
+//____________________________________________________________________________//
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER
+
diff --git a/boost/test/data/monomorphic/dataset.hpp b/boost/test/data/monomorphic/dataset.hpp
new file mode 100644
index 0000000000..122dbea8c5
--- /dev/null
+++ b/boost/test/data/monomorphic/dataset.hpp
@@ -0,0 +1,174 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Defines monomorphic dataset interface
+//
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_DATASET_HPP_102211GER
+#define BOOST_TEST_DATA_MONOMORPHIC_DATASET_HPP_102211GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/monomorphic/fwd.hpp>
+
+// STL
+#ifndef BOOST_NO_CXX11_HDR_TUPLE
+#include <tuple>
+#endif
+//#include <stdexcept>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+// ************************************************************************** //
+// ************** monomorphic::traits ************** //
+// ************************************************************************** //
+
+template<typename T>
+struct traits {
+ // type of the reference to sample returned by iterator
+ typedef T const& ref_type;
+
+ template<typename Action>
+ static void
+ invoke_action( ref_type arg, Action const& action )
+ {
+ action( arg );
+ }
+};
+
+//____________________________________________________________________________//
+
+#ifndef BOOST_NO_CXX11_HDR_TUPLE
+// !! ?? reimplement using variadics
+template<typename T1, typename T2>
+struct traits<std::tuple<T1,T2>> {
+ // type of the reference to sample returned by iterator
+ typedef std::tuple<T1 const&,T2 const&> ref_type;
+
+ template<typename Action>
+ static void
+ invoke_action( ref_type arg, Action const& action )
+ {
+ action( std::get<0>(arg), std::get<1>(arg) );
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename T1, typename T2, typename T3>
+struct traits<std::tuple<T1,T2,T3>> {
+ // type of the reference to sample returned by iterator
+ typedef std::tuple<T1 const&,T2 const&,T3 const&> ref_type;
+
+ template<typename Action>
+ static void
+ invoke_action( ref_type arg, Action const& action )
+ {
+ action( std::get<0>(arg), std::get<1>(arg), std::get<2>(arg) );
+ }
+};
+
+//____________________________________________________________________________//
+
+#endif
+
+// ************************************************************************** //
+// ************** monomorphic::dataset ************** //
+// ************************************************************************** //
+
+//!@brief Dataset base class
+//!
+//! This class defines the dataset concept, which is an implementation of a sequence.
+//! Each dataset should implement
+//! - the @c size
+//! - the @c begin function, which provides a forward iterator on the beginning of the sequence. The returned
+//! iterator should be incrementable a number of times corresponding to the returned size.
+//!
+template<typename T>
+class dataset {
+public:
+ //! Type of the samples in this dataset
+ typedef T data_type;
+
+ virtual ~dataset()
+ {}
+
+ //! Interface of the dataset iterator
+ class iterator {
+ public:
+ typedef typename monomorphic::traits<T>::ref_type ref_type;
+
+ virtual ~iterator() {}
+
+ // forward iterator interface
+ virtual ref_type operator*() = 0;
+ virtual void operator++() = 0;
+ };
+
+ //! Type of the iterator
+ typedef boost::shared_ptr<iterator> iter_ptr;
+
+ //! Dataset size
+ virtual data::size_t size() const = 0;
+
+ //! Iterator to use to iterate over this dataset
+ virtual iter_ptr begin() const = 0;
+};
+
+} // namespace monomorphic
+
+// ************************************************************************** //
+// ************** for_each_sample ************** //
+// ************************************************************************** //
+
+template<typename SampleType, typename Action>
+inline void
+for_each_sample( monomorphic::dataset<SampleType> const& ds,
+ Action const& act,
+ data::size_t number_of_samples = BOOST_TEST_DS_INFINITE_SIZE )
+{
+ data::size_t size = (std::min)( ds.size(), number_of_samples );
+ BOOST_TEST_DS_ASSERT( !size.is_inf(), "Dataset has infinite size. Please specify the number of samples" );
+
+ typename monomorphic::dataset<SampleType>::iter_ptr it = ds.begin();
+
+ while( size-- > 0 ) {
+ monomorphic::traits<SampleType>::invoke_action( **it, act );
+ ++(*it);
+ }
+}
+
+//____________________________________________________________________________//
+
+template<typename SampleType, typename Action>
+inline typename BOOST_TEST_ENABLE_IF<!monomorphic::is_dataset<SampleType>::value,void>::type
+for_each_sample( SampleType const& samples,
+ Action const& act,
+ data::size_t number_of_samples = BOOST_TEST_DS_INFINITE_SIZE )
+{
+ data::for_each_sample( data::make( samples ), act, number_of_samples );
+}
+
+//____________________________________________________________________________//
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_DATASET_HPP_102211GER
+
diff --git a/boost/test/data/monomorphic/fwd.hpp b/boost/test/data/monomorphic/fwd.hpp
new file mode 100644
index 0000000000..9ff4955432
--- /dev/null
+++ b/boost/test/data/monomorphic/fwd.hpp
@@ -0,0 +1,314 @@
+// (C) Copyright Gennadiy Rozental 2012-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Forward declares monomorphic datasets interfaces
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER
+#define BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/size.hpp>
+
+#include <boost/test/utils/is_forward_iterable.hpp>
+
+
+// Boost
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/add_const.hpp>
+#else
+#include <boost/utility/declval.hpp>
+#endif
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/type_traits/decay.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+
+namespace monomorphic {
+
+
+#if !defined(BOOST_TEST_DOXYGEN_DOC__)
+template<typename T>
+struct traits;
+
+template<typename T>
+class dataset;
+
+template<typename T>
+class singleton;
+
+template<typename C>
+class collection;
+
+template<typename T>
+class array;
+#endif
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# define BOOST_TEST_ENABLE_IF std::enable_if
+#else
+# define BOOST_TEST_ENABLE_IF boost::enable_if_c
+#endif
+
+// ************************************************************************** //
+// ************** monomorphic::is_dataset ************** //
+// ************************************************************************** //
+
+//! Helper metafunction indicating if the specified type is a dataset.
+template<typename DataSet>
+struct is_dataset : mpl::false_ {};
+
+//! A reference to a dataset is a dataset
+template<typename DataSet>
+struct is_dataset<DataSet&> : is_dataset<DataSet> {};
+
+//! A const dataset is a dataset
+template<typename DataSet>
+struct is_dataset<DataSet const> : is_dataset<DataSet> {};
+
+//____________________________________________________________________________//
+
+} // namespace monomorphic
+
+// ************************************************************************** //
+// ************** data::make ************** //
+// ************************************************************************** //
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+
+
+//! @brief Creates a dataset from a value, a collection or an array
+//!
+//! This function has several overloads:
+//! @code
+//! // returns ds if ds is already a dataset
+//! template <typename DataSet> DataSet make(DataSet&& ds);
+//!
+//! // creates a singleton dataset, for non forward iterable and non dataset type T
+//! // (a C string is not considered as a sequence).
+//! template <typename T> monomorphic::singleton<T> make(T&& v);
+//! monomorphic::singleton<char*> make( char* str );
+//! monomorphic::singleton<char const*> make( char const* str );
+//!
+//! // creates a collection dataset, for forward iterable and non dataset type C
+//! template <typename C> monomorphic::collection<C> make(C && c);
+//!
+//! // creates an array dataset
+//! template<typename T, std::size_t size> monomorphic::array<T> make( T (&a)[size] );
+//! @endcode
+template<typename DataSet>
+inline typename BOOST_TEST_ENABLE_IF<monomorphic::is_dataset<DataSet>::value,DataSet>::type
+make(DataSet&& ds)
+{
+ return std::forward<DataSet>( ds );
+}
+
+
+// warning: doxygen is apparently unable to handle @overload from different files, so if the overloads
+// below are not declared with @overload in THIS file, they do not appear in the documentation.
+
+// fwrd declaration for singletons
+//! @overload boost::unit_test::data::make()
+template<typename T>
+inline typename BOOST_TEST_ENABLE_IF<!is_forward_iterable<T>::value &&
+ !monomorphic::is_dataset<T>::value &&
+ !boost::is_array< typename boost::remove_reference<T>::type >::value,
+ monomorphic::singleton<T> >::type
+make( T&& v );
+
+
+//! @overload boost::unit_test::data::make()
+template<typename C>
+inline typename BOOST_TEST_ENABLE_IF<is_forward_iterable<C>::value,
+ monomorphic::collection<C> >::type
+make( C&& c );
+
+
+#else // !BOOST_NO_CXX11_RVALUE_REFERENCES
+
+//! @overload boost::unit_test:data::make()
+template<typename DataSet>
+inline typename BOOST_TEST_ENABLE_IF<monomorphic::is_dataset<DataSet>::value,DataSet const&>::type
+make(DataSet const& ds)
+{
+ return ds;
+}
+
+
+// fwrd declaration for singletons
+#if !(defined(BOOST_MSVC) && (BOOST_MSVC < 1600))
+//! @overload boost::unit_test::data::make()
+template<typename T>
+inline typename BOOST_TEST_ENABLE_IF<!is_forward_iterable<T>::value &&
+ !monomorphic::is_dataset<T>::value &&
+ !boost::is_array< typename boost::remove_reference<T>::type >::value,
+ monomorphic::singleton<T> >::type
+make( T const& v );
+#endif
+
+
+// fwrd declaration for collections
+//! @overload boost::unit_test::data::make()
+template<typename C>
+inline typename BOOST_TEST_ENABLE_IF<is_forward_iterable<C>::value,
+ monomorphic::collection<C> >::type
+make( C const& c );
+
+//____________________________________________________________________________//
+
+
+
+#endif // !BOOST_NO_CXX11_RVALUE_REFERENCES
+
+
+
+
+// fwrd declarations
+//! @overload boost::unit_test::data::make()
+template<typename T, std::size_t size>
+inline monomorphic::array< typename boost::remove_const<T>::type >
+make( T (&a)[size] );
+
+// apparently some compilers (eg clang-3.4 on linux) have trouble understanding
+// the previous line for T being const
+//! @overload boost::unit_test::data::make()
+template<typename T, std::size_t size>
+inline monomorphic::array< typename boost::remove_const<T>::type >
+make( T const (&)[size] );
+
+template<typename T, std::size_t size>
+inline monomorphic::array< typename boost::remove_const<T>::type >
+make( T a[size] );
+
+
+
+//! @overload boost::unit_test::data::make()
+inline monomorphic::singleton<char*>
+make( char* str );
+
+//! @overload boost::unit_test::data::make()
+inline monomorphic::singleton<char const*>
+make( char const* str );
+
+
+
+//____________________________________________________________________________//
+
+
+
+namespace result_of {
+
+#ifndef BOOST_NO_CXX11_DECLTYPE
+//! Result of the make call.
+template<typename DataSet>
+struct make
+{
+ typedef decltype(data::make(boost::declval<DataSet>())) type;
+};
+#else
+
+// explicit specialisation, cumbersome
+
+template <typename DataSet, typename Enable = void>
+struct make;
+
+template <typename DataSet>
+struct make<
+ DataSet const&,
+ typename BOOST_TEST_ENABLE_IF<monomorphic::is_dataset<DataSet>::value>::type
+ >
+{
+ typedef DataSet const& type;
+};
+
+template <typename T>
+struct make<
+ T,
+ typename BOOST_TEST_ENABLE_IF< (!is_forward_iterable<T>::value &&
+ !monomorphic::is_dataset<T>::value &&
+ !boost::is_array< typename boost::remove_reference<T>::type >::value)
+ >::type
+ >
+{
+ typedef monomorphic::singleton<T> type;
+};
+
+template <typename C>
+struct make<
+ C,
+ typename BOOST_TEST_ENABLE_IF< is_forward_iterable<C>::value>::type
+ >
+{
+ typedef monomorphic::collection<C> type;
+};
+
+#if 1
+template <typename T, std::size_t size>
+struct make<T [size]>
+{
+ typedef monomorphic::array<typename boost::remove_const<T>::type> type;
+};
+#endif
+
+template <typename T, std::size_t size>
+struct make<T (&)[size]>
+{
+ typedef monomorphic::array<typename boost::remove_const<T>::type> type;
+};
+
+template <typename T, std::size_t size>
+struct make<T const (&)[size]>
+{
+ typedef monomorphic::array<typename boost::remove_const<T>::type> type;
+};
+
+template <>
+struct make<char*>
+{
+ typedef monomorphic::singleton<char*> type;
+};
+
+template <>
+struct make<char const*>
+{
+ typedef monomorphic::singleton<char const*> type;
+};
+
+#endif // BOOST_NO_CXX11_DECLTYPE
+
+
+} // namespace result_of
+
+
+
+
+//____________________________________________________________________________//
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+
+
+
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER
+
diff --git a/boost/test/data/monomorphic/generate.hpp b/boost/test/data/monomorphic/generate.hpp
new file mode 100644
index 0000000000..c5ff1d699b
--- /dev/null
+++ b/boost/test/data/monomorphic/generate.hpp
@@ -0,0 +1,116 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Defines generic interface for monomorphic dataset based on generator
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER
+#define BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/monomorphic/dataset.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+// ************************************************************************** //
+// ************** generated_by ************** //
+// ************************************************************************** //
+
+/*!@brief Generators interface
+ *
+ * This class implements the dataset concept over a generator. Examples of generators are:
+ * - xrange_t
+ * - random_t
+ *
+ * The generator concept is the following:
+ * - the type of the generated samples is given by field @c data_type
+ * - the member function @c capacity should return the size of the collection being generated (potentially infinite)
+ * - the member function @c next should change the state of the generator to the next generated value
+ * - the member function @c reset should put the state of the object in the same state as right after its instanciation
+ */
+template<typename Generator>
+class generated_by : public monomorphic::dataset<typename Generator::data_type> {
+ typedef typename Generator::data_type T;
+ typedef monomorphic::dataset<T> base;
+ typedef typename base::iter_ptr iter_ptr;
+
+ struct iterator : public base::iterator {
+ // Constructor
+ explicit iterator( Generator& gen )
+ : m_gen( gen )
+ {
+ if(m_gen.capacity() > 0) {
+ m_gen.reset();
+ ++*this;
+ }
+ }
+
+ // forward iterator interface
+ virtual T const& operator*() { return m_curr_sample; }
+ virtual void operator++() { m_curr_sample = m_gen.next(); }
+
+ private:
+ // Data members
+ Generator& m_gen;
+ T m_curr_sample;
+ };
+public:
+ enum { arity = 1 };
+ typedef Generator generator_type;
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ // Constructor
+ explicit generated_by( Generator&& G )
+ : m_generator( std::forward<Generator>(G) )
+ {}
+
+ // Move constructor
+ generated_by( generated_by&& rhs )
+ : m_generator( std::forward<Generator>(rhs.m_generator) )
+ {}
+#else
+ // Constructor
+ explicit generated_by( Generator const& G )
+ : m_generator( G )
+ {}
+#endif
+
+ //! Size of the underlying dataset
+ data::size_t size() const { return m_generator.capacity(); }
+
+ //! Iterator on the beginning of the dataset
+ virtual iter_ptr begin() const { return boost::make_shared<iterator>( boost::ref(const_cast<Generator&>(m_generator)) ); }
+
+private:
+ // Data members
+ Generator m_generator;
+};
+
+
+//! A generated dataset is a dataset.
+template<typename Generator>
+struct is_dataset<generated_by<Generator> > : mpl::true_ {};
+
+
+} // namespace monomorphic
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER
+
diff --git a/boost/test/data/monomorphic/generators.hpp b/boost/test/data/monomorphic/generators.hpp
new file mode 100644
index 0000000000..aa74d7abb1
--- /dev/null
+++ b/boost/test/data/monomorphic/generators.hpp
@@ -0,0 +1,20 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+///@file
+///Defines specific generators
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
+#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
+
+// Boost.Test
+#include <boost/test/data/monomorphic/generators/xrange.hpp>
+#include <boost/test/data/monomorphic/generators/random.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER
+
diff --git a/boost/test/data/monomorphic/generators/keywords.hpp b/boost/test/data/monomorphic/generators/keywords.hpp
new file mode 100644
index 0000000000..4983678f95
--- /dev/null
+++ b/boost/test/data/monomorphic/generators/keywords.hpp
@@ -0,0 +1,39 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+///@file
+/// Keywords used in generator interfaces
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER
+#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/utils/named_params.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+
+namespace {
+nfp::keyword<struct begin_t> begin;
+nfp::keyword<struct end_t> end;
+nfp::keyword<struct step_t> step;
+} // local namespace
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER
diff --git a/boost/test/data/monomorphic/generators/random.hpp b/boost/test/data/monomorphic/generators/random.hpp
new file mode 100644
index 0000000000..a82eef103d
--- /dev/null
+++ b/boost/test/data/monomorphic/generators/random.hpp
@@ -0,0 +1,198 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief Random generator
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER
+#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+
+
+
+
+#if !defined(BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__)
+
+#include <boost/test/data/monomorphic/generate.hpp>
+#include <boost/test/data/monomorphic/generators/keywords.hpp>
+
+// STL
+#include <random>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+
+namespace {
+nfp::keyword<struct seed_t> seed;
+nfp::keyword<struct distrbution_t> distribution;
+nfp::keyword<struct engine_t> engine;
+} // local namespace
+
+namespace monomorphic {
+
+namespace ds_detail {
+template<typename SampleType>
+struct default_distribution {
+ typedef typename mpl::if_<std::is_integral<SampleType>,
+ std::uniform_int_distribution<SampleType>,
+ std::uniform_real_distribution<SampleType> >::type type;
+};
+
+} // namespace ds_detail
+
+// ************************************************************************** //
+// ************** random_t ************** //
+// ************************************************************************** //
+
+/*!@brief Generator for the random sequences
+ *
+ * This class implements the generator concept (see @ref boost::unit_test::data::monomorphic::generated_by) for implementing
+ * a random number generator.
+ */
+template<typename SampleType = double,
+ typename DistributionType = typename ds_detail::default_distribution<SampleType>::type,
+ typename EngineType = std::default_random_engine>
+class random_t {
+public:
+ typedef SampleType data_type;
+ typedef DistributionType distr_type;
+ typedef EngineType engine_type;
+
+ random_t()
+ : m_distribution()
+ , m_engine( std::random_device()() )
+ {}
+ explicit random_t( distr_type&& d )
+ : m_distribution( std::forward<distr_type>(d) )
+ , m_engine( std::random_device()() ){}
+ random_t( engine_type&& e, distr_type&& d )
+ : m_distribution( std::forward<distr_type>(d) )
+ , m_engine( std::forward<engine_type>(e) ){}
+
+ // Generator interface
+ data::size_t capacity() const { return BOOST_TEST_DS_INFINITE_SIZE; }
+ SampleType next()
+ {
+ return m_distribution( m_engine );
+ }
+ void reset() {}
+
+ //! Sets the seed of the pseudo-random number engine.
+ template<typename SeedType>
+ void seed( SeedType&& seed ) { m_engine.seed( std::forward<SeedType>( seed ) ); }
+
+private:
+ // Data members
+ DistributionType m_distribution;
+ EngineType m_engine;
+};
+
+//____________________________________________________________________________//
+
+} // namespace monomorphic
+
+
+//! @brief Returns an infinite sequence of random numbers.
+//!
+//! The following overloads are available:
+//! @code
+//! auto d = random();
+//! auto d = random(begin, end);
+//! auto d = random(params);
+//! @endcode
+//!
+//!
+//! - The first overload uses the default distribution, which is uniform and which elements
+//! are @c double type (the values are in [0, 1) ).
+//! - The second overload generates numbers in the given interval. The distribution is uniform (in [begin, end)
+//! for real numbers, and in [begin, end] for integers). The type of the distribution is deduced from the type
+//! of the @c begin and @c end parameters.
+//! - The third overload generates numbers using the named parameter inside @c params , which are:
+//! - @c distribution: the distribution used. In this overload, since the type of the samples cannot be deduced,
+//! the samples are of type @c double and the distribution is uniform real in [0, 1).
+//! - @c seed: the seed for generating the values
+//! - @c engine: the random number generator engine
+//!
+//! The function returns an object that implements the dataset API.
+//! @note This function is available only for C++11 capable compilers.
+inline monomorphic::generated_by< monomorphic::random_t<> > random()
+{
+ return monomorphic::generated_by<monomorphic::random_t<>>( monomorphic::random_t<>() );
+}
+
+//____________________________________________________________________________//
+
+/// @overload boost::unit_test::data::random()
+template<typename SampleType>
+inline monomorphic::generated_by< monomorphic::random_t<SampleType> >
+random( SampleType begin, SampleType end )
+{
+ typedef monomorphic::random_t<SampleType> Gen;
+ typedef typename Gen::distr_type distr_type;
+ return monomorphic::generated_by<Gen>( Gen( distr_type(begin,end) ) );
+}
+
+//____________________________________________________________________________//
+
+namespace ds_detail {
+template<typename Params>
+struct random_gen_type {
+ typedef typename nfp::param_type<Params,decltype(distribution),std::uniform_real_distribution<>>::type distr_type;
+ typedef typename nfp::param_type<Params,decltype(engine),std::default_random_engine>::type engine_type;
+ typedef typename distr_type::result_type sample_type;
+
+ typedef monomorphic::random_t<sample_type,distr_type,engine_type> type;
+};
+
+}
+
+
+/// @overload boost::unit_test::data::random()
+template<typename Params>
+inline monomorphic::generated_by<typename ds_detail::random_gen_type<Params>::type>
+random( Params const& params )
+{
+ typedef typename ds_detail::random_gen_type<Params>::type Gen;
+ typedef typename Gen::distr_type distr_type;
+ typedef typename Gen::engine_type engine_type;
+
+ std::random_device rd;
+ engine_type E;
+// engine_type E( rd );
+ if( params.has(engine) )
+ E = params[engine];
+
+ distr_type D;
+ if( params.has(distribution) )
+ D = params[distribution];
+
+ Gen G( std::move(E), std::move(D) );
+
+ if( params.has(seed) )
+ G.seed( params[seed] );
+
+ return monomorphic::generated_by<Gen>( std::move(G) );
+}
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE
+
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER
diff --git a/boost/test/data/monomorphic/generators/xrange.hpp b/boost/test/data/monomorphic/generators/xrange.hpp
new file mode 100644
index 0000000000..55a51110b4
--- /dev/null
+++ b/boost/test/data/monomorphic/generators/xrange.hpp
@@ -0,0 +1,221 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+///@file
+///Defines range generator
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER
+#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+
+#include <boost/test/data/monomorphic/generators/keywords.hpp>
+#include <boost/test/data/monomorphic/generate.hpp>
+
+// Boost
+#include <boost/optional.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_unsigned.hpp>
+
+// STL
+#include <limits>
+#include <cmath>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+// ************************************************************************** //
+// ************** monomorphic::xrange_t ************** //
+// ************************************************************************** //
+
+
+/*!@brief Generator for the range sequences
+ *
+ * This class implements the generator concept (see @ref boost::unit_test::data::monomorphic::generated_by) for implementing
+ * a range like sequence of numbers.
+ */
+template<typename SampleType, typename StepType=SampleType>
+class xrange_t {
+public:
+ typedef SampleType data_type;
+
+ xrange_t( SampleType const& begin, StepType const& step, data::size_t size )
+ : m_begin( begin )
+ , m_curr( begin )
+ , m_step( step )
+ , m_index( 0 )
+ , m_size( size )
+ {}
+
+ // Generator interface
+ data::size_t capacity() const { return m_size; }
+ SampleType next()
+ {
+ if( m_index == m_size )
+ return m_curr;
+
+ SampleType res = m_curr;
+
+ m_curr += m_step;
+ ++m_index;
+
+ return res;
+ }
+ void reset()
+ {
+ m_curr = m_begin;
+ m_index = 0;
+ }
+
+private:
+ // Data members
+ SampleType m_begin;
+ SampleType m_curr;
+ StepType m_step;
+ data::size_t m_index;
+ data::size_t m_size;
+};
+
+//____________________________________________________________________________//
+
+namespace ds_detail {
+
+template<typename SampleType, typename StepType=SampleType>
+struct make_xrange {
+ static StepType abs( StepType s, boost::true_type* ) { return s; }
+ static StepType abs( StepType s, boost::false_type* ) { return std::abs(s); }
+
+ typedef xrange_t<SampleType, StepType> range_gen;
+
+ template<typename Params>
+ static generated_by<range_gen>
+ _( Params const& params )
+ {
+ SampleType begin_val = params.has( data::begin ) ? params[data::begin] : SampleType();
+ optional<SampleType> end_val = params.has( data::end ) ? params[data::end] : optional<SampleType>();
+ StepType step_val = params.has( data::step ) ? params[data::step] : 1;
+
+ BOOST_TEST_DS_ASSERT( step_val != 0, "Range step can't be zero" );
+
+ data::size_t size;
+ if( !end_val.is_initialized() )
+ size = BOOST_TEST_DS_INFINITE_SIZE;
+ else {
+ BOOST_TEST_DS_ASSERT( (step_val < 0) ^ (begin_val < *end_val), "Invalid step direction" );
+
+ SampleType abs_distance = step_val < 0 ? begin_val - *end_val : *end_val-begin_val;
+ StepType abs_step = make_xrange::abs(step_val, (typename boost::is_unsigned<StepType>::type*)0 );
+ std::size_t s = static_cast<std::size_t>(abs_distance/abs_step);
+
+ if( static_cast<SampleType>(s*abs_step) < abs_distance )
+ s++;
+
+ size = s;
+ }
+
+ return generated_by<range_gen>( range_gen( begin_val, step_val, size ) );
+ }
+};
+
+} // namespace ds_detail
+} // namespace monomorphic
+
+//____________________________________________________________________________//
+
+//! Creates a range (sequence) dataset.
+//!
+//! The following overloads are available:
+//! @code
+//! auto d = xrange();
+//! auto d = xrange(end_val);
+//! auto d = xrange(end_val, param);
+//! auto d = xrange(begin_val, end_val);
+//! auto d = xrange(begin_val, end_val, step_val);
+//! auto d = xrange(param);
+//! @endcode
+//!
+//! - @c begin_val indicates the start of the sequence (default to 0).
+//! - @c end_val is the end of the sequence. If ommited, the dataset has infinite size.\n
+//! - @c step_val is the step between two consecutive elements of the sequence, and defaults to 1.\n
+//! - @c param is the named parameters that describe the sequence. The following parameters are accepted:
+//! - @c begin: same meaning @c begin_val
+//! - @c end: same meaning as @c end_val
+//! - @c step: same meaning as @c step_val
+//!
+//!
+//! The returned value is an object that implements the dataset API.
+//!
+//! @note the step size cannot be null, and it should be positive if @c begin_val < @c end_val, negative otherwise.
+template<typename SampleType, typename Params>
+inline monomorphic::generated_by<monomorphic::xrange_t<SampleType> >
+xrange( Params const& params )
+{
+ return monomorphic::ds_detail::make_xrange<SampleType>::_( params );
+}
+
+//____________________________________________________________________________//
+
+/// @overload boost::unit_test::data::xrange()
+template<typename SampleType>
+inline monomorphic::generated_by<monomorphic::xrange_t<SampleType> >
+xrange( SampleType const& end_val )
+{
+ return monomorphic::ds_detail::make_xrange<SampleType>::_( data::end=end_val );
+}
+
+//____________________________________________________________________________//
+
+/// @overload boost::unit_test::data::xrange()
+template<typename SampleType, typename Params>
+inline typename enable_if_c<nfp::is_named_params<Params>::value,monomorphic::generated_by<monomorphic::xrange_t<SampleType> > >::type
+xrange( SampleType const& end_val, Params const& params )
+{
+ return monomorphic::ds_detail::make_xrange<SampleType>::
+ _(( params, data::end=end_val ));
+}
+
+//____________________________________________________________________________//
+
+/// @overload boost::unit_test::data::xrange()
+template<typename SampleType>
+inline monomorphic::generated_by<monomorphic::xrange_t<SampleType> >
+xrange( SampleType const& begin_val, SampleType const& end_val )
+{
+ return monomorphic::ds_detail::make_xrange<SampleType>::
+ _(( data::begin=begin_val, data::end=end_val ));
+}
+
+//____________________________________________________________________________//
+
+
+
+/// @overload boost::unit_test::data::xrange()
+template<typename SampleType,typename StepType>
+inline monomorphic::generated_by<monomorphic::xrange_t<SampleType> >
+xrange( SampleType const& begin_val, SampleType const& end_val, StepType const& step_val )
+{
+ return monomorphic::ds_detail::make_xrange<SampleType,StepType>::
+ _(( data::begin=begin_val, data::end=end_val, data::step=step_val ));
+}
+
+//____________________________________________________________________________//
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER
diff --git a/boost/test/data/monomorphic/grid.hpp b/boost/test/data/monomorphic/grid.hpp
new file mode 100644
index 0000000000..00aaa56cd1
--- /dev/null
+++ b/boost/test/data/monomorphic/grid.hpp
@@ -0,0 +1,226 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+///@file
+/// Defines monomorphic dataset n+m dimentional *. Samples in this
+/// dataset is grid of elements in DS1 and DS2. There will be total
+/// |DS1| * |DS2| samples
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER
+#define BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+
+
+#if !defined(BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__)
+
+#include <boost/test/data/monomorphic/dataset.hpp>
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+namespace ds_detail {
+
+// !! ?? variadic template implementation; use forward_as_tuple?
+template<typename T1, typename T2>
+struct grid_traits {
+ typedef std::tuple<T1,T2> type;
+ typedef typename monomorphic::traits<type>::ref_type ref_type;
+
+ static ref_type
+ tuple_merge(T1 const& a1, T2 const& a2)
+ {
+ return ref_type(a1,a2);
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename T1, typename T2,typename T3>
+struct grid_traits<T1,std::tuple<T2,T3>> {
+ typedef std::tuple<T1,T2,T3> type;
+ typedef typename monomorphic::traits<type>::ref_type ref_type;
+
+ static ref_type
+ tuple_merge(T1 const& a1, std::tuple<T2 const&,T3 const&> const& a2)
+ {
+ return ref_type(a1,get<0>(a2),get<1>(a2));
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename T1, typename T2,typename T3>
+struct grid_traits<std::tuple<T1,T2>,T3> {
+ typedef std::tuple<T1,T2,T3> type;
+ typedef typename monomorphic::traits<type>::ref_type ref_type;
+
+ static ref_type
+ tuple_merge(std::tuple<T1 const&,T2 const&> const& a1, T3 const& a2)
+ {
+ return ref_type(get<0>(a1),get<1>(a1),a2);
+ }
+};
+
+//____________________________________________________________________________//
+
+} // namespace ds_detail
+
+// ************************************************************************** //
+// ************** grid ************** //
+// ************************************************************************** //
+
+
+//! Implements the dataset resulting from a cartesian product/grid operation on datasets.
+//!
+//! The arity of the resulting dataset is the sum of the arity of its operands.
+template<typename DS1, typename DS2>
+class grid : public monomorphic::dataset<typename ds_detail::grid_traits<typename boost::decay<DS1>::type::data_type,
+ typename boost::decay<DS2>::type::data_type>::type> {
+ typedef typename boost::decay<DS1>::type::data_type T1;
+ typedef typename boost::decay<DS2>::type::data_type T2;
+
+ typedef typename monomorphic::dataset<T1>::iter_ptr ds1_iter_ptr;
+ typedef typename monomorphic::dataset<T2>::iter_ptr ds2_iter_ptr;
+
+ typedef typename ds_detail::grid_traits<T1,T2>::type T;
+ typedef monomorphic::dataset<T> base;
+ typedef typename base::iter_ptr iter_ptr;
+
+ struct iterator : public base::iterator {
+ typedef typename monomorphic::traits<T>::ref_type ref_type;
+
+ // Constructor
+ explicit iterator( ds1_iter_ptr iter1, DS2 const& ds2 )
+ : m_iter1( iter1 )
+ , m_iter2( ds2.begin() )
+ , m_ds2( ds2 )
+ , m_ds2_pos( 0 )
+ {}
+
+ // forward iterator interface
+ virtual ref_type operator*() { return ds_detail::grid_traits<T1,T2>::tuple_merge( **m_iter1, **m_iter2 ); }
+ virtual void operator++()
+ {
+ ++m_ds2_pos;
+ if( m_ds2_pos != m_ds2.size() )
+ ++(*m_iter2);
+ else {
+ m_ds2_pos = 0;
+ ++(*m_iter1);
+ m_iter2 = m_ds2.begin();
+ }
+ }
+
+ private:
+ // Data members
+ ds1_iter_ptr m_iter1;
+ ds2_iter_ptr m_iter2;
+ DS2 const& m_ds2;
+ data::size_t m_ds2_pos;
+ };
+
+public:
+ enum { arity = boost::decay<DS1>::type::arity + boost::decay<DS2>::type::arity };
+
+ //! Constructor
+ grid( DS1&& ds1, DS2&& ds2 )
+ : m_ds1( std::forward<DS1>( ds1 ) )
+ , m_ds2( std::forward<DS2>( ds2 ) )
+ {}
+
+ //! Move constructor
+ grid( grid&& j )
+ : m_ds1( std::forward<DS1>( j.m_ds1 ) )
+ , m_ds2( std::forward<DS2>( j.m_ds2 ) )
+ {}
+
+ // dataset interface
+ virtual data::size_t size() const { return m_ds1.size() * m_ds2.size(); }
+ virtual iter_ptr begin() const { return boost::make_shared<iterator>( m_ds1.begin(), m_ds2 ); }
+
+private:
+ // Data members
+ DS1 m_ds1;
+ DS2 m_ds2;
+};
+
+//____________________________________________________________________________//
+
+// A grid dataset is a dataset
+template<typename DS1, typename DS2>
+struct is_dataset<grid<DS1,DS2> > : mpl::true_ {};
+
+//____________________________________________________________________________//
+
+namespace result_of {
+
+/// Result type of the grid operation on dataset.
+template<typename DS1Gen, typename DS2Gen>
+struct grid {
+ typedef monomorphic::grid<typename DS1Gen::type,typename DS2Gen::type> type;
+};
+
+} // namespace result_of
+
+//____________________________________________________________________________//
+
+
+
+//! Grid operation
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<is_dataset<DS1>::value && is_dataset<DS2>::value,
+ result_of::grid<mpl::identity<DS1>,mpl::identity<DS2>>
+>::type
+operator*( DS1&& ds1, DS2&& ds2 )
+{
+ BOOST_TEST_DS_ASSERT( !ds1.size().is_inf() && !ds2.size().is_inf(), "Grid dimension can't have infinite size" );
+
+ return grid<DS1,DS2>( std::forward<DS1>( ds1 ), std::forward<DS2>( ds2 ) );
+}
+
+//! @overload boost::unit_test::data::operator*
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<is_dataset<DS1>::value && !is_dataset<DS2>::value,
+ result_of::grid<mpl::identity<DS1>,data::result_of::make<DS2>>
+>::type
+operator*( DS1&& ds1, DS2&& ds2 )
+{
+ return std::forward<DS1>(ds1) * data::make(std::forward<DS2>(ds2));
+}
+
+//! @overload boost::unit_test::data::operator*
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<!is_dataset<DS1>::value && is_dataset<DS2>::value,
+ result_of::grid<data::result_of::make<DS1>,mpl::identity<DS2>>
+>::type
+operator*( DS1&& ds1, DS2&& ds2 )
+{
+ return data::make(std::forward<DS1>(ds1)) * std::forward<DS2>(ds2);
+}
+
+//____________________________________________________________________________//
+
+} // namespace monomorphic
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER
+
diff --git a/boost/test/data/monomorphic/join.hpp b/boost/test/data/monomorphic/join.hpp
new file mode 100644
index 0000000000..94b25c78e2
--- /dev/null
+++ b/boost/test/data/monomorphic/join.hpp
@@ -0,0 +1,194 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//! @file
+//! Defines dataset join operation
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER
+#define BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/monomorphic/dataset.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+// ************************************************************************** //
+// ************** join ************** //
+// ************************************************************************** //
+
+//! Defines a new dataset from the concatenation of two datasets
+//!
+//! The size of the resulting dataset is the sum of the two underlying datasets. The arity of the datasets
+//! should match.
+template<typename DS1, typename DS2>
+class join : public monomorphic::dataset<typename boost::decay<DS1>::type::data_type> {
+ typedef typename boost::decay<DS1>::type::data_type T;
+ typedef monomorphic::dataset<T> base;
+ typedef typename base::iter_ptr iter_ptr;
+
+ struct iterator : public base::iterator {
+ // Constructor
+ explicit iterator( iter_ptr it1, iter_ptr it2, data::size_t first_size )
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ : m_it1( std::move(it1) )
+ , m_it2( std::move(it2) )
+#else
+ : m_it1( it1 )
+ , m_it2( it2 )
+#endif
+ , m_first_size( first_size )
+ {}
+
+ // forward iterator interface
+ virtual T const& operator*() { return m_first_size > 0 ? **m_it1 : **m_it2; }
+ virtual void operator++() { m_first_size > 0 ? (--m_first_size,++(*m_it1)) : ++(*m_it2); }
+
+ private:
+ // Data members
+ iter_ptr m_it1;
+ iter_ptr m_it2;
+ data::size_t m_first_size;
+ };
+
+public:
+ enum { arity = boost::decay<DS1>::type::arity };
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ // Constructor
+ join( DS1&& ds1, DS2&& ds2 )
+ : m_ds1( std::forward<DS1>( ds1 ) )
+ , m_ds2( std::forward<DS2>( ds2 ) )
+ {}
+
+ // Move constructor
+ join( join&& j )
+ : m_ds1( std::forward<DS1>( j.m_ds1 ) )
+ , m_ds2( std::forward<DS2>( j.m_ds2 ) )
+ {}
+#else
+ // Constructor
+ join( DS1 const& ds1, DS2 const& ds2 )
+ : m_ds1( ds1 )
+ , m_ds2( ds2 )
+ {}
+#endif
+
+ // dataset interface
+ virtual data::size_t size() const { return m_ds1.size() + m_ds2.size(); }
+ virtual iter_ptr begin() const { return boost::make_shared<iterator>( m_ds1.begin(),
+ m_ds2.begin(),
+ m_ds1.size() ); }
+
+private:
+ // Data members
+ DS1 m_ds1;
+ DS2 m_ds2;
+};
+
+//____________________________________________________________________________//
+
+// A joined dataset is a dataset.
+template<typename DS1, typename DS2>
+struct is_dataset<join<DS1,DS2> > : mpl::true_ {};
+
+//____________________________________________________________________________//
+
+namespace result_of {
+
+//! Result type of the join operation on datasets.
+template<typename DS1Gen, typename DS2Gen>
+struct join {
+ typedef monomorphic::join<typename DS1Gen::type,typename DS2Gen::type> type;
+};
+
+} // namespace result_of
+
+//____________________________________________________________________________//
+
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<is_dataset<DS1>::value && is_dataset<DS2>::value,
+ result_of::join<mpl::identity<DS1>,mpl::identity<DS2> >
+>::type
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+operator+( DS1&& ds1, DS2&& ds2 )
+{
+ return join<DS1,DS2>( std::forward<DS1>( ds1 ), std::forward<DS2>( ds2 ) );
+}
+#else
+operator+( DS1 const& ds1, DS2 const& ds2 )
+{
+ return join<DS1,DS2>( ds1, ds2 );
+}
+#endif
+
+//____________________________________________________________________________//
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<is_dataset<DS1>::value && !is_dataset<DS2>::value,
+ result_of::join<mpl::identity<DS1>,data::result_of::make<DS2> >
+>::type
+operator+( DS1&& ds1, DS2&& ds2 )
+{
+ return std::forward<DS1>(ds1) + data::make(std::forward<DS2>(ds2));
+}
+#else
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<is_dataset<DS1>::value && !is_dataset<DS2>::value,
+ result_of::join<mpl::identity<DS1>,data::result_of::make<DS2> >
+>::type
+operator+( DS1 const& ds1, DS2 const& ds2 )
+{
+ return ds1 + data::make(ds2);
+}
+#endif
+
+//____________________________________________________________________________//
+
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<!is_dataset<DS1>::value && is_dataset<DS2>::value,
+ result_of::join<data::result_of::make<DS1>,mpl::identity<DS2> >
+>::type
+operator+( DS1&& ds1, DS2&& ds2 )
+{
+ return data::make(std::forward<DS1>(ds1)) + std::forward<DS2>(ds2);
+}
+#else
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<!is_dataset<DS1>::value && is_dataset<DS2>::value,
+ result_of::join<data::result_of::make<DS1>,mpl::identity<DS2> >
+>::type
+operator+( DS1 const& ds1, DS2 const& ds2 )
+{
+ return data::make(ds1) + ds2;
+}
+
+#endif
+
+
+} // namespace monomorphic
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER
+
diff --git a/boost/test/data/monomorphic/singleton.hpp b/boost/test/data/monomorphic/singleton.hpp
new file mode 100644
index 0000000000..4d305c2546
--- /dev/null
+++ b/boost/test/data/monomorphic/singleton.hpp
@@ -0,0 +1,137 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Defines single element monomorphic dataset
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER
+#define BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/monomorphic/dataset.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+// ************************************************************************** //
+// ************** singleton ************** //
+// ************************************************************************** //
+
+/// Models a single element data set
+template<typename T>
+class singleton : public monomorphic::dataset<typename boost::decay<T>::type> {
+ typedef monomorphic::dataset<typename boost::decay<T>::type> base;
+ typedef typename base::iter_ptr iter_ptr;
+
+ struct iterator : public base::iterator {
+ // Constructor
+ explicit iterator( singleton<T> const& owner )
+ : m_owner( owner )
+ {}
+
+ // forward iterator interface
+ virtual typename base::data_type const&
+ operator*() { return m_owner.value(); }
+ virtual void operator++() {}
+
+ private:
+ singleton<T> const& m_owner;
+ };
+
+public:
+ enum { arity = 1 };
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ //! Constructor
+ explicit singleton( T&& value ) : m_value( std::forward<T>( value ) ) {}
+
+ //! Move constructor
+ singleton( singleton&& s ) : m_value( std::forward<T>( s.m_value ) ) {}
+#else
+ // Constructor
+ explicit singleton( T const& value ) : m_value( value ) {}
+#endif
+
+ // Access methods
+ T const& value() const { return m_value; }
+
+ // dataset interface
+ virtual data::size_t size() const { return 1; }
+ virtual iter_ptr begin() const { return boost::make_shared<iterator>( *this ); }
+
+private:
+ // Data members
+ T m_value;
+};
+
+// a singleton is a dataset
+template<typename T>
+struct is_dataset<singleton<T> > : mpl::true_ {};
+
+} // namespace monomorphic
+
+
+
+/// @overload boost::unit_test::data::make()
+template<typename T>
+inline typename BOOST_TEST_ENABLE_IF<!is_forward_iterable<T>::value &&
+ !monomorphic::is_dataset<T>::value &&
+ !boost::is_array< typename boost::remove_reference<T>::type >::value,
+ monomorphic::singleton<T>
+>::type
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+make( T&& v )
+{
+ return monomorphic::singleton<T>( std::forward<T>( v ) );
+}
+#else
+make( T const& v )
+{
+ return monomorphic::singleton<T>( v );
+}
+#endif
+
+
+/// @overload boost::unit_test::data::make
+inline monomorphic::singleton<char*> make( char* str )
+{
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ return monomorphic::singleton<char*>( std::move(str) );
+#else
+ return monomorphic::singleton<char*>( str );
+#endif
+}
+
+
+/// @overload boost::unit_test::data::make
+inline monomorphic::singleton<char const*> make( char const* str )
+{
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ return monomorphic::singleton<char const*>( std::move(str) );
+#else
+ return monomorphic::singleton<char const*>( str );
+#endif
+}
+
+
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER
+
diff --git a/boost/test/data/monomorphic/zip.hpp b/boost/test/data/monomorphic/zip.hpp
new file mode 100644
index 0000000000..3ee91817a9
--- /dev/null
+++ b/boost/test/data/monomorphic/zip.hpp
@@ -0,0 +1,240 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Defines monomorphic dataset based on zipping of 2 other monomorphic datasets
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER
+#define BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER
+
+#include <boost/test/data/config.hpp>
+
+#if !defined(BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__)
+
+// Boost.Test
+#include <boost/test/data/monomorphic/dataset.hpp>
+#include <boost/test/detail/suppress_warnings.hpp>
+
+
+namespace boost {
+namespace unit_test {
+namespace data {
+namespace monomorphic {
+
+namespace ds_detail {
+
+
+//____________________________________________________________________________//
+
+// !! ?? variadic template implementation; use forward_as_tuple?
+template<typename T1, typename T2>
+struct zip_traits {
+ typedef std::tuple<T1,T2> type;
+ typedef typename monomorphic::traits<type>::ref_type ref_type;
+
+ static ref_type
+ tuple_merge(T1 const& a1, T2 const& a2)
+ {
+ return ref_type(a1,a2);
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename T1, typename T2,typename T3>
+struct zip_traits<T1,std::tuple<T2,T3>> {
+ typedef std::tuple<T1,T2,T3> type;
+ typedef typename monomorphic::traits<type>::ref_type ref_type;
+
+ static ref_type
+ tuple_merge(T1 const& a1, std::tuple<T2 const&,T3 const&> const& a2)
+ {
+ return ref_type(a1,std::get<0>(a2),std::get<1>(a2));
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename T1, typename T2,typename T3>
+struct zip_traits<std::tuple<T1,T2>,T3> {
+ typedef std::tuple<T1,T2,T3> type;
+ typedef typename monomorphic::traits<type>::ref_type ref_type;
+
+ static ref_type
+ tuple_merge(std::tuple<T1 const&,T2 const&> const& a1, T3 const& a2)
+ {
+ return ref_type(std::get<0>(a1),std::get<1>(a1),a2);
+ }
+};
+
+//____________________________________________________________________________//
+
+} // namespace ds_detail
+
+// ************************************************************************** //
+// ************** zip ************** //
+// ************************************************************************** //
+
+//! Zip datasets
+//!
+//! A zip of two datasets is a dataset whose arity is the sum of the operand datasets arity. The size is given by
+//! the function creating the instance (see @c operator^ on datasets).
+template<typename DS1, typename DS2>
+class zip : public monomorphic::dataset<typename ds_detail::zip_traits<typename boost::decay<DS1>::type::data_type,
+ typename boost::decay<DS2>::type::data_type>::type> {
+ typedef typename boost::decay<DS1>::type::data_type T1;
+ typedef typename boost::decay<DS2>::type::data_type T2;
+
+ typedef typename monomorphic::dataset<T1>::iter_ptr ds1_iter_ptr;
+ typedef typename monomorphic::dataset<T2>::iter_ptr ds2_iter_ptr;
+
+ typedef typename ds_detail::zip_traits<T1,T2>::type T;
+ typedef monomorphic::dataset<T> base;
+ typedef typename base::iter_ptr iter_ptr;
+
+ struct iterator : public base::iterator {
+ typedef typename monomorphic::traits<T>::ref_type ref_type;
+
+ // Constructor
+ explicit iterator( ds1_iter_ptr iter1, ds2_iter_ptr iter2 )
+ : m_iter1( iter1 )
+ , m_iter2( iter2 )
+ {}
+
+ // forward iterator interface
+ virtual ref_type operator*() { return ds_detail::zip_traits<T1,T2>::tuple_merge( **m_iter1, **m_iter2 ); }
+ virtual void operator++() { ++(*m_iter1); ++(*m_iter2); }
+
+ private:
+ // Data members
+ ds1_iter_ptr m_iter1;
+ ds2_iter_ptr m_iter2;
+ };
+
+public:
+ enum { arity = boost::decay<DS1>::type::arity + boost::decay<DS2>::type::arity };
+
+ //! Constructor
+ //!
+ //! The datasets are moved and not copied.
+ zip( DS1&& ds1, DS2&& ds2, data::size_t size )
+ : m_ds1( std::forward<DS1>( ds1 ) )
+ , m_ds2( std::forward<DS2>( ds2 ) )
+ , m_size( size )
+ {}
+
+ //! Move constructor
+ zip( zip&& j )
+ : m_ds1( std::forward<DS1>( j.m_ds1 ) )
+ , m_ds2( std::forward<DS2>( j.m_ds2 ) )
+ , m_size( j.m_size )
+ {}
+
+ // dataset interface
+ virtual data::size_t size() const { return m_size; }
+ virtual iter_ptr begin() const { return boost::make_shared<iterator>( m_ds1.begin(), m_ds2.begin() ); }
+
+private:
+ // Data members
+ DS1 m_ds1;
+ DS2 m_ds2;
+ data::size_t m_size;
+};
+
+//____________________________________________________________________________//
+
+//! Zipped datasets results in a dataset.
+template<typename DS1, typename DS2>
+struct is_dataset<zip<DS1,DS2> > : mpl::true_ {};
+
+//____________________________________________________________________________//
+
+namespace ds_detail {
+
+//! Handles the sise of the resulting zipped dataset.
+template<typename DS1, typename DS2>
+inline data::size_t
+zip_size( DS1&& ds1, DS2&& ds2 )
+{
+ data::size_t ds1_size = ds1.size();
+ data::size_t ds2_size = ds2.size();
+
+ if( ds1_size == ds2_size )
+ return ds1_size;
+
+ if( ds1_size == 1 || ds1_size.is_inf() )
+ return ds2_size;
+
+ if( ds2_size == 1 || ds2_size.is_inf() )
+ return ds1_size;
+
+ BOOST_TEST_DS_ERROR( "Can't zip datasets of different sizes" );
+}
+
+} // namespace ds_detail
+
+//____________________________________________________________________________//
+
+namespace result_of {
+
+//! Result type of the zip operator.
+template<typename DS1Gen, typename DS2Gen>
+struct zip {
+ typedef monomorphic::zip<typename DS1Gen::type,typename DS2Gen::type> type;
+};
+
+} // namespace result_of
+
+
+//____________________________________________________________________________//
+
+
+//! Overload operator for zip support
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<is_dataset<DS1>::value && is_dataset<DS2>::value,
+ result_of::zip<mpl::identity<DS1>,mpl::identity<DS2>>
+>::type
+operator^( DS1&& ds1, DS2&& ds2 )
+{
+ return zip<DS1,DS2>( std::forward<DS1>( ds1 ), std::forward<DS2>( ds2 ), ds_detail::zip_size( ds1, ds2 ) );
+}
+
+//! @overload boost::unit_test::data::monomorphic::operator^()
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<is_dataset<DS1>::value && !is_dataset<DS2>::value,
+ result_of::zip<mpl::identity<DS1>,data::result_of::make<DS2>>
+>::type
+operator^( DS1&& ds1, DS2&& ds2 )
+{
+ return std::forward<DS1>(ds1) ^ data::make(std::forward<DS2>(ds2));
+}
+
+//! @overload boost::unit_test::data::monomorphic::operator^()
+template<typename DS1, typename DS2>
+inline typename boost::lazy_enable_if_c<!is_dataset<DS1>::value && is_dataset<DS2>::value,
+ result_of::zip<data::result_of::make<DS1>,mpl::identity<DS2>>
+>::type
+operator^( DS1&& ds1, DS2&& ds2 )
+{
+ return data::make(std::forward<DS1>(ds1)) ^ std::forward<DS2>(ds2);
+}
+
+//____________________________________________________________________________//
+
+} // namespace monomorphic
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE
+
+#endif // BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER
+
diff --git a/boost/test/data/size.hpp b/boost/test/data/size.hpp
new file mode 100644
index 0000000000..ddd725d26c
--- /dev/null
+++ b/boost/test/data/size.hpp
@@ -0,0 +1,145 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief simple dataset size abstraction (can be infinite)
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_SIZE_HPP_102211GER
+#define BOOST_TEST_DATA_SIZE_HPP_102211GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+
+// STL
+#include <iosfwd>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+
+// ************************************************************************** //
+// ************** size_t ************** //
+// ************************************************************************** //
+
+//! Utility for handling the size of a datasets
+class size_t {
+ struct dummy { void nonnull() {} };
+ typedef void (dummy::*safe_bool)();
+public:
+ // Constructors
+ size_t( std::size_t s = 0 ) : m_value( s ), m_infinity( false ) {}
+ explicit size_t( bool ) : m_value( 0 ), m_infinity( true ) {}
+ template<typename T>
+ size_t( T v ) : m_value( static_cast<std::size_t>(v) ), m_infinity( false ) {}
+
+ // Access methods
+ std::size_t value() const { return m_value; }
+ bool is_inf() const { return m_infinity; }
+ operator safe_bool() const { return is_inf() || m_value != 0 ? &dummy::nonnull : 0; }
+
+ // Unary operators
+ data::size_t operator--() { if( !is_inf() ) m_value--; return *this; }
+ data::size_t operator--(int) { data::size_t res(*this); if( !is_inf() ) m_value--; return res; }
+ data::size_t operator++() { if( !is_inf() ) m_value++; return *this; }
+ data::size_t operator++(int) { data::size_t res(*this); if( !is_inf() ) m_value++; return res; }
+
+ // Binary operators
+ data::size_t& operator+=( std::size_t rhs ) { if( !is_inf() ) m_value += rhs; return *this; }
+ data::size_t& operator+=( data::size_t rhs )
+ {
+ if( !is_inf() ) {
+ if( rhs.is_inf() )
+ *this = rhs;
+ else
+ m_value += rhs.value();
+ }
+ return *this;
+ }
+ data::size_t& operator-=( std::size_t rhs ) { if( !is_inf() ) m_value -= rhs; return *this; }
+ data::size_t& operator-=( data::size_t rhs )
+ {
+ if( !is_inf() ) {
+ if( value() < rhs.value() )
+ m_value = 0;
+ else
+ m_value -= rhs.value();
+ }
+ return *this;
+ }
+
+private:
+ // Data members
+ std::size_t m_value;
+ bool m_infinity;
+};
+
+namespace { const data::size_t BOOST_TEST_DS_INFINITE_SIZE( true ); }
+
+//____________________________________________________________________________//
+
+// Binary operators
+inline bool operator>(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() || (lhs.value() > rhs); }
+inline bool operator>(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs > rhs.value()); }
+inline bool operator>(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? lhs.is_inf() : lhs.value() > rhs.value(); }
+
+inline bool operator>=(data::size_t lhs, std::size_t rhs ) { return lhs.is_inf() || (lhs.value() >= rhs); }
+inline bool operator>=(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs >= rhs.value()); }
+inline bool operator>=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? lhs.is_inf() : lhs.value() >= rhs.value(); }
+
+inline bool operator<(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() < rhs); }
+inline bool operator<(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs < rhs.value()); }
+inline bool operator<(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? rhs.is_inf() : lhs.value() < rhs.value(); }
+
+inline bool operator<=(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() <= rhs); }
+inline bool operator<=(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs <= rhs.value()); }
+inline bool operator<=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? rhs.is_inf() : lhs.value() <= rhs.value(); }
+
+inline bool operator==(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() == rhs); }
+inline bool operator==(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs == rhs.value()); }
+inline bool operator==(data::size_t lhs, data::size_t rhs) { return !(lhs.is_inf() ^ rhs.is_inf()) && lhs.value() == rhs.value(); }
+
+inline bool operator!=(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() || (lhs.value() != rhs); }
+inline bool operator!=(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs != rhs.value()); }
+inline bool operator!=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() || lhs.value() != rhs.value(); }
+
+inline data::size_t operator+(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() ? lhs : data::size_t( lhs.value()+rhs ); }
+inline data::size_t operator+(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() ? rhs : data::size_t( lhs+rhs.value() ); }
+inline data::size_t operator+(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() || rhs.is_inf() ? data::size_t(true) : data::size_t( lhs.value()+rhs.value() ); }
+
+inline data::size_t operator*(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() ? lhs : data::size_t( lhs.value()*rhs ); }
+inline data::size_t operator*(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() ? rhs : data::size_t( lhs*rhs.value() ); }
+inline data::size_t operator*(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() || rhs.is_inf() ? data::size_t(true) : data::size_t( lhs.value()*rhs.value() ); }
+
+//____________________________________________________________________________//
+
+template<typename CharT1, typename Tr>
+inline std::basic_ostream<CharT1,Tr>&
+operator<<( std::basic_ostream<CharT1,Tr>& os, data::size_t const& s )
+{
+ if( s.is_inf() )
+ os << "infinity";
+ else
+ os << s.value();
+
+ return os;
+}
+
+//____________________________________________________________________________//
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_SIZE_HPP_102211GER
+
diff --git a/boost/test/data/test_case.hpp b/boost/test/data/test_case.hpp
new file mode 100644
index 0000000000..31a61d92ec
--- /dev/null
+++ b/boost/test/data/test_case.hpp
@@ -0,0 +1,195 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief test case family based on data generator
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DATA_TEST_CASE_HPP_102211GER
+#define BOOST_TEST_DATA_TEST_CASE_HPP_102211GER
+
+// Boost.Test
+#include <boost/test/data/config.hpp>
+#include <boost/test/data/dataset.hpp>
+
+// Boost
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+#include <boost/preprocessor/variadic/to_seq.hpp>
+#include <boost/preprocessor/variadic/size.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/seq/for_each_i.hpp>
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+
+#include <boost/bind.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+#include <boost/test/tools/detail/print_helper.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace data {
+
+// ************************************************************************** //
+// ************** test_case_template ************** //
+// ************************************************************************** //
+
+namespace ds_detail {
+
+template<typename TestCase,typename DataSet>
+class test_case_gen : public test_unit_generator {
+public:
+ // Constructor
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet&& ds )
+ : m_tc_name( ut_detail::normalize_test_case_name( tc_name ) )
+ {
+ data::for_each_sample( std::forward<DataSet>( ds ), *this );
+ }
+ test_case_gen( test_case_gen&& gen )
+ : m_tc_name( gen.m_tc_name )
+ , m_test_cases( std::move(gen.m_test_cases) )
+ {}
+#else
+ test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet const& ds )
+ : m_tc_name( ut_detail::normalize_test_case_name( tc_name ) )
+ {
+ data::for_each_sample( ds, *this );
+ }
+#endif
+
+ 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;
+ }
+
+ // !! ?? variadics based implementation
+#define TC_MAKE(z,arity,_) \
+ template<BOOST_PP_ENUM_PARAMS(arity, typename Arg)> \
+ void operator()( BOOST_PP_ENUM_BINARY_PARAMS(arity, Arg, const& arg) ) const \
+ { \
+ m_test_cases.push_back( new test_case( m_tc_name, m_tc_file, m_tc_line, \
+ boost::bind( &TestCase::template test_method<BOOST_PP_ENUM_PARAMS(arity,Arg)>, \
+ BOOST_PP_ENUM_PARAMS(arity, arg) ) ) ); \
+ } \
+
+ BOOST_PP_REPEAT_FROM_TO(1, 4, TC_MAKE, _)
+
+private:
+ // Data members
+ std::string m_tc_name;
+ const_string m_tc_file;
+ std::size_t m_tc_line;
+ mutable std::list<test_unit*> m_test_cases;
+};
+
+//____________________________________________________________________________//
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+template<typename TestCase,typename DataSet>
+test_case_gen<TestCase,DataSet>
+make_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet&& ds )
+{
+ return test_case_gen<TestCase,DataSet>( tc_name, tc_file, tc_line, std::forward<DataSet>(ds) );
+}
+#else
+template<typename TestCase,typename DataSet>
+test_case_gen<TestCase,DataSet>
+make_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet const& ds )
+{
+ return test_case_gen<TestCase,DataSet>( tc_name, tc_file, tc_line, ds );
+}
+#endif
+
+//____________________________________________________________________________//
+
+} // namespace ds_detail
+
+// ************************************************************************** //
+// ************** BOOST_DATA_TEST_CASE ************** //
+// ************************************************************************** //
+
+#define BOOST_DATA_TEST_CASE_PARAM(r, _, i, param) (BOOST_PP_CAT(Arg, i) const& param)
+#define BOOST_DATA_TEST_CONTEXT(r, _, param) << BOOST_STRINGIZE(param) << " = " << boost::test_tools::tt_detail::print_helper(param) << "; "
+
+#define BOOST_DATA_TEST_CASE_PARAMS( params ) \
+ BOOST_PP_SEQ_ENUM( \
+ BOOST_PP_SEQ_FOR_EACH_I(BOOST_DATA_TEST_CASE_PARAM, _, params)) \
+/**/
+
+#define BOOST_DATA_TEST_CASE_IMPL( arity, test_name, dataset, params ) \
+struct test_name { \
+ template<BOOST_PP_ENUM_PARAMS(arity, typename Arg)> \
+ static void test_method( BOOST_DATA_TEST_CASE_PARAMS( params ) ) \
+ { \
+ BOOST_TEST_CONTEXT( "" \
+ BOOST_PP_SEQ_FOR_EACH(BOOST_DATA_TEST_CONTEXT, _, params)) \
+ _impl(BOOST_PP_SEQ_ENUM(params)); \
+ } \
+private: \
+ template<BOOST_PP_ENUM_PARAMS(arity, typename Arg)> \
+ static void _impl(BOOST_DATA_TEST_CASE_PARAMS( params )); \
+}; \
+ \
+BOOST_AUTO_TU_REGISTRAR( test_name )( \
+ boost::unit_test::data::ds_detail::make_test_case_gen<test_name>( \
+ BOOST_STRINGIZE( test_name ), \
+ __FILE__, __LINE__, \
+ boost::unit_test::data::make(dataset) ), \
+ boost::unit_test::decorator::collector::instance() ); \
+ \
+ template<BOOST_PP_ENUM_PARAMS(arity, typename Arg)> \
+ void test_name::_impl( BOOST_DATA_TEST_CASE_PARAMS( params ) ) \
+/**/
+
+#define BOOST_DATA_TEST_CASE_WITH_PARAMS( test_name, dataset, ... ) \
+ BOOST_DATA_TEST_CASE_IMPL( BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
+ test_name, dataset, \
+ BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) ) \
+/**/
+#define BOOST_DATA_TEST_CASE_NO_PARAMS( test_name, dataset ) \
+ BOOST_DATA_TEST_CASE_WITH_PARAMS( test_name, dataset, sample ) \
+/**/
+
+#if BOOST_PP_VARIADICS_MSVC
+
+#define BOOST_DATA_TEST_CASE( ... ) \
+ BOOST_PP_CAT( \
+ BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \
+ BOOST_DATA_TEST_CASE_NO_PARAMS, \
+ BOOST_DATA_TEST_CASE_WITH_PARAMS) (__VA_ARGS__), ) \
+/**/
+#else
+
+#define BOOST_DATA_TEST_CASE( ... ) \
+ BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \
+ BOOST_DATA_TEST_CASE_NO_PARAMS, \
+ BOOST_DATA_TEST_CASE_WITH_PARAMS) (__VA_ARGS__) \
+/**/
+#endif
+
+} // namespace data
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DATA_TEST_CASE_HPP_102211GER
+
diff --git a/boost/test/debug.hpp b/boost/test/debug.hpp
index 1c45bc7e6e..2d367167ae 100644
--- a/boost/test/debug.hpp
+++ b/boost/test/debug.hpp
@@ -1,15 +1,14 @@
-// (C) Copyright Gennadiy Rozental 2006-2008.
+// (C) Copyright Gennadiy Rozental 2006-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines portable debug interfaces
+//! @file
+//! @brief defines portable debug interfaces
+//!
+//! Intended to standardize interface of programs with debuggers
// ***************************************************************************
#ifndef BOOST_TEST_DEBUG_API_HPP_112006GER
@@ -17,9 +16,11 @@
// Boost.Test
#include <boost/test/detail/config.hpp>
-#include <boost/test/utils/callback.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
+// Boost
+#include <boost/function/function1.hpp>
+
// STL
#include <string>
@@ -28,71 +29,107 @@
//____________________________________________________________________________//
namespace boost {
-
+/// Contains debugger and debug C Runtime interfaces
namespace debug {
+/// @defgroup DebuggerInterface Debugger and debug C Runtime portable interfaces
+/// @{
+/// These interfaces are intended to be used by application to:
+/// - check if we are running under debugger
+/// - attach the debugger to itself
+///
+/// Unfortunately these actions differ widely between different debuggers available in a field. These interface present generalized standard form of
+/// performing these actions. Implementation depends a lot on the environment application is running in and thus there are several custom implementations
+/// supported by the Boost.Test
+///
+/// In addition here you find interfaces for memory leaks detection and reporting.
+///
+/// All these interfaces are defined in namespace boost::debug
+
// ************************************************************************** //
-// ************** check if program is running under debugger ************** //
-// ************************************************************************** //
+/// Checks if programs runs under debugger
+/// @returns true if current process is under debugger. False otherwise
+// ************************************************************************** //
bool BOOST_TEST_DECL under_debugger();
// ************************************************************************** //
-// ************** cause program to break execution ************** //
-// ************** in debugger at call point ************** //
+/// Cause program to break execution in debugger at call point
// ************************************************************************** //
void BOOST_TEST_DECL debugger_break();
// ************************************************************************** //
-// ************** gui debugger setup ************** //
+/// Collection of data, which is used by debugger starter routine
// ************************************************************************** //
struct dbg_startup_info {
- long pid;
- bool break_or_continue;
- unit_test::const_string binary_path;
- unit_test::const_string display;
- unit_test::const_string init_done_lock;
+ long pid; ///< pid of a program to attach to
+ bool break_or_continue; ///< what to do after debugger is attached
+ unit_test::const_string binary_path; ///< path to executable for current process
+ unit_test::const_string display; ///< if debugger has a GUI, which display to use (on UNIX)
+ unit_test::const_string init_done_lock; ///< path to a uniquely named lock file, which is used to pause current application while debugger is being initialized
};
-typedef unit_test::callback1<dbg_startup_info const&> dbg_starter;
+/// Signature of debugger starter routine. Takes an instance of dbg_startup_into as only argument
+typedef boost::function<void (dbg_startup_info const&)> dbg_starter;
// ************************************************************************** //
-// ************** debugger setup ************** //
-// ************************************************************************** //
-
-#if BOOST_WORKAROUND( BOOST_MSVC, <1300)
-
-std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id );
-
-#else
-
+/// Specifies which debugger to use when attaching and optionally what routine to use to start that debugger
+
+/// There are many different debuggers available for different platforms. Some of them also can be used in a different setups/configuratins.
+/// For example, gdb can be used in plain text mode, inside ddd, inside (x)emacs or in a separate xterm window.
+/// Boost.Test identifies each configuration with unique string.
+/// Also different debuggers configurations require different routines which is specifically tailored to start that debugger configuration.
+/// Boost.Test comes with set of predefined configuration names and corresponding routines for these configurations:
+/// - TODO
+///
+/// You can use this routine to select which one of the predefined debugger configurations to use in which case you do not need to provide starter
+/// routine (the one provided by Boost.Test will be used). You can also use this routine to select your own debugger by providing unique configuration
+/// id and starter routine for this configuration.
+///
+/// @param[in] dbg_id Unique id for debugger configuration (for example, gdb)
+/// @param[in] s Optional starter routine for selected configuration (use only you want to define your own configuration)
+/// @returns Id of previously selected debugger configuration
std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() );
-#endif
-
-
// ************************************************************************** //
-// ************** attach debugger to the current process ************** //
+/// Attaches debugger to the current process
+
+/// Using currently selected debugger, this routine attempts to attach the debugger to this process.
+/// @param[in] break_or_continue tells what we wan to do after the debugger is attached. If true - process execution breaks
+/// in the point in invocation of this function. Otherwise execution continues, but now it is
+/// under the debugger
+/// @returns true if debugger successfully attached. False otherwise
// ************************************************************************** //
bool BOOST_TEST_DECL attach_debugger( bool break_or_continue = true );
// ************************************************************************** //
-// ************** switch on/off detect memory leaks feature ************** //
+/// Switches on/off memory leaks detection
+
+/// On platforms where memory leak detection is possible inside of running application (at the moment this is only Windows family) you can
+/// switch this feature on and off using this interface. In addition you can specify the name of the file to write a report into. Otherwise
+/// the report is going to be generated in standard error stream.
+/// @param[in] on_off boolean switch
+/// @param[in] report_file file, where the report should be directed to
// ************************************************************************** //
-void BOOST_TEST_DECL detect_memory_leaks( bool on_off );
+void BOOST_TEST_DECL detect_memory_leaks( bool on_off, unit_test::const_string report_file = unit_test::const_string() );
// ************************************************************************** //
-// ************** cause program to break execution in ************** //
-// ************** debugger at specific allocation point ************** //
+/// Causes program to break execution in debugger at specific allocation point
+
+/// On some platforms/memory managers (at the moment only on Windows/Visual Studio) one can tell a C Runtime to break
+/// on specific memory allocation. This can be used in combination with memory leak detection (which reports leaked memory
+/// allocation number) to locate the place where leak initiated.
+/// @param[in] mem_alloc_order_num Specific memory allocation number
// ************************************************************************** //
void BOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num );
} // namespace debug
+/// @}
} // namespace boost
diff --git a/boost/test/debug_config.hpp b/boost/test/debug_config.hpp
index 17f41a60a7..63ceed5f1a 100644
--- a/boost/test/debug_config.hpp
+++ b/boost/test/debug_config.hpp
@@ -1,15 +1,15 @@
-// (C) Copyright Gennadiy Rozental 2006-2008.
+// (C) Copyright Gennadiy Rozental 2006-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : user's config for Boost.Test debugging support
+//! @file
+//! @brief user's config for Boost.Test debugging support
+//!
+//! This file is intended to be edited by end user to specify varios macros, which configure debugger interface
+//! Alterntively you can set these parameters in your own sources/makefiles
// ***************************************************************************
#ifndef BOOST_TEST_DEBUG_CONFIG_HPP_112006GER
diff --git a/boost/test/detail/config.hpp b/boost/test/detail/config.hpp
index 4b12f0399c..0e0c1f2d45 100644
--- a/boost/test/detail/config.hpp
+++ b/boost/test/detail/config.hpp
@@ -1,15 +1,12 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : as a central place for global configuration switches
+//!@file
+//!@brief a central place for global configuration switches
// ***************************************************************************
#ifndef BOOST_TEST_CONFIG_HPP_071894GER
@@ -19,6 +16,18 @@
#include <boost/config.hpp> // compilers workarounds
#include <boost/detail/workaround.hpp>
+#if defined(_WIN32) && !defined(BOOST_DISABLE_WIN32) && \
+ (!defined(__COMO__) && !defined(__MWERKS__) && !defined(__GNUC__) || \
+ BOOST_WORKAROUND(__MWERKS__, >= 0x3000))
+# define BOOST_SEH_BASED_SIGNAL_HANDLING
+#endif
+
+#if defined(__COMO__) && defined(_MSC_VER)
+// eh.h uses type_info without declaring it.
+class type_info;
+# define BOOST_SEH_BASED_SIGNAL_HANDLING
+#endif
+
//____________________________________________________________________________//
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) || \
@@ -37,9 +46,7 @@
//____________________________________________________________________________//
-#if !defined(BOOST_NO_STD_LOCALE) && \
- !BOOST_WORKAROUND(BOOST_MSVC, < 1310) && \
- !defined(__MWERKS__)
+#if !defined(BOOST_NO_STD_LOCALE) && !defined(__MWERKS__)
# define BOOST_TEST_USE_STD_LOCALE 1
#endif
@@ -65,10 +72,8 @@
//____________________________________________________________________________//
-#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
- !BOOST_WORKAROUND(BOOST_MSVC, <1310) && \
- !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x530))
-# define BOOST_TEST_SUPPORT_INTERACTION_TESTING 1
+#if !defined(__BORLANDC__) && !BOOST_WORKAROUND( __SUNPRO_CC, < 0x5100 )
+#define BOOST_TEST_SUPPORT_TOKEN_ITERATOR 1
#endif
//____________________________________________________________________________//
@@ -101,4 +106,10 @@
#define BOOST_TEST_MAIN BOOST_TEST_MODULE
#endif
+#ifdef __PGI
+#define BOOST_PP_VARIADICS 1
+#endif
+
+
+
#endif // BOOST_TEST_CONFIG_HPP_071894GER
diff --git a/boost/test/detail/enable_warnings.hpp b/boost/test/detail/enable_warnings.hpp
index 7c11ba2355..13fd01f445 100644
--- a/boost/test/detail/enable_warnings.hpp
+++ b/boost/test/detail/enable_warnings.hpp
@@ -1,22 +1,19 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : enable previosly suppressed warnings
+//!@file
+//!@brief enable previously suppressed warnings
// ***************************************************************************
#ifdef BOOST_MSVC
# 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: 4100) // unreferenced formal parameter
+# pragma warning(default: 4996) // <symbol> was declared deprecated
# pragma warning(default: 4355) // 'this' : used in base member initializer list
# pragma warning(default: 4706) // assignment within conditional expression
# pragma warning(default: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
@@ -28,3 +25,7 @@
# pragma warning(default: 4511) // 'class' : copy constructor could not be generated
# pragma warning(pop)
#endif
+
+#ifdef BOOST_CLANG
+#pragma clang diagnostic pop
+#endif
diff --git a/boost/test/detail/fwd_decl.hpp b/boost/test/detail/fwd_decl.hpp
index bde272a169..5f4110b096 100644
--- a/boost/test/detail/fwd_decl.hpp
+++ b/boost/test/detail/fwd_decl.hpp
@@ -1,15 +1,12 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : contains forward eclarations for Boost.Test data types
+//!@file
+//!@brief contains forward eclarations for Boost.Test data types
// ***************************************************************************
#ifndef BOOST_TEST_FWD_DECL_HPP_011605GER
diff --git a/boost/test/detail/global_typedef.hpp b/boost/test/detail/global_typedef.hpp
index ad66f984fe..0c71479a23 100644
--- a/boost/test/detail/global_typedef.hpp
+++ b/boost/test/detail/global_typedef.hpp
@@ -1,31 +1,36 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : some trivial global typedefs
+//!@file
+//!@brief some trivial global typedefs
// ***************************************************************************
#ifndef BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
#define BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
-#define BOOST_TEST_L( s ) boost::unit_test::const_string( s, sizeof( s ) - 1 )
+#include <boost/test/detail/workaround.hpp>
+
+#define BOOST_TEST_L( s ) ::boost::unit_test::const_string( s, sizeof( s ) - 1 )
#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) )
#define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" )
+#define BOOST_TEST_SCOPE_SETCOLOR( os, attr, color ) \
+ scope_setcolor const& sc = runtime_config::color_output() \
+ ? scope_setcolor( os, attr, color ) \
+ : scope_setcolor(); \
+ ut_detail::ignore_unused_variable_warning( sc ) \
+/**/
+
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
typedef unsigned long counter_t;
@@ -36,11 +41,19 @@ enum report_level { INV_REPORT_LEVEL, CONFIRMATION_REPORT, SHORT_REPORT, DETAIL
//____________________________________________________________________________//
-enum output_format { INV_OF, CLF /* compiler log format */, XML /* XML */ };
+enum output_format { OF_INVALID,
+ OF_CLF, ///< compiler log format
+ OF_XML, ///< XML format for report and log,
+ OF_DOT ///< dot format for output content
+};
//____________________________________________________________________________//
-enum test_unit_type { tut_case = 0x01, tut_suite = 0x10, tut_any = 0x11 };
+enum test_unit_type { TUT_CASE = 0x01, TUT_SUITE = 0x10, TUT_ANY = 0x11 };
+
+//____________________________________________________________________________//
+
+enum assertion_result { AR_FAILED, AR_PASSED, AR_TRIGGERED };
//____________________________________________________________________________//
@@ -59,26 +72,25 @@ namespace ut_detail {
inline test_unit_type
test_id_2_unit_type( test_unit_id id )
{
- return (id & 0xFFFF0000) != 0 ? tut_case : tut_suite;
+ return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE;
}
//____________________________________________________________________________//
-// helper templates to prevent ODR violations
-template<class T>
-struct static_constant {
- static T value;
-};
+// helper templates to prevent ODR violations
+template<class T>
+struct static_constant {
+ static T value;
+};
-template<class T>
-T static_constant<T>::value;
+template<class T>
+T static_constant<T>::value;
-//____________________________________________________________________________//
+//____________________________________________________________________________//
} // namespace ut_detail
} // namespace unit_test
-
} // namespace boost
//____________________________________________________________________________//
diff --git a/boost/test/detail/log_level.hpp b/boost/test/detail/log_level.hpp
index 371c4b9d60..5975161773 100644
--- a/boost/test/detail/log_level.hpp
+++ b/boost/test/detail/log_level.hpp
@@ -1,15 +1,12 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : shared definition for unit test log levels
+//!@file
+//!@brief shared definition for unit test log levels
// ***************************************************************************
#ifndef BOOST_TEST_LOG_LEVEL_HPP_011605GER
diff --git a/boost/test/detail/pp_variadic.hpp b/boost/test/detail/pp_variadic.hpp
new file mode 100644
index 0000000000..3d31cd1705
--- /dev/null
+++ b/boost/test/detail/pp_variadic.hpp
@@ -0,0 +1,49 @@
+// (C) Copyright Gennadiy Rozental 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief few helpers for working with variadic macros
+// ***************************************************************************
+
+#ifndef BOOST_TEST_PP_VARIADIC_HPP_021515GER
+#define BOOST_TEST_PP_VARIADIC_HPP_021515GER
+
+// Boost
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/variadic/size.hpp>
+
+//____________________________________________________________________________//
+
+#if BOOST_PP_VARIADICS
+
+#if BOOST_PP_VARIADICS_MSVC
+# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) BOOST_PP_CAT( tool (__VA_ARGS__), )
+#else
+# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) tool (__VA_ARGS__)
+#endif
+
+//____________________________________________________________________________//
+
+/// if sizeof(__VA_ARGS__) == N: F1(__VA_ARGS__)
+/// else: F2(__VA_ARGS__)
+#define BOOST_TEST_INVOKE_IF_N_ARGS( N, F1, F2, ... ) \
+ BOOST_TEST_INVOKE_VARIADIC( \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), N), \
+ F1, \
+ F2), \
+ __VA_ARGS__ ) \
+/**/
+
+//____________________________________________________________________________//
+
+#endif /* BOOST_PP_VARIADICS */
+
+#endif // BOOST_TEST_PP_VARIADIC_HPP_021515GER
+
+// EOF
diff --git a/boost/test/detail/suppress_warnings.hpp b/boost/test/detail/suppress_warnings.hpp
index d5c95266ed..f667d31242 100644
--- a/boost/test/detail/suppress_warnings.hpp
+++ b/boost/test/detail/suppress_warnings.hpp
@@ -1,23 +1,20 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : suppress some warnings
+//!@file
+//!@brief suppress some warnings
// ***************************************************************************
#ifdef BOOST_MSVC
# pragma warning(push)
# 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: 4100) // unreferenced formal parameter
+# pragma warning(disable: 4996) // <symbol> was declared deprecated
# pragma warning(disable: 4355) // 'this' : used in base member initializer list
# pragma warning(disable: 4706) // assignment within conditional expression
# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
@@ -29,3 +26,7 @@
# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated
#endif
+#ifdef BOOST_CLANG
+#pragma clang diagnostic push
+//#pragma clang diagnostic ignored "-Wlogical-op-parentheses"
+#endif
diff --git a/boost/test/detail/throw_exception.hpp b/boost/test/detail/throw_exception.hpp
new file mode 100644
index 0000000000..b29b9c07dd
--- /dev/null
+++ b/boost/test/detail/throw_exception.hpp
@@ -0,0 +1,69 @@
+// (C) Copyright Gennadiy Rozental 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief contains wrappers, which allows to build Boost.Test with no exception
+// ***************************************************************************
+
+#ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
+#define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
+
+// Boost
+#include <boost/config.hpp> // BOOST_NO_EXCEPTION
+
+#ifdef BOOST_NO_EXCEPTION
+// C RUNTIME
+#include <stdlib.h>
+
+#endif
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace ut_detail {
+
+#ifdef BOOST_NO_EXCEPTION
+
+template<typename E>
+inline int
+throw_exception(E const& e) { abort(); return 0; }
+
+#define BOOST_TEST_IMPL_TRY
+#define BOOST_TEST_IMPL_CATCH( T, var ) for(T const& var = *(T*)0; false;)
+#define BOOST_TEST_IMPL_CATCH0( T ) if(0)
+#define BOOST_TEST_IMPL_CATCHALL() if(0)
+#define BOOST_TEST_IMPL_RETHROW
+
+#else
+
+template<typename E>
+inline int
+throw_exception(E const& e) { throw e; return 0; }
+
+#define BOOST_TEST_IMPL_TRY try
+#define BOOST_TEST_IMPL_CATCH( T, var ) catch( T const& var )
+#define BOOST_TEST_IMPL_CATCH0( T ) catch( T const& )
+#define BOOST_TEST_IMPL_CATCHALL() catch(...)
+#define BOOST_TEST_IMPL_RETHROW throw
+#endif
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_IMPL_THROW( E ) unit_test::ut_detail::throw_exception( E )
+
+} // namespace ut_detail
+} // namespace unit_test
+} // namespace boost
+
+//____________________________________________________________________________//
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
diff --git a/boost/test/detail/unit_test_parameters.hpp b/boost/test/detail/unit_test_parameters.hpp
deleted file mode 100644
index 740dc5d6fd..0000000000
--- a/boost/test/detail/unit_test_parameters.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : storage for unit test framework parameters information
-// ***************************************************************************
-
-#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER
-#define BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER
-
-#include <boost/test/detail/global_typedef.hpp>
-#include <boost/test/detail/log_level.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-// STL
-#include <iosfwd>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace unit_test {
-
-// ************************************************************************** //
-// ************** runtime_config ************** //
-// ************************************************************************** //
-
-namespace runtime_config {
-
-BOOST_TEST_DECL void init( int& argc, char** argv );
-
-BOOST_TEST_DECL unit_test::log_level log_level();
-BOOST_TEST_DECL bool no_result_code();
-BOOST_TEST_DECL unit_test::report_level report_level();
-BOOST_TEST_DECL const_string test_to_run();
-BOOST_TEST_DECL const_string break_exec_path();
-BOOST_TEST_DECL bool save_pattern();
-BOOST_TEST_DECL bool show_build_info();
-BOOST_TEST_DECL bool show_progress();
-BOOST_TEST_DECL bool catch_sys_errors();
-BOOST_TEST_DECL bool auto_start_dbg();
-BOOST_TEST_DECL bool use_alt_stack();
-BOOST_TEST_DECL bool detect_fp_exceptions();
-BOOST_TEST_DECL output_format report_format();
-BOOST_TEST_DECL output_format log_format();
-BOOST_TEST_DECL std::ostream* report_sink();
-BOOST_TEST_DECL std::ostream* log_sink();
-BOOST_TEST_DECL long detect_memory_leaks();
-BOOST_TEST_DECL int random_seed();
-
-} // namespace runtime_config
-
-} // namespace unit_test
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER
diff --git a/boost/test/detail/workaround.hpp b/boost/test/detail/workaround.hpp
index a7c50c2483..60a03eca61 100644
--- a/boost/test/detail/workaround.hpp
+++ b/boost/test/detail/workaround.hpp
@@ -1,15 +1,12 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : contains mics. workarounds
+//!@file
+//!@brief contains mics. workarounds
// ***************************************************************************
#ifndef BOOST_TEST_WORKAROUND_HPP_021005GER
@@ -26,15 +23,13 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace ut_detail {
#ifdef BOOST_NO_STD_DISTANCE
template <class T>
std::ptrdiff_t distance( T const& x_, T const& y_ )
-{
+{
std::ptrdiff_t res = 0;
std::distance( x_, y_, res );
@@ -51,11 +46,7 @@ using std::distance;
template <class T> inline void ignore_unused_variable_warning(const T&) {}
} // namespace ut_detail
-
} // namespace unit_test
-
-namespace unit_test_framework = unit_test;
-
} // namespace boost
//____________________________________________________________________________//
diff --git a/boost/test/exception_safety.hpp b/boost/test/exception_safety.hpp
deleted file mode 100644
index e1e8d85ad1..0000000000
--- a/boost/test/exception_safety.hpp
+++ /dev/null
@@ -1,187 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Facilities to perform exception safety tests
-// ***************************************************************************
-
-#ifndef BOOST_TEST_EXCEPTION_SAFETY_HPP_111705GER
-#define BOOST_TEST_EXCEPTION_SAFETY_HPP_111705GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-
-#include <boost/test/utils/callback.hpp>
-#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
-
-// STL
-#include <memory>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** BOOST_TEST_EXCEPTION_SAFETY ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_EXCEPTION_SAFETY( test_name ) \
-struct test_name : public BOOST_AUTO_TEST_CASE_FIXTURE \
-{ void test_method(); }; \
- \
-static void BOOST_AUTO_TC_INVOKER( test_name )() \
-{ \
- test_name t; \
- ::boost::itest::exception_safety( \
- boost::bind( &test_name::test_method, t ), \
- BOOST_STRINGIZE(test_name) ); \
-} \
- \
-struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
- \
-BOOST_AUTO_TU_REGISTRAR( test_name )( \
- boost::unit_test::make_test_case( \
- &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
- boost::unit_test::ut_detail::auto_tc_exp_fail< \
- BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
- \
-void test_name::test_method() \
-/**/
-
-namespace boost {
-
-namespace itest {
-
-// ************************************************************************** //
-// ************** exception safety test ************** //
-// ************************************************************************** //
-
-void BOOST_TEST_DECL exception_safety( unit_test::callback0<> const& F,
- unit_test::const_string test_name = "" );
-
-} // namespace itest
-
-} // namespace boost
-
-// ************************************************************************** //
-// ************** global operator new/delete overloads ************** //
-// ************************************************************************** //
-
-#ifndef BOOST_ITEST_NO_NEW_OVERLOADS
-
-#include <boost/test/interaction_based.hpp>
-
-# ifdef BOOST_NO_STDC_NAMESPACE
-namespace std { using ::isprint; using ::malloc; using ::free; }
-# endif
-
-inline void*
-operator new( std::size_t s ) throw(std::bad_alloc)
-{
- void* res = std::malloc(s ? s : 1);
-
- if( res )
- ::boost::itest::manager::instance().allocated( 0, 0, res, s );
- else
- throw std::bad_alloc();
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-inline void*
-operator new( std::size_t s, std::nothrow_t const& ) throw()
-{
- void* res = std::malloc(s ? s : 1);
-
- if( res )
- ::boost::itest::manager::instance().allocated( 0, 0, res, s );
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-inline void*
-operator new[]( std::size_t s ) throw(std::bad_alloc)
-{
- void* res = std::malloc(s ? s : 1);
-
- if( res )
- ::boost::itest::manager::instance().allocated( 0, 0, res, s );
- else
- throw std::bad_alloc();
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-inline void*
-operator new[]( std::size_t s, std::nothrow_t const& ) throw()
-{
- void* res = std::malloc(s ? s : 1);
-
- if( res )
- ::boost::itest::manager::instance().allocated( 0, 0, res, s );
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-inline void
-operator delete( void* p ) throw()
-{
- ::boost::itest::manager::instance().freed( p );
-
- std::free( p );
-}
-
-//____________________________________________________________________________//
-
-inline void
-operator delete( void* p, std::nothrow_t const& ) throw()
-{
- ::boost::itest::manager::instance().freed( p );
-
- std::free( p );
-}
-
-//____________________________________________________________________________//
-
-inline void
-operator delete[]( void* p ) throw()
-{
- ::boost::itest::manager::instance().freed( p );
-
- std::free( p );
-}
-
-//____________________________________________________________________________//
-
-inline void
-operator delete[]( void* p, std::nothrow_t const& ) throw()
-{
- ::boost::itest::manager::instance().freed( p );
-
- std::free( p );
-}
-
-//____________________________________________________________________________//
-
-#endif // BOOST_ITEST_NO_NEW_OVERLOADS
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_EXCEPTION_SAFETY_HPP_111705GER
diff --git a/boost/test/execution_monitor.hpp b/boost/test/execution_monitor.hpp
index a1c2ee61c9..b01137da7b 100644
--- a/boost/test/execution_monitor.hpp
+++ b/boost/test/execution_monitor.hpp
@@ -1,32 +1,13 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// (C) Copyright Beman Dawes 2001.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines abstract monitor interfaces and implements execution exception
-// The original Boost Test Library included an implementation detail function
-// named catch_exceptions() which caught otherwise uncaught C++ exceptions.
-// It was derived from an existing test framework by Beman Dawes. The
-// intent was to expand later to catch other detectable but platform dependent
-// error events like Unix signals or Windows structured C exceptions.
-//
-// Requests from early adopters of the Boost Test Library included
-// configurable levels of error message detail, elimination of templates,
-// separation of error reporting, and making the catch_exceptions() facilities
-// available as a public interface. Support for unit testing also stretched
-// the function based design. Implementation within the header became less
-// attractive due to the need to include many huge system dependent headers,
-// although still preferable in certain cases.
-//
-// All those issues have been addressed by introducing the class-based
-// design presented here.
+//!@file
+//!@brief Defines public interface of the Execution Monitor and related classes
// ***************************************************************************
#ifndef BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER
@@ -35,99 +16,257 @@
// Boost.Test
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/detail/fwd_decl.hpp>
-#include <boost/test/utils/callback.hpp>
+#include <boost/test/detail/throw_exception.hpp>
+
#include <boost/test/utils/class_properties.hpp>
// Boost
-#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <boost/type.hpp>
#include <boost/cstdlib.hpp>
+#include <boost/function/function0.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
+#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING
+
+// for the FP constants and control routines
+#include <float.h>
+
+#ifndef EM_INVALID
+#define EM_INVALID _EM_INVALID
+#endif
+
+#ifndef EM_DENORMAL
+#define EM_DENORMAL _EM_DENORMAL
+#endif
+
+#ifndef EM_ZERODIVIDE
+#define EM_ZERODIVIDE _EM_ZERODIVIDE
+#endif
+
+#ifndef EM_OVERFLOW
+#define EM_OVERFLOW _EM_OVERFLOW
+#endif
+
+#ifndef EM_UNDERFLOW
+#define EM_UNDERFLOW _EM_UNDERFLOW
+#endif
+
+#ifndef MCW_EM
+#define MCW_EM _MCW_EM
+#endif
+
+#else // based on ISO C standard
+
+#if !defined(BOOST_NO_FENV_H)
+ #include <boost/detail/fenv.hpp>
+#endif
+
+#endif
+
//____________________________________________________________________________//
namespace boost {
-namespace detail {
+/// @defgroup ExecutionMonitor Function Execution Monitor
+/// @{
+/// @section Intro Introduction
+/// Sometimes we need to call a function and make sure that no user or system originated exceptions are being thrown by it. Uniform exception reporting
+/// is also may be convenient. That's the purpose of the Boost.Test's Execution Monitor.
+///
+/// The Execution Monitor is a lower-level component of the Boost Test Library. It is the base for implementing all other Boost.Test components, but also
+/// can be used standalone to get controlled execution of error-prone functions with a uniform error notification. The Execution Monitor calls a user-supplied
+/// function in a controlled environment, relieving users from messy error detection.
+///
+/// The Execution Monitor usage is demonstrated in the example exec_mon_example.
+///
+/// @section DesignRationale Design Rationale
+///
+/// The Execution Monitor design assumes that it can be used when no (or almost no) memory available. Also the Execution Monitor is intended to be portable to as many platforms as possible.
+///
+/// @section UserGuide User's guide
+/// The Execution Monitor is designed to solve the problem of executing potentially dangerous function that may result in any number of error conditions,
+/// in monitored environment that should prevent any undesirable exceptions to propagate out of function call and produce consistent result report for all outcomes.
+/// The Execution Monitor is able to produce informative report for all standard C++ exceptions and intrinsic types. All other exceptions are reported as unknown.
+/// If you prefer different message for your exception type or need to perform any action, the Execution Monitor supports custom exception translators.
+/// There are several other parameters of the monitored environment can be configured by setting appropriate properties of the Execution Monitor.
+///
+/// All symbols in the Execution Monitor implementation are located in the namespace boost. To use the Execution Monitor you need to:
+/// -# include @c boost/test/execution_monitor.hpp
+/// -# Make an instance of execution_monitor.
+/// -# Optionally register custom exception translators for exception classes which require special processing.
+///
+/// @subsection FuncExec Monitored function execution
+///
+/// The class execution_monitor can monitor functions with the following signatures:
+/// - int ()
+/// - void ()
+///
+/// This function is expected to be self sufficient part of your application. You can't pass any arguments to this function directly. Instead you
+/// should bind them into executable nullary function using bind function (either standard or boost variant). Neither you can return any other value,
+/// but an integer result code. If necessary you can bind output parameters by reference or use some other more complicated nullary functor, which
+/// maintains state. This includes class methods, static class methods etc.
+///
+/// To start the monitored function, invoke the method execution_monitor::execute and pass the monitored function as an argument. If the call succeeds,
+/// the method returns the result code produced by the monitored function. If any of the following conditions occur:
+/// - Uncaught C++ exception
+/// - Hardware or software signal, trap, or other exception
+/// - Timeout reached
+/// - Debug assert event occurred (under Microsoft Visual C++ or compatible compiler)
+///
+/// then the method throws the execution_exception. The exception contains unique error_code value identifying the error condition and the detailed message
+/// that can be used to report the error.
+///
+/// @subsection Reporting Errors reporting and translation
+///
+/// If you need to report an error inside monitored function execution you have to throw an exception. Do not use the execution_exception - it's not intended
+/// to be used for this purpose. The simplest choice is to use one of the following C++ types as an exception:
+/// - C string
+/// - std:string
+/// - any exception class in std::exception hierarchy
+/// - boost::exception
+///
+/// execution_monitor will catch and report these types of exceptions. If exception is thrown which is unknown to execution_monitor, it can only
+/// report the fact of the exception. So in case if you prefer to use your own exception types or can't govern what exceptions are generated by monitored
+/// function and would like to see proper error message in a report, execution_monitor can be configured with custom "translator" routine, which will have
+/// a chance to either record the fact of the exception itself or translate it into one of standard exceptions and rethrow (or both). The translator routine
+/// is registered per exception type and is invoked when exception of this class (or one inherited from it) is thrown inside monitored routine. You can
+/// register as many independent translators as you like. See execution_monitor::register_exception_translator specification for requirements on translator
+/// function.
+///
+/// Finally, if you need to abort the monitored function execution without reporting any errors, you can throw an exception execution_aborted. As a result
+/// the execution is aborted and zero result code is produced by the method execution_monitor::execute.
+///
+/// @subsection Parameters Supported parameters
+///
+/// The Execution Monitor behavior is configurable through the set of parameters (properties) associated with the instance of the monitor. See execution_monitor
+/// specification for a list of supported parameters and their semantic.
// ************************************************************************** //
-// ************** detail::translate_exception_base ************** //
+// ************** detail::translator_holder_base ************** //
// ************************************************************************** //
-class BOOST_TEST_DECL translate_exception_base {
+namespace detail {
+
+class translator_holder_base;
+typedef boost::shared_ptr<translator_holder_base> translator_holder_base_ptr;
+
+class BOOST_TEST_DECL translator_holder_base {
+protected:
+ typedef boost::unit_test::const_string const_string;
public:
// Constructor
- explicit translate_exception_base( boost::scoped_ptr<translate_exception_base>& next )
+ translator_holder_base( translator_holder_base_ptr next, const_string tag )
+ : m_next( next )
+ , m_tag( std::string() + tag )
{
- next.swap( m_next );
}
// Destructor
- virtual ~translate_exception_base() {}
+ virtual ~translator_holder_base() {}
- virtual int operator()( unit_test::callback0<int> const& F ) = 0;
+ // translator holder interface
+ // invokes the function F inside the try/catch guarding against specific exception
+ virtual int operator()( boost::function<int ()> const& F ) = 0;
+
+ // erases specific translator holder from the chain
+ translator_holder_base_ptr erase( translator_holder_base_ptr this_, const_string tag )
+ {
+ if( m_next )
+ m_next = m_next->erase( m_next, tag );
+
+ return m_tag == tag ? m_next : this_;
+ }
+#ifndef BOOST_NO_RTTI
+ virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ) = 0;
+ template<typename ExceptionType>
+ translator_holder_base_ptr erase( translator_holder_base_ptr this_, boost::type<ExceptionType>* = 0 )
+ {
+ if( m_next )
+ m_next = m_next->erase<ExceptionType>( m_next );
+
+ return erase( this_, typeid(ExceptionType) );
+ }
+#endif
protected:
// Data members
- boost::scoped_ptr<translate_exception_base> m_next;
+ translator_holder_base_ptr m_next;
+ std::string m_tag;
};
} // namespace detail
// ************************************************************************** //
-// ************** execution_exception ************** //
+/// @class execution_exception
+/// @brief This class is used to report any kind of an failure during execution of a monitored function inside of execution_monitor
+///
+/// The instance of this class is thrown out of execution_monitor::execute invocation when failure is detected. Regardless of a kind of failure occurred
+/// the instance will provide a uniform way to catch and report it.
+///
+/// One important design rationale for this class is that we should be ready to work after fatal memory corruptions or out of memory conditions. To facilitate
+/// this class never allocates any memory and assumes that strings it refers to are either some constants or live in a some kind of persistent (preallocated) memory.
// ************************************************************************** //
-
-// design rationale: fear of being out (or nearly out) of memory.
-
+
class BOOST_TEST_DECL execution_exception {
typedef boost::unit_test::const_string const_string;
public:
+ /// These values are sometimes used as program return codes.
+ /// The particular values have been chosen to avoid conflicts with
+ /// commonly used program return codes: values < 100 are often user
+ /// assigned, values > 255 are sometimes used to report system errors.
+ /// Gaps in values allow for orderly expansion.
+ ///
+ /// @note(1) Only uncaught C++ exceptions are treated as errors.
+ /// If a function catches a C++ exception, it never reaches
+ /// the execution_monitor.
+ ///
+ /// The implementation decides what is a system_fatal_error and what is
+ /// just a system_exception. Fatal errors are so likely to have corrupted
+ /// machine state (like a stack overflow or addressing exception) that it
+ /// is unreasonable to continue execution.
+ ///
+ /// @note(2) These errors include Unix signals and Windows structured
+ /// exceptions. They are often initiated by hardware traps.
enum error_code {
- // These values are sometimes used as program return codes.
- // The particular values have been chosen to avoid conflicts with
- // commonly used program return codes: values < 100 are often user
- // assigned, values > 255 are sometimes used to report system errors.
- // Gaps in values allow for orderly expansion.
-
- no_error = 0, // for completeness only; never returned
- user_error = 200, // user reported non-fatal error
- cpp_exception_error = 205, // see note (1) below
- system_error = 210, // see note (2) below
- timeout_error = 215, // only detectable on certain platforms
- user_fatal_error = 220, // user reported fatal error
- system_fatal_error = 225 // see note (2) below
-
- // Note 1: Only uncaught C++ exceptions are treated as errors.
- // If the application catches a C++ exception, it will never reach
- // the execution_monitor.
-
- // Note 2: These errors include Unix signals and Windows structured
- // exceptions. They are often initiated by hardware traps.
- //
- // The implementation decides what is a fatal_system_exception and what is
- // just a system_exception. Fatal errors are so likely to have corrupted
- // machine state (like a stack overflow or addressing exception) that it
- // is unreasonable to continue execution.
+ no_error = 0, ///< for completeness only; never returned
+ user_error = 200, ///< user reported non-fatal error
+ cpp_exception_error = 205, ///< see note (1) above
+ system_error = 210, ///< see note (2) above
+ timeout_error = 215, ///< only detectable on certain platforms
+ user_fatal_error = 220, ///< user reported fatal error
+ system_fatal_error = 225 ///< see note (2) above
};
-
+
+ /// Simple model for the location of failure in a source code
struct BOOST_TEST_DECL location {
explicit location( char const* file_name = 0, size_t line_num = 0, char const* func = 0 );
- const_string m_file_name;
- size_t m_line_num;
- const_string m_function;
+ const_string m_file_name; ///< File name
+ size_t m_line_num; ///< Line number
+ const_string m_function; ///< Function name
};
- // Constructor
- execution_exception( error_code ec_, const_string what_msg_, location const& location_ ); // max length 256 inc '\0'
+ /// @name Constructors
+
+ /// Constructs instance based on message, location and error code
+
+ /// @param[in] ec error code
+ /// @param[in] what_msg error message
+ /// @param[in] location error location
+ execution_exception( error_code ec, const_string what_msg, location const& location );
- // Access methods
+ /// @name Access methods
+
+ /// Exception error code
error_code code() const { return m_error_code; }
+ /// Exception message
const_string what() const { return m_what; }
+ /// Exception location
location const& where() const { return m_location; }
+ ///@}
private:
// Data members
@@ -137,86 +276,159 @@ private:
}; // execution_exception
// ************************************************************************** //
-// ************** execution_monitor ************** //
+/// Function execution monitor
+
+/// This class is used to uniformly detect and report an occurrence of several types of signals and exceptions, reducing various
+/// errors to a uniform execution_exception that is returned to a caller.
+///
+/// The executiom_monitor behavior can be customized through a set of public parameters (properties) associated with the execution_monitor instance.
+/// All parameters are implemented as public unit_test::readwrite_property data members of the class execution_monitor.
// ************************************************************************** //
class BOOST_TEST_DECL execution_monitor {
+ typedef boost::unit_test::const_string const_string;
public:
- // Constructor
- execution_monitor()
- : p_catch_system_errors( true )
- , p_auto_start_dbg( false )
- , p_timeout( 0 )
- , p_use_alt_stack( true )
- , p_detect_fp_exceptions( false )
- {}
-
- // Public properties
-
- // The p_catch_system_errors parameter specifies whether the monitor should
- // try to catch system errors/exceptions that would cause program to crash
- // in regular case
- unit_test::readwrite_property<bool> p_catch_system_errors;
- // The p_auto_start_dbg parameter specifies whether the monitor should
- // try to attach debugger in case of caught system error
+
+ /// Default constructor initializes all execution monitor properties
+ execution_monitor();
+
+ /// Should monitor catch system errors.
+ ///
+ /// The @em p_catch_system_errors property is a boolean flag (default value is true) specifying whether or not execution_monitor should trap system
+ /// errors/system level exceptions/signals, which would cause program to crash in a regular case (without execution_monitor).
+ /// Set this property to false, for example, if you wish to force coredump file creation. The Unit Test Framework provides a
+ /// runtime parameter @c \-\-catch_system_errors=yes to alter the behavior in monitored test cases.
+ unit_test::readwrite_property<bool> p_catch_system_errors;
+
+ /// Should monitor try to attach debugger in case of caught system error.
+ ///
+ /// The @em p_auto_start_dbg property is a boolean flag (default value is false) specifying whether or not execution_monitor should try to attach debugger
+ /// in case system error is caught.
unit_test::readwrite_property<bool> p_auto_start_dbg;
- // The p_timeout parameter specifies the seconds that elapse before
- // a timer_error occurs. May be ignored on some platforms.
- unit_test::readwrite_property<int> p_timeout;
- // The p_use_alt_stack parameter specifies whether the monitor should
- // use alternative stack for the signal catching
+
+
+ /// Specifies the seconds that elapse before a timer_error occurs.
+ ///
+ /// The @em p_timeout property is an integer timeout (in seconds) for monitored function execution. Use this parameter to monitor code with possible deadlocks
+ /// or indefinite loops. This feature is only available for some operating systems (not yet Microsoft Windows).
+ unit_test::readwrite_property<unsigned> p_timeout;
+
+ /// Should monitor use alternative stack for the signal catching.
+ ///
+ /// The @em p_use_alt_stack property is a boolean flag (default value is false) specifying whether or not execution_monitor should use an alternative stack
+ /// for the sigaction based signal catching. When enabled the signals are delivered to the execution_monitor on a stack different from current execution
+ /// stack, which is safer in case if it is corrupted by monitored function. For more details on alternative stack handling see appropriate manuals.
unit_test::readwrite_property<bool> p_use_alt_stack;
- // The p_detect_fp_exceptions parameter specifies whether the monitor should
- // try to detect hardware floating point exceptions
- unit_test::readwrite_property<bool> p_detect_fp_exceptions;
-
- int execute( unit_test::callback0<int> const& F );
- // Returns: Value returned by function call F().
- //
- // Effects: Calls executes supplied function F inside a try/catch block which also may
- // include other unspecified platform dependent error detection code.
- //
- // Throws: execution_exception on an uncaught C++ exception,
- // a hardware or software signal, trap, or other exception.
- //
- // Note: execute() doesn't consider it an error for F to return a non-zero value.
-
- // register custom (user supplied) exception translator
- template<typename Exception, typename ExceptionTranslator>
- void register_exception_translator( ExceptionTranslator const& tr, boost::type<Exception>* = 0 );
+
+ /// Should monitor try to detect hardware floating point exceptions (!= 0), and which specific exception to catch.
+ ///
+ /// The @em p_detect_fp_exceptions property is a boolean flag (default value is false) specifying whether or not execution_monitor should install hardware
+ /// traps for the floating point exception on platforms where it's supported.
+ unit_test::readwrite_property<unsigned> p_detect_fp_exceptions;
+
+
+ // @name Monitoring entry points
+
+ /// @brief Execution monitor entry point for functions returning integer value
+ ///
+ /// This method executes supplied function F inside a try/catch block and also may include other unspecified platform dependent error detection code.
+ ///
+ /// This method throws an execution_exception on an uncaught C++ exception, a hardware or software signal, trap, or other user exception.
+ ///
+ /// @note execute() doesn't consider it an error for F to return a non-zero value.
+ /// @param[in] F Function to monitor
+ /// @returns value returned by function call F().
+ /// @see vexecute
+ int execute( boost::function<int ()> const& F );
+
+ /// @brief Execution monitor entry point for functions returning void
+ ///
+ /// This method is semantically identical to execution_monitor::execute, but des't produce any result code.
+ /// @param[in] F Function to monitor
+ /// @see execute
+ void vexecute( boost::function<void ()> const& F );
+ // @}
+
+ // @name Exception translator registration
+
+ /// @brief Registers custom (user supplied) exception translator
+
+ /// This method template registers a translator for an exception type specified as a first template argument. For example
+ /// @code
+ /// void myExceptTr( MyException const& ex ) { /*do something with the exception here*/}
+ /// em.register_exception_translator<MyException>( myExceptTr );
+ /// @endcode
+ /// The translator should be any unary function/functor object which accepts MyException const&. This can be free standing function
+ /// or bound class method. The second argument is an optional string tag you can associate with this translator routine. The only reason
+ /// to specify the tag is if you plan to erase the translator eventually. This can be useful in scenario when you reuse the same
+ /// execution_monitor instance to monitor different routines and need to register a translator specific to the routine being monitored.
+ /// While it is possible to erase the translator based on an exception type it was registered for, tag string provides simpler way of doing this.
+ /// @tparam ExceptionType type of the exception we register a translator for
+ /// @tparam ExceptionTranslator type of the translator we register for this exception
+ /// @param[in] tr translator function object with the signature <em> void (ExceptionType const&)</em>
+ /// @param[in] tag tag associated with this translator
+ template<typename ExceptionType, typename ExceptionTranslator>
+ void register_exception_translator( ExceptionTranslator const& tr, const_string tag = const_string(), boost::type<ExceptionType>* = 0 );
+
+ /// @brief Erases custom exception translator based on a tag
+
+ /// Use the same tag as the one used during translator registration
+ /// @param[in] tag tag associated with translator you wants to erase
+ void erase_exception_translator( const_string tag )
+ {
+ m_custom_translators = m_custom_translators->erase( m_custom_translators, tag );
+ }
+#ifndef BOOST_NO_RTTI
+ /// @brief Erases custom exception translator based on an exception type
+ ///
+ /// tparam ExceptionType Exception type for which you want to erase the translator
+ template<typename ExceptionType>
+ void erase_exception_translator( boost::type<ExceptionType>* = 0 )
+ {
+ m_custom_translators = m_custom_translators->erase<ExceptionType>( m_custom_translators );
+ }
+ //@}
+#endif
private:
// implementation helpers
- int catch_signals( unit_test::callback0<int> const& F );
+ int catch_signals( boost::function<int ()> const& F );
// Data members
- boost::scoped_ptr<detail::translate_exception_base> m_custom_translators;
- boost::scoped_array<char> m_alt_stack;
+ detail::translator_holder_base_ptr m_custom_translators;
+ boost::scoped_array<char> m_alt_stack;
}; // execution_monitor
-namespace detail {
-
// ************************************************************************** //
-// ************** detail::translate_exception ************** //
+// ************** detail::translator_holder ************** //
// ************************************************************************** //
-template<typename Exception, typename ExceptionTranslator>
-class translate_exception : public translate_exception_base
+namespace detail {
+
+template<typename ExceptionType, typename ExceptionTranslator>
+class translator_holder : public translator_holder_base
{
- typedef boost::scoped_ptr<translate_exception_base> base_ptr;
public:
- explicit translate_exception( ExceptionTranslator const& tr, base_ptr& next )
- : translate_exception_base( next ), m_translator( tr ) {}
+ explicit translator_holder( ExceptionTranslator const& tr, translator_holder_base_ptr& next, const_string tag = const_string() )
+ : translator_holder_base( next, tag ), m_translator( tr ) {}
- int operator()( unit_test::callback0<int> const& F )
+ // translator holder interface
+ virtual int operator()( boost::function<int ()> const& F )
{
- try {
+ BOOST_TEST_IMPL_TRY {
return m_next ? (*m_next)( F ) : F();
- } catch( Exception const& e ) {
+ }
+ BOOST_TEST_IMPL_CATCH( ExceptionType, e ) {
m_translator( e );
return boost::exit_exception_failure;
}
}
+#ifndef BOOST_NO_RTTI
+ virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ti )
+ {
+ return ti == typeid(ExceptionType) ? m_next : this_;
+ }
+#endif
private:
// Data members
@@ -225,16 +437,17 @@ private:
} // namespace detail
-template<typename Exception, typename ExceptionTranslator>
+template<typename ExceptionType, typename ExceptionTranslator>
void
-execution_monitor::register_exception_translator( ExceptionTranslator const& tr, boost::type<Exception>* )
+execution_monitor::register_exception_translator( ExceptionTranslator const& tr, const_string tag, boost::type<ExceptionType>* )
{
- m_custom_translators.reset(
- new detail::translate_exception<Exception,ExceptionTranslator>( tr,m_custom_translators ) );
+ m_custom_translators.reset(
+ new detail::translator_holder<ExceptionType,ExceptionTranslator>( tr, m_custom_translators, tag ) );
}
// ************************************************************************** //
-// ************** execution_aborted ************** //
+/// @class execution_aborted
+/// @brief This is a trivial default constructible class. Use it to report graceful abortion of a monitored function execution.
// ************************************************************************** //
struct execution_aborted {};
@@ -248,16 +461,60 @@ public:
// Constructor
explicit system_error( char const* exp );
- unit_test::readonly_property<long> p_errno;
- unit_test::readonly_property<char const*> p_failed_exp;
+ unit_test::readonly_property<long> p_errno;
+ unit_test::readonly_property<char const*> p_failed_exp;
};
-#define BOOST_TEST_SYS_ASSERT( exp ) if( (exp) ) ; else throw ::boost::system_error( BOOST_STRINGIZE( exp ) )
+#define BOOST_TEST_SYS_ASSERT( exp ) \
+ if( (exp) ) ; \
+ else BOOST_TEST_IMPL_THROW( ::boost::system_error( BOOST_STRINGIZE( exp ) ) )
-} // namespace boost
+// ************************************************************************** //
+// **************Floating point exception management interface ************** //
+// ************************************************************************** //
+
+namespace fpe {
+
+enum masks {
+ BOOST_FPE_OFF = 0,
+
+#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING
+ BOOST_FPE_DIVBYZERO = EM_ZERODIVIDE,
+ BOOST_FPE_INEXACT = EM_INEXACT,
+ BOOST_FPE_INVALID = EM_INVALID,
+ BOOST_FPE_OVERFLOW = EM_OVERFLOW,
+ BOOST_FPE_UNDERFLOW = EM_UNDERFLOW|EM_DENORMAL,
+
+ BOOST_FPE_ALL = MCW_EM,
+#elif defined(BOOST_NO_FENV_H) || defined(BOOST_CLANG)
+ BOOST_FPE_ALL = 1,
+#else
+ BOOST_FPE_DIVBYZERO = FE_DIVBYZERO,
+ BOOST_FPE_INEXACT = FE_INEXACT,
+ BOOST_FPE_INVALID = FE_INVALID,
+ BOOST_FPE_OVERFLOW = FE_OVERFLOW,
+ BOOST_FPE_UNDERFLOW = FE_UNDERFLOW,
+
+ BOOST_FPE_ALL = FE_ALL_EXCEPT,
+#endif
+ BOOST_FPE_INV = BOOST_FPE_ALL+1
+};
//____________________________________________________________________________//
+// return the previous set of enabled exceptions when successful, and BOOST_FPE_INV otherwise
+unsigned BOOST_TEST_DECL enable( unsigned mask );
+unsigned BOOST_TEST_DECL disable( unsigned mask );
+
+//____________________________________________________________________________//
+
+} // namespace fpe
+
+///@}
+
+} // namespace boost
+
+
#include <boost/test/detail/enable_warnings.hpp>
#endif
diff --git a/boost/test/floating_point_comparison.hpp b/boost/test/floating_point_comparison.hpp
index 5a5a3269cc..8475520f32 100644
--- a/boost/test/floating_point_comparison.hpp
+++ b/boost/test/floating_point_comparison.hpp
@@ -1,286 +1,14 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2011-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines algoirthms for comparing 2 floating point values
+//! @file
+//! @brief Deprecated header
+//! @deprecated Use boost/test/tools/floating_point_comparison.hpp instead
// ***************************************************************************
-#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
-#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
-
// 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>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace test_tools {
-
-using unit_test::readonly_property;
-
-// ************************************************************************** //
-// ************** floating_point_comparison_type ************** //
-// ************************************************************************** //
-
-enum floating_point_comparison_type {
- FPC_STRONG, // "Very close" - equation 1' in docs, the default
- FPC_WEAK // "Close enough" - equation 2' in docs.
-
-};
-
-// ************************************************************************** //
-// ************** details ************** //
-// ************************************************************************** //
-
-namespace tt_detail {
-
-// FPT is Floating-Point Type: float, double, long double or User-Defined.
-template<typename FPT>
-inline FPT
-fpt_abs( FPT fpv )
-{
- return fpv < static_cast<FPT>(0) ? -fpv : fpv;
-}
-
-//____________________________________________________________________________//
-
-template<typename FPT>
-struct fpt_limits {
- static FPT min_value()
- {
- return std::numeric_limits<FPT>::is_specialized
- ? (std::numeric_limits<FPT>::min)()
- : 0;
- }
- static FPT max_value()
- {
- return std::numeric_limits<FPT>::is_specialized
- ? (std::numeric_limits<FPT>::max)()
- : static_cast<FPT>(1000000); // for the our purpuses it doesn't really matter what value is returned here
- }
-};
-
-//____________________________________________________________________________//
-
-// both f1 and f2 are unsigned here
-template<typename FPT>
-inline FPT
-safe_fpt_division( FPT f1, FPT f2 )
-{
- // Avoid overflow.
- 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())) )
- return static_cast<FPT>(0);
-
- return f1/f2;
-}
-
-//____________________________________________________________________________//
-
-} // namespace tt_detail
-
-// ************************************************************************** //
-// ************** tolerance presentation types ************** //
-// ************************************************************************** //
-
-template<typename FPT>
-struct percent_tolerance_t {
- explicit percent_tolerance_t( FPT v ) : m_value( v ) {}
-
- FPT m_value;
-};
-
-//____________________________________________________________________________//
-
-template<typename Out,typename FPT>
-Out& operator<<( Out& out, percent_tolerance_t<FPT> t )
-{
- return out << t.m_value;
-}
-
-//____________________________________________________________________________//
-
-template<typename FPT>
-inline percent_tolerance_t<FPT>
-percent_tolerance( FPT v )
-{
- return percent_tolerance_t<FPT>( v );
-}
-
-//____________________________________________________________________________//
-
-template<typename FPT>
-struct fraction_tolerance_t {
- explicit fraction_tolerance_t( FPT v ) : m_value( v ) {}
-
- FPT m_value;
-};
-
-//____________________________________________________________________________//
-
-template<typename Out,typename FPT>
-Out& operator<<( Out& out, fraction_tolerance_t<FPT> t )
-{
- return out << t.m_value;
-}
-
-//____________________________________________________________________________//
-
-template<typename FPT>
-inline fraction_tolerance_t<FPT>
-fraction_tolerance( FPT v )
-{
- return fraction_tolerance_t<FPT>( v );
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** close_at_tolerance ************** //
-// ************************************************************************** //
-
-template<typename FPT>
-class close_at_tolerance {
-public:
- // Public typedefs
- typedef bool result_type;
-
- // Constructor
- template<typename ToleranceBaseType>
- explicit close_at_tolerance( percent_tolerance_t<ToleranceBaseType> tolerance,
- 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. )
- {}
-
- 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 ) );
-
- 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;
-};
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** check_is_close ************** //
-// ************************************************************************** //
-
-struct BOOST_TEST_DECL check_is_close_t {
- // Public typedefs
- typedef bool result_type;
-
- 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 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 );
- }
-};
-
-namespace {
-check_is_close_t const& check_is_close = unit_test::ut_detail::static_constant<check_is_close_t>::value;
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** check_is_small ************** //
-// ************************************************************************** //
-
-struct BOOST_TEST_DECL check_is_small_t {
- // Public typedefs
- typedef bool result_type;
-
- template<typename FPT>
- bool
- operator()( FPT fpv, FPT tolerance ) const
- {
- return tt_detail::fpt_abs( fpv ) < tt_detail::fpt_abs( tolerance );
- }
-};
-
-namespace {
-check_is_small_t const& check_is_small = unit_test::ut_detail::static_constant<check_is_small_t>::value;
-}
-
-//____________________________________________________________________________//
-
-} // namespace test_tools
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER
+#include <boost/test/tools/floating_point_comparison.hpp>
diff --git a/boost/test/framework.hpp b/boost/test/framework.hpp
index 7f6fd2aecc..92716a0be0 100644
--- a/boost/test/framework.hpp
+++ b/boost/test/framework.hpp
@@ -1,15 +1,13 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines framework interface
+//!@file
+//!@brief Defines Unit Test Framework mono-state interfaces.
+//! The framework interfaces are based on Monostate design pattern.
// ***************************************************************************
#ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER
@@ -18,6 +16,8 @@
// Boost.Test
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/detail/fwd_decl.hpp>
+#include <boost/test/detail/throw_exception.hpp>
+
#include <boost/test/utils/trivial_singleton.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -29,12 +29,16 @@
namespace boost {
+/// Main namespace for the Unit Test Framework interfaces and implementation
namespace unit_test {
// ************************************************************************** //
// ************** init_unit_test_func ************** //
// ************************************************************************** //
+/// Test module initialization routine signature
+
+/// Different depending on whether BOOST_TEST_ALTERNATIVE_INIT_API is defined or not
#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
typedef bool (*init_unit_test_func)();
#else
@@ -45,67 +49,225 @@ typedef test_suite* (*init_unit_test_func)( int, char* [] );
// ************** framework ************** //
// ************************************************************************** //
+/// Namespace of the Unit Test Framework mono-state
namespace framework {
-// initialization
-BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] );
-BOOST_TEST_DECL bool is_initialized();
+/// @name Unit Test Framework initialization and shutdown
+/// @{
+
+/// @brief This function performs initialization of the framework mono-state.
+///
+/// It needs to be called every time before the test is started.
+/// @param[in] init_func test module initialization routine
+/// @param[in] argc command line arguments collection
+/// @param[in] argv command line arguments collection
+BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] );
+
+/// This function applies all the decorators and figures out default run status. This argument facilitates an
+/// ability of the test cases to prepare some other test units (primarily used internally for self testing).
+/// @param[in] tu Optional id of the test unit representing root of test tree. If absent, master test suite is used
+BOOST_TEST_DECL void finalize_setup_phase( test_unit_id tu = INV_TEST_UNIT_ID);
+
+/// This function returns true when testing is in progress (setup is finished).
+BOOST_TEST_DECL bool test_in_progress();
+
+/// This function shuts down the framework and clears up its mono-state.
+///
+/// It needs to be at the very end of test module execution
+BOOST_TEST_DECL void shutdown();
+/// @}
+
+/// @name Test unit registration
+/// @{
+
+/// Provides both read and write access to current "leaf" auto test suite during the test unit registration phase.
+///
+/// During auto-registration phase the framework maintain a FIFO queue of test units being registered. New test units become children
+/// of the current "leaf" test suite and if this is test suite it is pushed back into queue and becomes a new leaf.
+/// When test suite registration is completed, a test suite is popped from the back of the queue. Only automatically registered test suites
+/// should be added to this queue. Master test suite is always a zero element in this queue, so if no other test suites are registered
+/// all test cases are added to master test suite.
+
+/// This function facilitates all three possible actions:
+/// - if no argument are provided it returns the current queue leaf test suite
+/// - if test suite is provided and no second argument are set, test suite is added to the queue
+/// - if no test suite are provided and last argument is false, the semantic of this function is similar to queue pop: last element is popped from the queue
+/// @param[in] ts test suite to push back to the queue
+/// @param[in] push_or_pop should we push ts to the queue or pop leaf test suite instead
+/// @returns a reference to the currently active/"leaf" test suite
+BOOST_TEST_DECL test_suite& current_auto_test_suite( test_suite* ts = 0, bool push_or_pop = true );
+
+/// This function add new test case into the global collection of test units the framework aware of.
+
+/// This function also assignes unique test unit id for every test case. Later on one can use this id to locate
+/// the test case if necessary. This is the way for the framework to maintain weak references between test units.
+/// @param[in] tc test case to register
+BOOST_TEST_DECL void register_test_unit( test_case* tc );
+
+/// This function add new test suite into the global collection of test units the framework aware of.
+
+/// This function also assignes unique test unit id for every test suite. Later on one can use this id to locate
+/// the test case if necessary. This is the way for the framework to maintain weak references between test units.
+/// @param[in] ts test suite to register
+BOOST_TEST_DECL void register_test_unit( test_suite* ts );
+
+/// This function removes the test unit from the collection of known test units and destroys the test unit object.
+
+/// This function also assigns unique test unit id for every test case. Later on one can use this id to located
+/// the test case if necessary. This is the way for the framework to maintain weak references between test units.
+/// @param[in] tu test unit to deregister
+BOOST_TEST_DECL void deregister_test_unit( test_unit* tu );
+
+// This function clears up the framework mono-state.
+
+/// Afer this call the framework can be reinitialized to perform a second test run during the same program lifetime.
+BOOST_TEST_DECL void clear();
+/// @}
+
+/// @name Test observer registration
+/// @{
+/// Adds new test execution observer object into the framework's list of test observers.
+
+/// Observer lifetime should exceed the the testing execution timeframe
+/// @param[in] to test observer object to add
+BOOST_TEST_DECL void register_observer( test_observer& to );
+
+/// Excldes the observer object form the framework's list of test observers
+/// @param[in] to test observer object to exclude
+BOOST_TEST_DECL void deregister_observer( test_observer& to );
+
+/// @}
+
+/// @name Assertion/uncaught exception context support
+/// @{
+/// Context accessor
+struct BOOST_TEST_DECL context_generator {
+ context_generator() : m_curr_frame( 0 ) {}
+
+ /// Is there any context?
+ bool is_empty() const;
+
+ /// Give me next frame; empty - last frame
+ const_string next() const;
+
+private:
+ // Data members
+ mutable unsigned m_curr_frame;
+};
+
+/// Records context frame message.
-// mutation access methods
-BOOST_TEST_DECL void register_test_unit( test_case* tc );
-BOOST_TEST_DECL void register_test_unit( test_suite* ts );
-BOOST_TEST_DECL void deregister_test_unit( test_unit* tu );
-BOOST_TEST_DECL void clear();
+/// Some context frames are sticky - they can only explicitly cleared by specifying context id. Other (non sticky) context frames cleared after every assertion.
+/// @param[in] context_descr context frame message
+/// @param[in] sticky is this sticky frame or not
+/// @returns id of the newly created frame
+BOOST_TEST_DECL int add_context( lazy_ostream const& context_descr, bool sticky );
+/// Erases context frame (when test exits context scope)
-BOOST_TEST_DECL void register_observer( test_observer& );
-BOOST_TEST_DECL void deregister_observer( test_observer& );
-BOOST_TEST_DECL void reset_observers();
+/// If context_id is passed clears that specific context frame identified by this id, otherwise clears all non sticky contexts.
+BOOST_TEST_DECL void clear_context( int context_id = -1 );
+/// Produces an instance of small "delegate" object, which facilitates access to collected context.
+BOOST_TEST_DECL context_generator get_context();
+/// @}
+/// @name Access to registered test units.
+/// @{
+/// This function provides access to the master test suite.
+
+/// There is only only master test suite per test module.
+/// @returns a reference the master test suite instance
BOOST_TEST_DECL master_test_suite_t& master_test_suite();
-// constant access methods
+/// This function provides an access to the test case currently being executed.
+
+/// This function is only valid during test execution phase.
+/// @see current_test_case_id
BOOST_TEST_DECL test_case const& current_test_case();
-BOOST_TEST_DECL test_unit& get( test_unit_id, test_unit_type );
+/// This function provides an access to an id of the test case currently being executed.
+
+/// This function safer than current_test_case, cause if wont throw if no test case is being executed.
+/// @see current_test_case
+BOOST_TEST_DECL test_unit_id current_test_case_id(); /* safe version of above */
+
+/// This function provides access to a test unit by id and type combination. It will throw if no test unit located.
+/// @param[in] tu_id id of a test unit to locate
+/// @param[in] tu_type type of a test unit to locate
+/// @returns located test unit
+BOOST_TEST_DECL test_unit& get( test_unit_id tu_id, test_unit_type tu_type );
+
+/// This function template provides access to a typed test unit by id
+
+/// It will throw if you specify incorrect test unit type
+/// @tparam UnitType compile time type of test unit to get (test_suite or test_case)
+/// @param id id of test unit to get
template<typename UnitType>
-UnitType& get( test_unit_id id )
+inline UnitType& get( test_unit_id id )
{
return static_cast<UnitType&>( get( id, static_cast<test_unit_type>(UnitType::type) ) );
}
-
-// test initiation
-BOOST_TEST_DECL void run( test_unit_id = INV_TEST_UNIT_ID, bool continue_test = true );
-BOOST_TEST_DECL void run( test_unit const*, bool continue_test = true );
-
-// public test events dispatchers
-BOOST_TEST_DECL void assertion_result( bool passed );
-BOOST_TEST_DECL void exception_caught( execution_exception const& );
-BOOST_TEST_DECL void test_unit_aborted( test_unit const& );
+///@}
+
+/// @name Test initiation interface
+/// @{
+
+/// Initiates test execution
+
+/// This function is used to start the test execution from a specific "root" test unit.
+/// If no root provided, test is started from master test suite. This second argument facilitates an ability of the test cases to
+/// start some other test units (primarily used internally for self testing).
+/// @param[in] tu Optional id of the test unit or test unit itself from which the test is started. If absent, master test suite is used
+/// @param[in] continue_test true == continue test if it was already started, false == restart the test from scratch regardless
+BOOST_TEST_DECL void run( test_unit_id tu = INV_TEST_UNIT_ID, bool continue_test = true );
+/// Initiates test execution. Same as other overload
+BOOST_TEST_DECL void run( test_unit const* tu, bool continue_test = true );
+/// @}
+
+/// @name Test events dispatchers
+/// @{
+/// Reports results of assertion to all test observers
+BOOST_TEST_DECL void assertion_result( unit_test::assertion_result ar );
+/// Reports uncaught exception to all test observers
+BOOST_TEST_DECL void exception_caught( execution_exception const& );
+/// Reports aborted test unit to all test observers
+BOOST_TEST_DECL void test_unit_aborted( test_unit const& );
+/// @}
+
+namespace impl {
+// exclusively for self test
+BOOST_TEST_DECL void setup_for_execution( test_unit const& );
+} // namespace impl
// ************************************************************************** //
// ************** framework errors ************** //
// ************************************************************************** //
-struct internal_error : std::runtime_error {
+/// This exception type is used to report internal Boost.Test framework errors.
+struct BOOST_TEST_DECL internal_error : public std::runtime_error {
internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {}
};
-struct setup_error : std::runtime_error {
+//____________________________________________________________________________//
+
+/// This exception type is used to report test module setup errors.
+struct BOOST_TEST_DECL setup_error : public std::runtime_error {
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 )
+#define BOOST_TEST_SETUP_ASSERT( cond, msg ) \
+ if( cond ) {} \
+ else BOOST_TEST_IMPL_THROW( unit_test::framework::setup_error( msg ) )
+
+//____________________________________________________________________________//
struct nothing_to_test {}; // not really an error
-} // namespace framework
+//____________________________________________________________________________//
+} // namespace framework
} // unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_FRAMEWORK_HPP_020805GER
diff --git a/boost/test/impl/compiler_log_formatter.ipp b/boost/test/impl/compiler_log_formatter.ipp
index 8fc08ccf44..c1ed944ab1 100644
--- a/boost/test/impl/compiler_log_formatter.ipp
+++ b/boost/test/impl/compiler_log_formatter.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -16,11 +16,14 @@
#define BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER
// Boost.Test
-#include <boost/test/output/compiler_log_formatter.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
#include <boost/test/framework.hpp>
+#include <boost/test/execution_monitor.hpp>
+#include <boost/test/tree/test_unit.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>
#include <boost/test/utils/lazy_ostream.hpp>
+#include <boost/test/utils/setcolor.hpp>
+#include <boost/test/output/compiler_log_formatter.hpp>
+#include <boost/test/unit_test_parameters.hpp>
// Boost
#include <boost/version.hpp>
@@ -33,9 +36,7 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
// ************************************************************************** //
@@ -44,12 +45,10 @@ namespace output {
namespace {
-const_string
+std::string
test_phase_identifier()
{
- return framework::is_initialized()
- ? const_string( framework::current_test_case().p_name.get() )
- : BOOST_TEST_L( "Test setup" );
+ return framework::test_in_progress() ? framework::current_test_case().full_name() : std::string( "Test setup" );
}
} // local namespace
@@ -90,6 +89,10 @@ compiler_log_formatter::log_build_info( std::ostream& output )
void
compiler_log_formatter::test_unit_start( std::ostream& output, test_unit const& tu )
{
+ BOOST_TEST_SCOPE_SETCOLOR( output, term_attr::BRIGHT, term_color::BLUE );
+
+ print_prefix( output, tu.p_file_name, tu.p_line_num );
+
output << "Entering test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl;
}
@@ -98,6 +101,10 @@ compiler_log_formatter::test_unit_start( std::ostream& output, test_unit const&
void
compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long elapsed )
{
+ BOOST_TEST_SCOPE_SETCOLOR( output, term_attr::BRIGHT, term_color::BLUE );
+
+ print_prefix( output, tu.p_file_name, tu.p_line_num );
+
output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\"";
if( elapsed > 0 ) {
@@ -105,7 +112,7 @@ compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const&
if( elapsed % 1000 == 0 )
output << elapsed/1000 << "ms";
else
- output << elapsed << "mks";
+ output << elapsed << "us";
}
output << std::endl;
@@ -114,31 +121,48 @@ compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const&
//____________________________________________________________________________//
void
-compiler_log_formatter::test_unit_skipped( std::ostream& output, test_unit const& tu )
+compiler_log_formatter::test_unit_skipped( std::ostream& output, test_unit const& tu, const_string reason )
{
- output << "Test " << tu.p_type_name << " \"" << tu.p_name << "\"" << "is skipped" << std::endl;
+ BOOST_TEST_SCOPE_SETCOLOR( output, term_attr::BRIGHT, term_color::YELLOW );
+
+ print_prefix( output, tu.p_file_name, tu.p_line_num );
+
+ output << "Test " << tu.p_type_name << " \"" << tu.full_name() << "\"" << " is skipped because " << reason << std::endl;
}
-
+
//____________________________________________________________________________//
void
-compiler_log_formatter::log_exception( std::ostream& output, log_checkpoint_data const& checkpoint_data, execution_exception const& ex )
+compiler_log_formatter::log_exception_start( std::ostream& output, log_checkpoint_data const& checkpoint_data, execution_exception const& ex )
{
execution_exception::location const& loc = ex.where();
+
print_prefix( output, loc.m_file_name, loc.m_line_num );
- output << "fatal error in \"" << (loc.m_function.is_empty() ? test_phase_identifier() : loc.m_function ) << "\": ";
+ {
+ BOOST_TEST_SCOPE_SETCOLOR( output, term_attr::BLINK, term_color::RED );
- output << ex.what();
+ output << "fatal error: in \"" << (loc.m_function.is_empty() ? test_phase_identifier() : loc.m_function ) << "\": "
+ << ex.what();
+ }
if( !checkpoint_data.m_file_name.is_empty() ) {
output << '\n';
print_prefix( output, checkpoint_data.m_file_name, checkpoint_data.m_line_num );
+
+ BOOST_TEST_SCOPE_SETCOLOR( output, term_attr::BRIGHT, term_color::CYAN );
+
output << "last checkpoint";
if( !checkpoint_data.m_message.empty() )
output << ": " << checkpoint_data.m_message;
}
-
+}
+
+//____________________________________________________________________________//
+
+void
+compiler_log_formatter::log_exception_finish( std::ostream& output )
+{
output << std::endl;
}
@@ -150,21 +174,31 @@ compiler_log_formatter::log_entry_start( std::ostream& output, log_entry_data co
switch( let ) {
case BOOST_UTL_ET_INFO:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
+ if( runtime_config::color_output() )
+ output << setcolor( term_attr::BRIGHT, term_color::GREEN );
output << "info: ";
break;
case BOOST_UTL_ET_MESSAGE:
+ if( runtime_config::color_output() )
+ output << setcolor( term_attr::BRIGHT, term_color::CYAN );
break;
case BOOST_UTL_ET_WARNING:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
- output << "warning in \"" << test_phase_identifier() << "\": ";
+ if( runtime_config::color_output() )
+ output << setcolor( term_attr::BRIGHT, term_color::YELLOW );
+ output << "warning: in \"" << test_phase_identifier() << "\": ";
break;
case BOOST_UTL_ET_ERROR:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
- output << "error in \"" << test_phase_identifier() << "\": ";
+ if( runtime_config::color_output() )
+ output << setcolor( term_attr::BRIGHT, term_color::RED );
+ output << "error: in \"" << test_phase_identifier() << "\": ";
break;
case BOOST_UTL_ET_FATAL_ERROR:
print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
- output << "fatal error in \"" << test_phase_identifier() << "\": ";
+ if( runtime_config::color_output() )
+ output << setcolor( term_attr::BLINK, term_color::RED );
+ output << "fatal error: in \"" << test_phase_identifier() << "\": ";
break;
}
}
@@ -190,33 +224,60 @@ compiler_log_formatter::log_entry_value( std::ostream& output, lazy_ostream cons
void
compiler_log_formatter::log_entry_finish( std::ostream& output )
{
+ if( runtime_config::color_output() )
+ output << setcolor();
+
output << std::endl;
}
+
//____________________________________________________________________________//
void
-compiler_log_formatter::print_prefix( std::ostream& output, const_string file, std::size_t line )
+compiler_log_formatter::print_prefix( std::ostream& output, const_string file_name, std::size_t line_num )
{
+ if( !file_name.empty() )
+ {
#ifdef __APPLE_CC__
- // Xcode-compatible logging format, idea by Richard Dingwall at
- // <http://richarddingwall.name/2008/06/01/using-the-boost-unit-test-framework-with-xcode-3/>.
- output << file << ':' << line << ": ";
+ // Xcode-compatible logging format, idea by Richard Dingwall at
+ // <http://richarddingwall.name/2008/06/01/using-the-boost-unit-test-framework-with-xcode-3/>.
+ output << file_name << ':' << line_num << ": ";
#else
- output << file << '(' << line << "): ";
+ output << file_name << '(' << line_num << "): ";
#endif
+ }
}
//____________________________________________________________________________//
-} // namespace output
+void
+compiler_log_formatter::entry_context_start( std::ostream& output, log_level l )
+{
+ output << (l == log_successful_tests ? "\nAssertion" : "\nFailure" ) << " occurred in a following context:";
+}
-} // namespace unit_test
+//____________________________________________________________________________//
-} // namespace boost
+void
+compiler_log_formatter::entry_context_finish( std::ostream& output )
+{
+ output.flush();
+}
//____________________________________________________________________________//
+void
+compiler_log_formatter::log_entry_context( std::ostream& output, const_string context_descr )
+{
+ output << "\n " << context_descr;
+}
+
+//____________________________________________________________________________//
+
+} // namespace output
+} // namespace unit_test
+} // namespace boost
+
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER
diff --git a/boost/test/impl/cpp_main.ipp b/boost/test/impl/cpp_main.ipp
index 23d19e2f31..5cab0f4274 100644
--- a/boost/test/impl/cpp_main.ipp
+++ b/boost/test/impl/cpp_main.ipp
@@ -1,7 +1,7 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// (C) Copyright Beman Dawes 1995-2001.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -41,18 +41,18 @@ namespace std { using ::getenv; using ::strerror; }
namespace {
struct cpp_main_caller {
- cpp_main_caller( int (*cpp_main_func)( int argc, char* argv[] ), int argc, char** argv )
+ cpp_main_caller( int (*cpp_main_func)( int argc, char* argv[] ), int argc, char** argv )
: m_cpp_main_func( cpp_main_func )
, m_argc( argc )
, m_argv( argv ) {}
-
- int operator()() { return (*m_cpp_main_func)( m_argc, m_argv ); }
-
+
+ int operator()() { return (*m_cpp_main_func)( m_argc, m_argv ); }
+
private:
- // Data members
- int (*m_cpp_main_func)( int argc, char* argv[] );
- int m_argc;
- char** m_argv;
+ // Data members
+ int (*m_cpp_main_func)( int argc, char* argv[] );
+ int m_argc;
+ char** m_argv;
};
} // local namespace
@@ -68,15 +68,14 @@ prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char
{
int result = 0;
- try {
+ BOOST_TEST_IMPL_TRY {
boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) );
::boost::execution_monitor ex_mon;
ex_mon.p_catch_system_errors.value = p != "no";
-
- result = ex_mon.execute(
- ::boost::unit_test::callback0<int>( cpp_main_caller( cpp_main, argc, argv ) ) );
-
+
+ result = ex_mon.execute( cpp_main_caller( cpp_main, argc, argv ) );
+
if( result == 0 )
result = ::boost::exit_success;
else if( result != ::boost::exit_success ) {
@@ -84,13 +83,13 @@ prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char
result = ::boost::exit_failure;
}
}
- catch( ::boost::execution_exception const& exex ) {
+ BOOST_TEST_IMPL_CATCH( ::boost::execution_exception, exex ) {
std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl;
result = ::boost::exit_exception_failure;
}
- catch( ::boost::system_error const& ex ) {
+ BOOST_TEST_IMPL_CATCH( ::boost::system_error, ex ) {
std::cout << "\n**** failed to initialize execution monitor."
- << "\n**** expression at fault: " << ex.p_failed_exp
+ << "\n**** expression at fault: " << ex.p_failed_exp
<< "\n**** error(" << ex.p_errno << "): " << std::strerror( ex.p_errno ) << std::endl;
result = ::boost::exit_exception_failure;
}
@@ -104,8 +103,8 @@ prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char
// line argument modifications; for use in production programs
// that's a no-no in some organizations.
::boost::unit_test::const_string p( std::getenv( "BOOST_PRG_MON_CONFIRM" ) );
- if( p != "no" ) {
- std::cerr << std::flush << "no errors detected" << std::endl;
+ if( p != "no" ) {
+ std::cerr << std::flush << "no errors detected" << std::endl;
}
}
@@ -132,8 +131,6 @@ main( int argc, char* argv[] )
#endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_CPP_MAIN_IPP_012205GER
diff --git a/boost/test/impl/debug.ipp b/boost/test/impl/debug.ipp
index 78c3aa8e38..90e9d7ff2f 100644
--- a/boost/test/impl/debug.ipp
+++ b/boost/test/impl/debug.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2006-2008.
+// (C) Copyright Gennadiy Rozental 2006-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// http://www.boost.org/LICENSE_1_0.txt)
@@ -40,10 +40,6 @@
# endif
-# if BOOST_WORKAROUND( BOOST_MSVC, <1300)
-# define snprintf _snprintf
-# endif
-
# ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::memset; using ::sprintf; }
# endif
@@ -113,7 +109,6 @@ namespace std { using ::memset; using ::sprintf; }
//____________________________________________________________________________//
namespace boost {
-
namespace debug {
using unit_test::const_string;
@@ -210,10 +205,11 @@ private:
#if defined(BOOST_SUN_BASED_DEBUG)
struct psinfo m_psi;
+ char m_binary_path_buff[500+1]; // !! ??
#elif defined(BOOST_LINUX_BASED_DEBUG)
char m_stat_line[BOOST_TEST_STAT_LINE_MAX+1];
-#endif
char m_binary_path_buff[500+1]; // !! ??
+#endif
};
//____________________________________________________________________________//
@@ -239,12 +235,12 @@ process_info::process_info( int pid )
m_binary_name.assign( m_psi.pr_fname );
//-------------------------- //
-
+
::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/as", pid );
fd_holder as_fd( ::open( fname_buff, O_RDONLY ) );
uintptr_t binary_name_pos;
-
+
// !! ?? could we avoid reading whole m_binary_path_buff?
if( as_fd == -1 ||
::lseek( as_fd, m_psi.pr_argv, SEEK_SET ) == -1 ||
@@ -252,9 +248,9 @@ process_info::process_info( int pid )
::lseek( as_fd, binary_name_pos, SEEK_SET ) == -1 ||
::read ( as_fd, m_binary_path_buff, sizeof(m_binary_path_buff) ) == -1 )
return;
-
+
m_binary_path.assign( m_binary_path_buff );
-
+
#elif defined(BOOST_LINUX_BASED_DEBUG)
char fname_buff[30];
@@ -377,8 +373,10 @@ safe_execlp( char const* file, ... )
va_start( args, file );
while( !!(arg = va_arg( args, char const* )) ) {
printf( "!! %s\n", arg );
- if( !(*argv_it++ = copy_arg( work_buff, arg )) )
+ if( !(*argv_it++ = copy_arg( work_buff, arg )) ) {
+ va_end( args );
return false;
+ }
}
va_end( args );
@@ -440,7 +438,7 @@ prepare_gdb_cmnd_file( dbg_startup_info const& dsi )
WRITE_CSTR( "\ncont" );
if( dsi.break_or_continue )
WRITE_CSTR( "\nup 4" );
-
+
WRITE_CSTR( "\necho \\n" ); // !! ??
WRITE_CSTR( "\nlist -" );
WRITE_CSTR( "\nlist" );
@@ -513,9 +511,9 @@ prepare_dbx_cmd_line( dbg_startup_info const& dsi, bool list_source = true )
{
static char cmd_line_buff[500]; // !! ??
- ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s",
- dsi.init_done_lock.begin(),
- dsi.break_or_continue ? "up 2;": "",
+ ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s",
+ dsi.init_done_lock.begin(),
+ dsi.break_or_continue ? "up 2;": "",
list_source ? "echo \" \";list -w3;" : "" );
return cmd_line_buff;
@@ -543,8 +541,8 @@ start_dbx_in_xterm( dbg_startup_info const& dsi )
char pid_buff[16]; // !! ??
::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );
-
- safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(),
+
+ safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(),
"-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e",
"dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 );
}
@@ -580,7 +578,7 @@ start_dbx_in_ddd( dbg_startup_info const& dsi )
char pid_buff[16]; // !! ??
::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );
-
+
safe_execlp( "ddd", "-display", dsi.display.begin(),
"--dbx", "-q", "-c", prepare_dbx_cmd_line( dsi, false ), dsi.binary_path.begin(), pid_buff, 0 );
}
@@ -597,7 +595,7 @@ static struct info_t {
// Public properties
unit_test::readwrite_property<std::string> p_dbg;
-
+
// Data members
std::map<std::string,dbg_starter> m_dbg_starter_reg;
} s_info;
@@ -609,7 +607,7 @@ info_t::info_t()
p_dbg.value = ::getenv( "DISPLAY" )
? std::string( BOOST_STRINGIZE( BOOST_TEST_GUI_DBG ) )
: std::string( BOOST_STRINGIZE( BOOST_TEST_CNL_DBG ) );
-
+
m_dbg_starter_reg[std::string("gdb")] = &start_gdb_in_console;
m_dbg_starter_reg[std::string("gdb-emacs")] = &start_gdb_in_emacs;
m_dbg_starter_reg[std::string("gdb-xterm")] = &start_gdb_in_xterm;
@@ -679,8 +677,7 @@ debugger_break()
#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1300) || \
- BOOST_WORKAROUND(__GNUC__, >= 3) && !defined(__MINGW32__) || \
+#if defined(__GNUC__) && !defined(__MINGW32__) || \
defined(__INTEL_COMPILER)
# define BOOST_DEBUG_BREAK __debugbreak
#else
@@ -734,7 +731,7 @@ set_debugger( unit_test::const_string dbg_id, dbg_starter s )
assign_op( s_info.p_dbg.value, dbg_id, 0 );
if( !!s )
- s_info.m_dbg_starter_reg[s_info.p_dbg] = s;
+ s_info.m_dbg_starter_reg[s_info.p_dbg.get()] = s;
return old;
}
@@ -864,7 +861,7 @@ attach_debugger( bool break_or_continue )
if( init_done_lock_fd == -1 )
return false;
-
+
pid_t child_pid = fork();
if( child_pid == -1 )
@@ -872,7 +869,7 @@ attach_debugger( bool break_or_continue )
if( child_pid != 0 ) { // parent process - here we will start the debugger
dbg_startup_info dsi;
-
+
process_info pi( child_pid );
if( pi.binary_path().is_empty() )
::exit( -1 );
@@ -882,7 +879,7 @@ attach_debugger( bool break_or_continue )
dsi.binary_path = pi.binary_path();
dsi.display = ::getenv( "DISPLAY" );
dsi.init_done_lock = init_done_lock_fn;
-
+
dbg_starter starter = s_info.m_dbg_starter_reg[s_info.p_dbg];
if( !!starter )
starter( dsi );
@@ -922,7 +919,7 @@ attach_debugger( bool break_or_continue )
// ************************************************************************** //
void
-detect_memory_leaks( bool on_off )
+detect_memory_leaks( bool on_off, unit_test::const_string report_file )
{
unit_test::ut_detail::ignore_unused_variable_warning( on_off );
@@ -934,10 +931,19 @@ detect_memory_leaks( bool on_off )
else {
flags |= _CRTDBG_LEAK_CHECK_DF;
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
- _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
+
+ if( report_file.is_empty() )
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ else {
+ HANDLE hreport_f = ::CreateFileA( report_file.begin(),
+ GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ _CrtSetReportFile(_CRT_WARN, hreport_f );
+ }
}
_CrtSetDbgFlag ( flags );
+#else
+ unit_test::ut_detail::ignore_unused_variable_warning( report_file );
#endif // BOOST_MS_CRT_BASED_DEBUG
}
@@ -954,16 +960,17 @@ break_memory_alloc( long mem_alloc_order_num )
unit_test::ut_detail::ignore_unused_variable_warning( mem_alloc_order_num );
#ifdef BOOST_MS_CRT_BASED_DEBUG
- _CrtSetBreakAlloc( mem_alloc_order_num );
+ // only set the value if one was supplied (do not use default used by UTF just as a indicator to enable leak detection)
+ if( mem_alloc_order_num > 1 )
+ _CrtSetBreakAlloc( mem_alloc_order_num );
#endif // BOOST_MS_CRT_BASED_DEBUG
}
-} // namespace debug
+//____________________________________________________________________________//
+} // namespace debug
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_DEBUG_API_IPP_112006GER
diff --git a/boost/test/impl/decorator.ipp b/boost/test/impl/decorator.ipp
new file mode 100644
index 0000000000..bf17907881
--- /dev/null
+++ b/boost/test/impl/decorator.ipp
@@ -0,0 +1,202 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision$
+//
+// Description : unit test decorators implementation
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_DECORATOR_IPP_091911GER
+#define BOOST_TEST_TREE_DECORATOR_IPP_091911GER
+
+// Boost.Test
+#include <boost/test/tree/decorator.hpp>
+#include <boost/test/tree/test_unit.hpp>
+
+#include <boost/test/framework.hpp>
+#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR
+#include <boost/test/utils/iterator/token_iterator.hpp>
+#endif
+
+#include <boost/test/detail/throw_exception.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace decorator {
+
+// ************************************************************************** //
+// ************** decorator::collector ************** //
+// ************************************************************************** //
+
+collector&
+collector::operator*( base const& d )
+{
+ m_tu_decorators.push_back( d.clone() );
+
+ return *this;
+}
+
+//____________________________________________________________________________//
+
+void
+collector::store_in( test_unit& tu )
+{
+ tu.p_decorators.value.insert( tu.p_decorators.value.end(), m_tu_decorators.begin(), m_tu_decorators.end() );
+}
+
+//____________________________________________________________________________//
+
+void
+collector::reset()
+{
+ m_tu_decorators.clear();
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::base ************** //
+// ************************************************************************** //
+
+collector&
+base::operator*() const
+{
+ return collector::instance() * *this;
+}
+
+// ************************************************************************** //
+// ************** decorator::label ************** //
+// ************************************************************************** //
+
+void
+label::apply( test_unit& tu )
+{
+ tu.add_label( m_label );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::expected_failures ************** //
+// ************************************************************************** //
+
+void
+expected_failures::apply( test_unit& tu )
+{
+ tu.increase_exp_fail( m_exp_fail );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::timeout ************** //
+// ************************************************************************** //
+
+void
+timeout::apply( test_unit& tu )
+{
+ tu.p_timeout.value = m_timeout;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::description ************** //
+// ************************************************************************** //
+
+void
+description::apply( test_unit& tu )
+{
+ tu.p_description.value += m_description;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::depends_on ************** //
+// ************************************************************************** //
+
+void
+depends_on::apply( test_unit& tu )
+{
+#if !BOOST_TEST_SUPPORT_TOKEN_ITERATOR
+ BOOST_TEST_SETUP_ASSERT( false, "depends_on decorator is not supported on this platform" );
+#else
+ string_token_iterator tit( m_dependency, (dropped_delimeters = "/", kept_delimeters = dt_none) );
+
+ test_unit* dep = &framework::master_test_suite();
+ while( tit != string_token_iterator() ) {
+ BOOST_TEST_SETUP_ASSERT( dep->p_type == TUT_SUITE, std::string( "incorrect dependency specification " ) + m_dependency );
+
+ test_unit_id next_id = static_cast<test_suite*>(dep)->get( *tit );
+
+ BOOST_TEST_SETUP_ASSERT( next_id != INV_TEST_UNIT_ID,
+ std::string( "incorrect dependency specification " ) + m_dependency );
+
+ dep = &framework::get( next_id, TUT_ANY );
+ ++tit;
+ }
+
+ tu.depends_on( dep );
+#endif
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::enable_if/enabled/disabled ************** //
+// ************************************************************************** //
+
+void
+enable_if_impl::apply_impl( test_unit& tu, bool condition )
+{
+ BOOST_TEST_SETUP_ASSERT(tu.p_default_status == test_unit::RS_INHERIT,
+ "Can't apply multiple enabled/disabled decorators "
+ "to the same test unit " + tu.full_name());
+
+ tu.p_default_status.value = condition ? test_unit::RS_ENABLED : test_unit::RS_DISABLED;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::fixture ************** //
+// ************************************************************************** //
+
+void
+fixture_t::apply( test_unit& tu )
+{
+ tu.p_fixtures.value.push_back( m_impl );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::depends_on ************** //
+// ************************************************************************** //
+
+void
+precondition::apply( test_unit& tu )
+{
+ tu.add_precondition( m_precondition );
+}
+
+//____________________________________________________________________________//
+
+} // namespace decorator
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_DECORATOR_IPP_091911GER
diff --git a/boost/test/impl/exception_safety.ipp b/boost/test/impl/exception_safety.ipp
deleted file mode 100644
index 7f0afcb457..0000000000
--- a/boost/test/impl/exception_safety.ipp
+++ /dev/null
@@ -1,537 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Facilities to perform exception safety tests
-// ***************************************************************************
-
-#ifndef BOOST_TEST_EXECUTION_SAFETY_IPP_112005GER
-#define BOOST_TEST_EXECUTION_SAFETY_IPP_112005GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-
-#if BOOST_TEST_SUPPORT_INTERACTION_TESTING
-
-#include <boost/test/detail/global_typedef.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
-
-#include <boost/test/utils/callback.hpp>
-#include <boost/test/utils/wrap_stringstream.hpp>
-#include <boost/test/utils/iterator/token_iterator.hpp>
-
-#include <boost/test/interaction_based.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test_log.hpp>
-#include <boost/test/framework.hpp>
-#include <boost/test/test_observer.hpp>
-#include <boost/test/debug.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-// Boost
-#include <boost/lexical_cast.hpp>
-
-// STL
-#include <vector>
-#include <cstdlib>
-#include <map>
-#include <iomanip>
-#include <cctype>
-#include <boost/limits.hpp>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-using namespace ::boost::unit_test;
-
-namespace itest {
-
-// ************************************************************************** //
-// ************** execution_path_point ************** //
-// ************************************************************************** //
-
-enum exec_path_point_type { EPP_SCOPE, EPP_EXCEPT, EPP_DECISION, EPP_ALLOC };
-
-struct execution_path_point {
- execution_path_point( exec_path_point_type t, const_string file, std::size_t line_num )
- : m_type( t )
- , m_file_name( file )
- , m_line_num( line_num )
- {}
-
- exec_path_point_type m_type;
- const_string m_file_name;
- std::size_t m_line_num;
-
- // Execution path point specific
- struct decision_data {
- bool value;
- unsigned forced_exception_point;
- };
- struct scope_data {
- unsigned size;
- char const* name;
- };
- struct except_data {
- char const* description;
- };
- struct alloc_data {
- void* ptr;
- std::size_t size;
- };
-
- union {
- struct decision_data m_decision;
- struct scope_data m_scope;
- struct except_data m_except;
- struct alloc_data m_alloc;
- };
-};
-
-// ************************************************************************** //
-// ************** exception safety test implementation ************** //
-// ************************************************************************** //
-
-struct exception_safety_tester : itest::manager, test_observer {
- // helpers types
- struct unique_exception {};
-
- // Constructor
- explicit exception_safety_tester( const_string test_name );
- ~exception_safety_tester();
-
- // check last run and prepare for next
- bool next_execution_path();
-
- // memory tracking
-
- // manager interface implementation
- virtual void exception_point( const_string file, std::size_t line_num, const_string description );
- virtual bool decision_point( const_string file, std::size_t line_num );
- virtual unsigned enter_scope( const_string file, std::size_t line_num, const_string scope_name );
- virtual void leave_scope( unsigned enter_scope_point );
- virtual void allocated( const_string file, std::size_t line_num, void* p, std::size_t s );
- virtual void freed( void* p );
-
- // test observer interface
- virtual void assertion_result( bool passed );
- virtual int priority() { return (std::numeric_limits<int>::max)(); } // we want this observer to run the last
-
-private:
- void failure_point();
- void report_error();
-
- typedef std::vector<execution_path_point> exec_path;
- typedef std::map<void*,unsigned> registry;
-
- // Data members
- bool m_internal_activity;
-
- unsigned m_exception_point_counter;
- unsigned m_forced_exception_point;
-
- unsigned m_exec_path_point;
- exec_path m_execution_path;
-
- unsigned m_exec_path_counter;
- unsigned m_break_exec_path;
-
- bool m_invairant_failed;
- registry m_memory_in_use;
-};
-
-//____________________________________________________________________________//
-
-struct activity_guard {
- bool& m_v;
-
- activity_guard( bool& v ) : m_v( v ) { m_v = true; }
- ~activity_guard() { m_v = false; }
-};
-
-//____________________________________________________________________________//
-
-exception_safety_tester::exception_safety_tester( const_string test_name )
-: m_internal_activity( true )
-, m_exception_point_counter( 0 )
-, m_forced_exception_point( 1 )
-, m_exec_path_point( 0 )
-, m_exec_path_counter( 1 )
-, m_break_exec_path( static_cast<unsigned>(-1) )
-, m_invairant_failed( false )
-{
- framework::register_observer( *this );
-
- if( !runtime_config::break_exec_path().is_empty() ) {
- using namespace unit_test;
-
- string_token_iterator tit( runtime_config::break_exec_path(),
- (dropped_delimeters = ":",kept_delimeters = " ") );
-
- const_string test_to_break = *tit;
-
- if( test_to_break == test_name ) {
- ++tit;
-
- m_break_exec_path = lexical_cast<unsigned>( *tit );
- }
- }
-
- m_internal_activity = false;
-}
-
-//____________________________________________________________________________//
-
-exception_safety_tester::~exception_safety_tester()
-{
- m_internal_activity = true;
-
- framework::deregister_observer( *this );
-}
-
-//____________________________________________________________________________//
-
-bool
-exception_safety_tester::next_execution_path()
-{
- activity_guard ag( m_internal_activity );
-
- // check memory usage
- if( m_execution_path.size() > 0 ) {
- bool errors_detected = m_invairant_failed || (m_memory_in_use.size() != 0);
- framework::assertion_result( !errors_detected );
-
- if( errors_detected )
- report_error();
-
- m_memory_in_use.clear();
- }
-
- m_exec_path_point = 0;
- m_exception_point_counter = 0;
- m_invairant_failed = false;
- ++m_exec_path_counter;
-
- while( m_execution_path.size() > 0 ) {
- switch( m_execution_path.back().m_type ) {
- case EPP_SCOPE:
- case EPP_ALLOC:
- m_execution_path.pop_back();
- break;
-
- case EPP_DECISION:
- if( !m_execution_path.back().m_decision.value ) {
- m_execution_path.pop_back();
- break;
- }
-
- m_execution_path.back().m_decision.value = false;
- m_forced_exception_point = m_execution_path.back().m_decision.forced_exception_point;
- return true;
-
- case EPP_EXCEPT:
- m_execution_path.pop_back();
- ++m_forced_exception_point;
- return true;
- }
- }
-
- BOOST_TEST_MESSAGE( "Total tested " << --m_exec_path_counter << " execution path" );
-
- return false;
-}
-
-//____________________________________________________________________________//
-
-void
-exception_safety_tester::exception_point( const_string file, std::size_t line_num, const_string description )
-{
- activity_guard ag( m_internal_activity );
-
- if( ++m_exception_point_counter == m_forced_exception_point ) {
- m_execution_path.push_back(
- execution_path_point( EPP_EXCEPT, file, line_num ) );
-
- m_execution_path.back().m_except.description = description.begin();
-
- ++m_exec_path_point;
-
- failure_point();
- }
-}
-
-//____________________________________________________________________________//
-
-bool
-exception_safety_tester::decision_point( const_string file, std::size_t line_num )
-{
- activity_guard ag( m_internal_activity );
-
- if( m_exec_path_point < m_execution_path.size() ) {
- BOOST_REQUIRE_MESSAGE( m_execution_path[m_exec_path_point].m_type == EPP_DECISION &&
- m_execution_path[m_exec_path_point].m_file_name == file &&
- m_execution_path[m_exec_path_point].m_line_num == line_num,
- "Function under test exibit non-deterministic behavior" );
- }
- else {
- m_execution_path.push_back(
- execution_path_point( EPP_DECISION, file, line_num ) );
-
- m_execution_path.back().m_decision.value = true;
- m_execution_path.back().m_decision.forced_exception_point = m_forced_exception_point;
- }
-
- return m_execution_path[m_exec_path_point++].m_decision.value;
-}
-
-//____________________________________________________________________________//
-
-unsigned
-exception_safety_tester::enter_scope( const_string file, std::size_t line_num, const_string scope_name )
-{
- activity_guard ag( m_internal_activity );
-
- if( m_exec_path_point < m_execution_path.size() ) {
- BOOST_REQUIRE_MESSAGE( m_execution_path[m_exec_path_point].m_type == EPP_SCOPE &&
- m_execution_path[m_exec_path_point].m_file_name == file &&
- m_execution_path[m_exec_path_point].m_line_num == line_num,
- "Function under test exibit non-deterministic behavior" );
- }
- else {
- m_execution_path.push_back(
- execution_path_point( EPP_SCOPE, file, line_num ) );
- }
-
- m_execution_path[m_exec_path_point].m_scope.size = 0;
- m_execution_path[m_exec_path_point].m_scope.name = scope_name.begin();
-
- return m_exec_path_point++;
-}
-
-//____________________________________________________________________________//
-
-void
-exception_safety_tester::leave_scope( unsigned enter_scope_point )
-{
- activity_guard ag( m_internal_activity );
-
- BOOST_REQUIRE_MESSAGE( m_execution_path[enter_scope_point].m_type == EPP_SCOPE,
- "Function under test exibit non-deterministic behavior" );
-
- m_execution_path[enter_scope_point].m_scope.size = m_exec_path_point - enter_scope_point;
-}
-
-//____________________________________________________________________________//
-
-void
-exception_safety_tester::allocated( const_string file, std::size_t line_num, void* p, std::size_t s )
-{
- if( m_internal_activity )
- return;
-
- activity_guard ag( m_internal_activity );
-
- if( m_exec_path_point < m_execution_path.size() )
- BOOST_REQUIRE_MESSAGE( m_execution_path[m_exec_path_point].m_type == EPP_ALLOC,
- "Function under test exibit non-deterministic behavior" );
- else
- m_execution_path.push_back(
- execution_path_point( EPP_ALLOC, file, line_num ) );
-
- m_execution_path[m_exec_path_point].m_alloc.ptr = p;
- m_execution_path[m_exec_path_point].m_alloc.size = s;
-
- m_memory_in_use.insert( std::make_pair( p, m_exec_path_point++ ) );
-}
-
-//____________________________________________________________________________//
-
-void
-exception_safety_tester::freed( void* p )
-{
- if( m_internal_activity )
- return;
-
- activity_guard ag( m_internal_activity );
-
- registry::iterator it = m_memory_in_use.find( p );
- if( it != m_memory_in_use.end() ) {
- m_execution_path[it->second].m_alloc.ptr = 0;
- m_memory_in_use.erase( it );
- }
-}
-
-//____________________________________________________________________________//
-
-void
-exception_safety_tester::assertion_result( bool passed )
-{
- if( !m_internal_activity && !passed ) {
- m_invairant_failed = true;
-
- failure_point();
- }
-}
-
-//____________________________________________________________________________//
-
-void
-exception_safety_tester::failure_point()
-{
- if( m_exec_path_counter == m_break_exec_path )
- debug::debugger_break();
-
- throw unique_exception();
-}
-
-//____________________________________________________________________________//
-
-namespace {
-
-inline void
-format_location( wrap_stringstream& formatter, execution_path_point const& /*p*/, unsigned indent )
-{
- if( indent )
- formatter << std::left << std::setw( indent ) << "";
-
-// !! ?? optional if( p.m_file_name )
-// formatter << p.m_file_name << '(' << p.m_line_num << "): ";
-}
-
-//____________________________________________________________________________//
-
-template<typename ExecPathIt>
-inline void
-format_execution_path( wrap_stringstream& formatter, ExecPathIt it, ExecPathIt end, unsigned indent = 0 )
-{
- while( it != end ) {
- switch( it->m_type ) {
- case EPP_SCOPE:
- format_location( formatter, *it, indent );
- formatter << "> \"" << it->m_scope.name << "\"\n";
- format_execution_path( formatter, it+1, it + it->m_scope.size, indent + 2 );
- format_location( formatter, *it, indent );
- formatter << "< \"" << it->m_scope.name << "\"\n";
- it += it->m_scope.size;
- break;
-
- case EPP_DECISION:
- format_location( formatter, *it, indent );
- formatter << "Decision made as " << std::boolalpha << it->m_decision.value << '\n';
- ++it;
- break;
-
- case EPP_EXCEPT:
- format_location( formatter, *it, indent );
- formatter << "Forced failure";
- if( it->m_except.description )
- formatter << ": " << it->m_except.description;
- formatter << "\n";
- ++it;
- break;
-
- case EPP_ALLOC:
- if( it->m_alloc.ptr ) {
- format_location( formatter, *it, indent );
- formatter << "Allocated memory block 0x" << std::uppercase << it->m_alloc.ptr
- << ", " << it->m_alloc.size << " bytes long: <";
-
- unsigned i;
- for( i = 0; i < std::min<std::size_t>( it->m_alloc.size, 8 ); i++ ) {
- unsigned char c = static_cast<unsigned char*>(it->m_alloc.ptr)[i];
- if( (std::isprint)( c ) )
- formatter << c;
- else
- formatter << '.';
- }
-
- formatter << "> ";
-
- for( i = 0; i < std::min<std::size_t>( it->m_alloc.size, 8 ); i++ ) {
- unsigned c = static_cast<unsigned char*>(it->m_alloc.ptr)[i];
- formatter << std::hex << std::uppercase << c << ' ';
- }
-
- formatter << "\n";
- }
- ++it;
- break;
- }
- }
-}
-
-//____________________________________________________________________________//
-
-} // local namespace
-
-void
-exception_safety_tester::report_error()
-{
- activity_guard ag( m_internal_activity );
-
- unit_test_log << unit_test::log::begin( m_execution_path.back().m_file_name,
- m_execution_path.back().m_line_num )
- << log_all_errors;
-
- wrap_stringstream formatter;
-
- if( m_invairant_failed )
- formatter << "Failed invariant";
-
- if( m_memory_in_use.size() != 0 ) {
- if( m_invairant_failed )
- formatter << " and ";
-
- formatter << static_cast<unsigned int>(m_memory_in_use.size()) << " memory leak";
- if( m_memory_in_use.size() > 1 )
- formatter << 's';
- }
- formatter << " detected in the execution path " << m_exec_path_counter << ":\n";
-
- format_execution_path( formatter, m_execution_path.begin(), m_execution_path.end() );
-
- unit_test_log << const_string( formatter.str() ) << unit_test::log::end();
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** exception safety test ************** //
-// ************************************************************************** //
-
-void BOOST_TEST_DECL
-exception_safety( callback0<> const& F, const_string test_name )
-{
- exception_safety_tester est( test_name );
-
- do {
- try {
- F();
- }
- catch( exception_safety_tester::unique_exception const& ) {}
-
- } while( est.next_execution_path() );
-}
-
-//____________________________________________________________________________//
-
-} // namespace itest
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // non-ancient compiler
-
-#endif // BOOST_TEST_EXECUTION_SAFETY_IPP_112005GER
diff --git a/boost/test/impl/execution_monitor.ipp b/boost/test/impl/execution_monitor.ipp
index 07484b19d9..9929f74b53 100644
--- a/boost/test/impl/execution_monitor.ipp
+++ b/boost/test/impl/execution_monitor.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// (C) Copyright Beman Dawes and Ullrich Koethe 1995-2001.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
@@ -27,14 +27,18 @@
// Boost.Test
#include <boost/test/detail/config.hpp>
#include <boost/test/detail/workaround.hpp>
+#include <boost/test/detail/throw_exception.hpp>
#include <boost/test/execution_monitor.hpp>
#include <boost/test/debug.hpp>
// Boost
#include <boost/cstdlib.hpp> // for exit codes
#include <boost/config.hpp> // for workarounds
+#include <boost/core/ignore_unused.hpp> // for ignore_unused
+#ifndef BOOST_NO_EXCEPTION
#include <boost/exception/get_error_info.hpp> // for get_error_info
#include <boost/exception/current_exception_cast.hpp> // for current_exception_cast
+#endif
// STL
#include <string> // for std::string
@@ -48,6 +52,8 @@
#include <cstdio> // for vsnprintf
#include <cstdarg> // for varargs
+#include <iostream> // for varargs
+
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::strerror; using ::strlen; using ::strncat; }
#endif
@@ -59,17 +65,12 @@ namespace std { using ::strerror; using ::strlen; using ::strncat; }
using std::va_list;
#endif
-// to use vsnprintf
-#if defined(__QNXNTO__)
-# include <stdio.h>
+// to use vsnprintf
+#if defined(__QNXNTO__)
+# include <stdio.h>
#endif
-#if defined(_WIN32) && !defined(BOOST_DISABLE_WIN32) && \
- (!defined(__COMO__) && !defined(__MWERKS__) && !defined(__GNUC__) || \
- BOOST_WORKAROUND(__MWERKS__, >= 0x3000))
-
-# define BOOST_SEH_BASED_SIGNAL_HANDLING
-
+#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING
# include <windows.h>
# if defined(__MWERKS__) || (defined(_MSC_VER) && !defined(UNDER_CE))
@@ -84,37 +85,12 @@ using std::va_list;
typedef unsigned uintptr_t;
# endif
-# if BOOST_WORKAROUND(_MSC_VER, < 1300 ) || defined(UNDER_CE)
-typedef void* uintptr_t;
+# if defined(UNDER_CE) && BOOST_WORKAROUND(_MSC_VER, < 1500 )
+ typedef void* uintptr_t;
+# elif defined(UNDER_CE)
+# include <crtdefs.h>
# endif
-// for the FP control routines
-#include <float.h>
-
-#ifndef EM_INVALID
-#define EM_INVALID _EM_INVALID
-#endif
-
-#ifndef EM_DENORMAL
-#define EM_DENORMAL _EM_DENORMAL
-#endif
-
-#ifndef EM_ZERODIVIDE
-#define EM_ZERODIVIDE _EM_ZERODIVIDE
-#endif
-
-#ifndef EM_OVERFLOW
-#define EM_OVERFLOW _EM_OVERFLOW
-#endif
-
-#ifndef EM_UNDERFLOW
-#define EM_UNDERFLOW _EM_UNDERFLOW
-#endif
-
-#ifndef MCW_EM
-#define MCW_EM _MCW_EM
-#endif
-
# if !defined(NDEBUG) && defined(_MSC_VER) && !defined(UNDER_CE)
# include <crtdbg.h>
# define BOOST_TEST_CRT_HOOK_TYPE _CRT_REPORT_HOOK
@@ -128,7 +104,8 @@ typedef void* uintptr_t;
# define BOOST_TEST_CRT_SET_HOOK(H) (void*)(H)
# endif
-# if !BOOST_WORKAROUND(_MSC_VER, >= 1400 ) || defined(UNDER_CE)
+# if (!BOOST_WORKAROUND(_MSC_VER, >= 1400 ) && \
+ !defined(BOOST_COMO)) || defined(UNDER_CE)
typedef void* _invalid_parameter_handler;
@@ -154,7 +131,9 @@ namespace { void _set_se_translator( void* ) {} }
# include <signal.h>
# include <setjmp.h>
-# if defined(__FreeBSD__)
+# if defined(__FreeBSD__)
+
+# include <osreldate.h>
# ifndef SIGPOLL
# define SIGPOLL SIGIO
@@ -168,13 +147,17 @@ namespace { void _set_se_translator( void* ) {} }
# define ILL_COPROC ILL_FPOP_FAULT
# define BOOST_TEST_LIMITED_SIGNAL_DETAILS
-# define BOOST_TEST_IGNORE_SIGCHLD
-# endif
-# endif
+# endif
+# endif
+
+# if defined(__ANDROID__)
+# include <android/api-level.h>
+# endif
-# if !defined(__CYGWIN__) && !defined(__QNXNTO__)
-# define BOOST_TEST_USE_ALT_STACK
+# if !defined(__CYGWIN__) && !defined(__QNXNTO__) && !defined(__bgq__) && \
+ (!defined(__ANDROID__) || __ANDROID_API__ >= 8)
+# define BOOST_TEST_USE_ALT_STACK
# endif
# if defined(SIGPOLL) && !defined(__CYGWIN__) && \
@@ -188,6 +171,7 @@ namespace { void _set_se_translator( void* ) {} }
# define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ
# endif
+
#else
# define BOOST_NO_SIGNAL_HANDLING
@@ -198,6 +182,10 @@ namespace { void _set_se_translator( void* ) {} }
#include <errno.h>
#endif
+#if defined(__GNUC__) && !defined(BOOST_NO_TYPEID)
+# include <cxxabi.h>
+#endif
+
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
@@ -205,6 +193,14 @@ namespace { void _set_se_translator( void* ) {} }
namespace boost {
// ************************************************************************** //
+// ************** throw_exception ************** //
+// ************************************************************************** //
+
+#ifdef BOOST_NO_EXCEPTION
+void throw_exception( std::exception const & e ) { abort(); }
+#endif
+
+// ************************************************************************** //
// ************** report_error ************** //
// ************************************************************************** //
@@ -220,6 +216,8 @@ namespace detail {
# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) )
#endif
+#ifndef BOOST_NO_EXCEPTION
+
template <typename ErrorInfo>
typename ErrorInfo::value_type
extract( boost::exception const* ex )
@@ -237,39 +235,41 @@ extract( boost::exception const* ex )
static void
report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, va_list* args )
{
- static const int REPORT_ERROR_BUFFER_SIZE = 512;
+ static const int REPORT_ERROR_BUFFER_SIZE = 4096;
static char buf[REPORT_ERROR_BUFFER_SIZE];
- BOOST_TEST_VSNPRINTF( buf, sizeof(buf)-1, format, *args );
+ BOOST_TEST_VSNPRINTF( buf, sizeof(buf)-1, format, *args );
buf[sizeof(buf)-1] = 0;
va_end( *args );
- throw execution_exception( ec, buf, execution_exception::location( extract<throw_file>( be ),
- extract<throw_line>( be ),
+ throw execution_exception( ec, buf, execution_exception::location( extract<throw_file>( be ),
+ (size_t)extract<throw_line>( be ),
extract<throw_function>( be ) ) );
}
//____________________________________________________________________________//
static void
-report_error( execution_exception::error_code ec, char const* format, ... )
+report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... )
{
va_list args;
va_start( args, format );
- report_error( ec, 0, format, &args );
+ report_error( ec, be, format, &args );
}
+#endif
+
//____________________________________________________________________________//
static void
-report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... )
+report_error( execution_exception::error_code ec, char const* format, ... )
{
va_list args;
va_start( args, format );
- report_error( ec, be, format, &args );
+ report_error( ec, 0, format, &args );
}
//____________________________________________________________________________//
@@ -283,6 +283,47 @@ do_invoke( Tr const& tr, Functor const& F )
//____________________________________________________________________________//
+struct fpe_except_guard {
+ explicit fpe_except_guard( unsigned detect_fpe )
+ : m_detect_fpe( detect_fpe )
+ {
+ // prepare fp exceptions control
+ m_previosly_enabled = fpe::disable( fpe::BOOST_FPE_ALL );
+ if( m_previosly_enabled != fpe::BOOST_FPE_INV && detect_fpe != fpe::BOOST_FPE_OFF )
+ fpe::enable( detect_fpe );
+ }
+ ~fpe_except_guard()
+ {
+ if( m_detect_fpe != fpe::BOOST_FPE_OFF )
+ fpe::disable( m_detect_fpe );
+ if( m_previosly_enabled != fpe::BOOST_FPE_INV )
+ fpe::enable( m_previosly_enabled );
+ }
+
+ unsigned m_detect_fpe;
+ unsigned m_previosly_enabled;
+};
+
+#ifndef BOOST_NO_TYPEID
+
+// ************************************************************************** //
+// ************** typeid_name ************** //
+// ************************************************************************** //
+
+template<typename T>
+char const*
+typeid_name( T const& t )
+{
+#ifdef __GNUC__
+ int status;
+
+ return abi::__cxa_demangle( typeid(t).name(), 0, 0, &status );
+#else
+ return typeid(t).name();
+#endif
+}
+#endif
+
} // namespace detail
#if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING)
@@ -398,10 +439,10 @@ system_signal_exception::report() const
"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 );
+ 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;
@@ -505,48 +546,6 @@ system_signal_exception::report() const
}
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",
- (int)m_sig_info->si_pid, (int)m_sig_info->si_uid, (int)m_sig_info->si_status );
- break;
- case CLD_KILLED:
- report_error( execution_exception::system_error,
- "child was killed; 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;
- case CLD_DUMPED:
- report_error( execution_exception::system_error,
- "child terminated abnormally; 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;
- case CLD_TRAPPED:
- report_error( execution_exception::system_error,
- "traced child has trapped; 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;
- case CLD_STOPPED:
- report_error( execution_exception::system_error,
- "child has stopped; 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;
- case CLD_CONTINUED:
- report_error( execution_exception::system_error,
- "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;
-
#if defined(BOOST_TEST_CATCH_SIGPOLL)
case SIGPOLL:
@@ -585,11 +584,11 @@ system_signal_exception::report() const
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;
+ default:
+ report_error( execution_exception::system_error,
+ "signal: SIGPOLL, si_code: %d (asynchronous I/O event occurred; band event %d)",
+ (int)m_sig_info->si_band, m_sig_info->si_code );
+ break;
}
break;
@@ -606,7 +605,8 @@ system_signal_exception::report() const
break;
default:
- report_error( execution_exception::system_error, "unrecognized signal" );
+ report_error( execution_exception::system_error,
+ "unrecognized signal %d", m_sig_info->si_signo );
}
}
@@ -618,8 +618,8 @@ system_signal_exception::report() const
// Forward declaration
extern "C" {
-static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context );
-static void execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context );
+static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context );
+static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context );
}
class signal_action {
@@ -663,8 +663,8 @@ signal_action::signal_action( int sig, bool install, bool attach_dbg, char* alt_
}
m_new_action.sa_flags |= SA_SIGINFO;
- m_new_action.sa_sigaction = attach_dbg ? &execution_monitor_attaching_signal_handler
- : &execution_monitor_jumping_signal_handler;
+ m_new_action.sa_sigaction = attach_dbg ? &boost_execution_monitor_attaching_signal_handler
+ : &boost_execution_monitor_jumping_signal_handler;
BOOST_TEST_SYS_ASSERT( sigemptyset( &m_new_action.sa_mask ) != -1 );
#ifdef BOOST_TEST_USE_ALT_STACK
@@ -692,7 +692,7 @@ signal_action::~signal_action()
class signal_handler {
public:
// Constructor
- explicit signal_handler( bool catch_system_errors, int timeout, bool attach_dbg, char* alt_stack );
+ explicit signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout, bool attach_dbg, char* alt_stack );
// Destructor
~signal_handler();
@@ -715,8 +715,9 @@ public:
private:
// Data members
signal_handler* m_prev_handler;
- int m_timeout;
+ unsigned m_timeout;
+ // Note: We intentionality do not catch SIGCHLD. Users have to deal with it themselves
signal_action m_ILL_action;
signal_action m_FPE_action;
signal_action m_SEGV_action;
@@ -738,16 +739,13 @@ signal_handler* signal_handler::s_active_handler = signal_handler_ptr();
//____________________________________________________________________________//
-signal_handler::signal_handler( bool catch_system_errors, int timeout, bool attach_dbg, char* alt_stack )
+signal_handler::signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout, bool attach_dbg, char* alt_stack )
: m_prev_handler( s_active_handler )
, m_timeout( timeout )
, m_ILL_action ( SIGILL , catch_system_errors, attach_dbg, alt_stack )
-, m_FPE_action ( SIGFPE , catch_system_errors, attach_dbg, alt_stack )
+, m_FPE_action ( SIGFPE , detect_fpe , 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
@@ -799,7 +797,12 @@ signal_handler::~signal_handler()
sigstk.ss_size = MINSIGSTKSZ;
sigstk.ss_flags = SS_DISABLE;
- BOOST_TEST_SYS_ASSERT( ::sigaltstack( &sigstk, 0 ) != -1 );
+ if( ::sigaltstack( &sigstk, 0 ) == -1 ) {
+ int error_n = errno;
+ std::cerr << "******** errors disabling the alternate stack:" << std::endl
+ << "\t#error:" << error_n << std::endl
+ << "\t" << std::strerror( error_n ) << std::endl;
+ }
#endif
s_active_handler = m_prev_handler;
@@ -813,26 +816,8 @@ signal_handler::~signal_handler()
extern "C" {
-static bool ignore_sigchild( siginfo_t* info )
-{
- 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
- && (int)info->si_status == 0;
-#endif
-}
-
-//____________________________________________________________________________//
-
-static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context )
+static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context )
{
- if( ignore_sigchild( info ) )
- return;
-
signal_handler::sys_sig()( info, context );
siglongjmp( signal_handler::jump_buffer(), sig );
@@ -840,13 +825,10 @@ static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info,
//____________________________________________________________________________//
-static void execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context )
+static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context )
{
- if( ignore_sigchild( info ) )
- return;
-
if( !debug::attach_debugger( false ) )
- execution_monitor_jumping_signal_handler( sig, info, context );
+ boost_execution_monitor_jumping_signal_handler( sig, info, context );
// debugger attached; it will handle the signal
BOOST_TEST_SYS_ASSERT( ::signal( sig, SIG_DFL ) != SIG_ERR );
@@ -863,7 +845,7 @@ static void execution_monitor_attaching_signal_handler( int sig, siginfo_t* info
// ************************************************************************** //
int
-execution_monitor::catch_signals( unit_test::callback0<int> const& F )
+execution_monitor::catch_signals( boost::function<int ()> const& F )
{
using namespace detail;
@@ -878,13 +860,16 @@ execution_monitor::catch_signals( unit_test::callback0<int> const& F )
p_use_alt_stack.value = false;
#endif
- signal_handler local_signal_handler( p_catch_system_errors, p_timeout, p_auto_start_dbg,
+ signal_handler local_signal_handler( p_catch_system_errors,
+ p_catch_system_errors || (p_detect_fp_exceptions != fpe::BOOST_FPE_OFF),
+ p_timeout,
+ p_auto_start_dbg,
!p_use_alt_stack ? 0 : m_alt_stack.get() );
if( !sigsetjmp( signal_handler::jump_buffer(), 1 ) )
return detail::do_invoke( m_custom_translators , F );
else
- throw local_signal_handler.sys_sig();
+ return BOOST_TEST_IMPL_THROW( local_signal_handler.sys_sig() );
}
//____________________________________________________________________________//
@@ -916,37 +901,64 @@ public:
{}
void report() const;
- int operator()( unsigned int id, _EXCEPTION_POINTERS* exps );
+ int operator()( unsigned id, _EXCEPTION_POINTERS* exps );
private:
// Data members
execution_monitor* m_em;
- unsigned int m_se_id;
+ unsigned m_se_id;
void* m_fault_address;
bool m_dir;
};
+//____________________________________________________________________________//
+
+#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310)
static void
-seh_catch_preventer( unsigned int /* id */, _EXCEPTION_POINTERS* /* exps */ )
+seh_catch_preventer( unsigned /* id */, _EXCEPTION_POINTERS* /* exps */ )
{
throw;
}
+#endif
//____________________________________________________________________________//
int
-system_signal_exception::operator()( unsigned int id, _EXCEPTION_POINTERS* exps )
+system_signal_exception::operator()( unsigned id, _EXCEPTION_POINTERS* exps )
{
- const unsigned int MSFT_CPP_EXCEPT = 0xE06d7363; // EMSC
+ const unsigned MSFT_CPP_EXCEPT = 0xE06d7363; // EMSC
- if( !m_em->p_catch_system_errors || (id == MSFT_CPP_EXCEPT) )
+ // C++ exception - allow to go through
+ if( id == MSFT_CPP_EXCEPT )
return EXCEPTION_CONTINUE_SEARCH;
+ // FPE detection is enabled, while system exception detection is not - check if this is actually FPE
+ if( !m_em->p_catch_system_errors ) {
+ if( !m_em->p_detect_fp_exceptions )
+ return EXCEPTION_CONTINUE_SEARCH;
+
+ switch( id ) {
+ case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+ case EXCEPTION_FLT_STACK_CHECK:
+ case EXCEPTION_FLT_DENORMAL_OPERAND:
+ case EXCEPTION_FLT_INEXACT_RESULT:
+ case EXCEPTION_FLT_OVERFLOW:
+ case EXCEPTION_FLT_UNDERFLOW:
+ case EXCEPTION_FLT_INVALID_OPERATION:
+ case STATUS_FLOAT_MULTIPLE_FAULTS:
+ case STATUS_FLOAT_MULTIPLE_TRAPS:
+ break;
+ default:
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+ }
+
if( !!m_em->p_auto_start_dbg && debug::attach_debugger( false ) ) {
m_em->p_catch_system_errors.value = false;
+#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310)
_set_se_translator( &seh_catch_preventer );
-
+#endif
return EXCEPTION_CONTINUE_EXECUTION;
}
@@ -1031,12 +1043,10 @@ system_signal_exception::report() const
"operand of floating point operation is denormal" );
break;
-# if 0 // !! ??
case EXCEPTION_FLT_INEXACT_RESULT:
detail::report_error( execution_exception::system_error,
"result of a floating-point operation cannot be represented exactly" );
break;
-#endif
case EXCEPTION_FLT_OVERFLOW:
detail::report_error( execution_exception::system_error,
@@ -1052,6 +1062,14 @@ system_signal_exception::report() const
detail::report_error( execution_exception::system_error, "floating point error" );
break;
+ case STATUS_FLOAT_MULTIPLE_FAULTS:
+ detail::report_error( execution_exception::system_error, "multiple floating point errors" );
+ break;
+
+ case STATUS_FLOAT_MULTIPLE_TRAPS:
+ detail::report_error( execution_exception::system_error, "multiple floating point errors" );
+ break;
+
case EXCEPTION_BREAKPOINT:
detail::report_error( execution_exception::system_error, "breakpoint encountered" );
break;
@@ -1071,59 +1089,28 @@ system_signal_exception::report() const
int BOOST_TEST_CALL_DECL
assert_reporting_function( int reportType, char* userMessage, int* )
{
- switch( reportType ) {
- case BOOST_TEST_CRT_ASSERT:
- detail::report_error( execution_exception::user_error, userMessage );
+ // write this way instead of switch to avoid unreachable statements
+ if( reportType == BOOST_TEST_CRT_ASSERT || reportType == BOOST_TEST_CRT_ERROR )
+ detail::report_error( reportType == BOOST_TEST_CRT_ASSERT ? execution_exception::user_error : execution_exception::system_error, userMessage );
- return 1; // return value and retVal are not important since we never reach this line
- 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
- default:
- return 0; // use usual reporting method
- }
+ return 0;
} // assert_reporting_function
//____________________________________________________________________________//
void BOOST_TEST_CALL_DECL
-invalid_param_handler( wchar_t const* /* expr */,
- wchar_t const* /* func */,
- wchar_t const* /* file */,
- unsigned int /* line */,
+invalid_param_handler( wchar_t const* /* expr */,
+ wchar_t const* /* func */,
+ wchar_t const* /* file */,
+ unsigned /* line */,
uintptr_t /* reserved */)
{
- detail::report_error( execution_exception::user_error,
+ detail::report_error( execution_exception::user_error,
"Invalid parameter detected by C runtime library" );
}
//____________________________________________________________________________//
-void BOOST_TEST_CALL_DECL
-switch_fp_exceptions( bool on_off )
-{
- if( !on_off )
- _clearfp();
-
- int cw = ::_controlfp( 0, 0 );
-
- int exceptions_mask = EM_INVALID|EM_DENORMAL|EM_ZERODIVIDE|EM_OVERFLOW|EM_UNDERFLOW;
-
- if( on_off )
- cw &= ~exceptions_mask; // Set the exception masks on, turn exceptions off
- else
- cw |= exceptions_mask; // Set the exception masks off, turn exceptions on
-
- if( on_off )
- _clearfp();
-
- // Set the control word
- ::_controlfp( cw, MCW_EM );
-}
-
-//____________________________________________________________________________//
-
} // namespace detail
// ************************************************************************** //
@@ -1131,25 +1118,24 @@ switch_fp_exceptions( bool on_off )
// ************************************************************************** //
int
-execution_monitor::catch_signals( unit_test::callback0<int> const& F )
+execution_monitor::catch_signals( boost::function<int ()> const& F )
{
_invalid_parameter_handler old_iph = _invalid_parameter_handler();
BOOST_TEST_CRT_HOOK_TYPE old_crt_hook = 0;
- if( !p_catch_system_errors )
- _set_se_translator( &detail::seh_catch_preventer );
- else {
- if( !!p_detect_fp_exceptions )
- detail::switch_fp_exceptions( true );
-
- old_crt_hook = BOOST_TEST_CRT_SET_HOOK( &detail::assert_reporting_function );
+ if( p_catch_system_errors ) {
+ 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 ) );
+ old_iph = _set_invalid_parameter_handler(
+ reinterpret_cast<_invalid_parameter_handler>( &detail::invalid_param_handler ) );
+ } else if( !p_detect_fp_exceptions ) {
+#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310)
+ _set_se_translator( &detail::seh_catch_preventer );
+#endif
}
detail::system_signal_exception SSE( this );
-
+
int ret_val = 0;
__try {
@@ -1161,10 +1147,7 @@ execution_monitor::catch_signals( unit_test::callback0<int> const& F )
}
}
__finally {
- if( !!p_catch_system_errors ) {
- if( !!p_detect_fp_exceptions )
- detail::switch_fp_exceptions( false );
-
+ if( p_catch_system_errors ) {
BOOST_TEST_CRT_SET_HOOK( old_crt_hook );
_set_invalid_parameter_handler( old_iph );
@@ -1188,7 +1171,7 @@ public:
} // namespace detail
int
-execution_monitor::catch_signals( unit_test::callback0<int> const& F )
+execution_monitor::catch_signals( boost::function<int ()> const& F )
{
return detail::do_invoke( m_custom_translators , F );
}
@@ -1198,19 +1181,34 @@ execution_monitor::catch_signals( unit_test::callback0<int> const& F )
#endif // choose signal handler
// ************************************************************************** //
-// ************** execution_monitor::execute ************** //
+// ************** execution_monitor ************** //
// ************************************************************************** //
+execution_monitor::execution_monitor()
+: p_catch_system_errors( true )
+, p_auto_start_dbg( false )
+, p_timeout( 0 )
+, p_use_alt_stack( true )
+, p_detect_fp_exceptions( fpe::BOOST_FPE_OFF )
+{}
+
+//____________________________________________________________________________//
+
int
-execution_monitor::execute( unit_test::callback0<int> const& F )
+execution_monitor::execute( boost::function<int ()> const& F )
{
if( debug::under_debugger() )
p_catch_system_errors.value = false;
- try {
+ BOOST_TEST_IMPL_TRY {
+ detail::fpe_except_guard G( p_detect_fp_exceptions );
+ unit_test::ut_detail::ignore_unused_variable_warning( G );
+
return catch_signals( F );
}
+#ifndef BOOST_NO_EXCEPTION
+
// Catch-clause reference arguments are a bit different from function
// arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
// required. Programmers ask for const anyhow, so we supply it. That's
@@ -1220,89 +1218,61 @@ execution_monitor::execute( unit_test::callback0<int> const& F )
{ detail::report_error( execution_exception::cpp_exception_error,
"C string: %s", ex ); }
catch( std::string const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
+ { detail::report_error( execution_exception::cpp_exception_error,
"std::string: %s", ex.c_str() ); }
// std:: exceptions
+#ifdef BOOST_NO_TYPEID
+#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \
+ catch( ex_name const& ex ) \
+ { detail::report_error( execution_exception::cpp_exception_error, \
+ current_exception_cast<boost::exception const>(), \
+ #ex_name ": %s", ex.what() ); } \
+/**/
+#else
+#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \
+ catch( ex_name const& ex ) \
+ { detail::report_error( execution_exception::cpp_exception_error, \
+ current_exception_cast<boost::exception const>(), \
+ "%s: %s", detail::typeid_name(ex), ex.what() ); } \
+/**/
+#endif
- catch( std::bad_alloc const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::bad_alloc: %s", ex.what() ); }
+ CATCH_AND_REPORT_STD_EXCEPTION( std::bad_alloc )
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
- catch( std::bad_cast const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::bad_cast" ); }
- catch( std::bad_typeid const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::bad_typeid" ); }
+ CATCH_AND_REPORT_STD_EXCEPTION( std::bad_cast )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::bad_typeid )
#else
- catch( std::bad_cast const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::bad_cast: %s", ex.what() ); }
- catch( std::bad_typeid const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::bad_typeid: %s", ex.what() ); }
+ CATCH_AND_REPORT_STD_EXCEPTION( std::bad_cast )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::bad_typeid )
#endif
- catch( std::bad_exception const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::bad_exception: %s", ex.what() ); }
- catch( std::domain_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::domain_error: %s", ex.what() ); }
- catch( std::invalid_argument const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::invalid_argument: %s", ex.what() ); }
- catch( std::length_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::length_error: %s", ex.what() ); }
- catch( std::out_of_range const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::out_of_range: %s", ex.what() ); }
- catch( std::range_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::range_error: %s", ex.what() ); }
- catch( std::overflow_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::overflow_error: %s", ex.what() ); }
- catch( std::underflow_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::underflow_error: %s", ex.what() ); }
- catch( std::logic_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::logic_error: %s", ex.what() ); }
- catch( std::runtime_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::runtime_error: %s", ex.what() ); }
- catch( std::exception const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- current_exception_cast<boost::exception const>(),
- "std::exception: %s", ex.what() ); }
+ CATCH_AND_REPORT_STD_EXCEPTION( std::bad_exception )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::domain_error )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::invalid_argument )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::length_error )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::out_of_range )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::range_error )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::overflow_error )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::underflow_error )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::logic_error )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::runtime_error )
+ CATCH_AND_REPORT_STD_EXCEPTION( std::exception )
+#undef CATCH_AND_REPORT_STD_EXCEPTION
catch( boost::exception const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
- &ex,
- "unknown boost::exception" ); }
+ { detail::report_error( execution_exception::cpp_exception_error,
+ &ex,
+#ifdef BOOST_NO_TYPEID
+ "unknown boost::exception" ); }
+#else
+ typeid(ex).name() ); }
+#endif
// system errors
catch( system_error const& ex )
- { detail::report_error( execution_exception::cpp_exception_error,
+ { detail::report_error( execution_exception::cpp_exception_error,
"system_error produced by: %s: %s", ex.p_failed_exp.get(), std::strerror( ex.p_errno ) ); }
catch( detail::system_signal_exception const& ex )
{ ex.report(); }
@@ -1319,11 +1289,30 @@ execution_monitor::execute( unit_test::callback0<int> const& F )
catch( ... )
{ detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); }
+#endif // !BOOST_NO_EXCEPTION
+
return 0; // never reached; supplied to quiet compiler warnings
} // execute
//____________________________________________________________________________//
+namespace detail {
+
+struct forward {
+ explicit forward( boost::function<void ()> const& F ) : m_F( F ) {}
+
+ int operator()() { m_F(); return 0; }
+
+ boost::function<void ()> const& m_F;
+};
+
+} // namespace detail
+void
+execution_monitor::vexecute( boost::function<void ()> const& F )
+{
+ execute( detail::forward( F ) );
+}
+
// ************************************************************************** //
// ************** system_error ************** //
// ************************************************************************** //
@@ -1359,6 +1348,88 @@ execution_exception::location::location( char const* file_name, size_t line_num,
//____________________________________________________________________________//
+// ************************************************************************** //
+// **************Floating point exception management interface ************** //
+// ************************************************************************** //
+
+namespace fpe {
+
+unsigned
+enable( unsigned mask )
+{
+ boost::ignore_unused(mask);
+
+#if defined(UNDER_CE)
+ /* Not Implemented in Windows CE */
+ return 0;
+#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING)
+ _clearfp();
+
+#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310)
+ unsigned old_cw = ::_controlfp( 0, 0 );
+ ::_controlfp( old_cw & ~mask, BOOST_FPE_ALL );
+#else
+ unsigned old_cw;
+ if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 )
+ return BOOST_FPE_INV;
+
+ // Set the control word
+ if( ::_controlfp_s( 0, old_cw & ~mask, BOOST_FPE_ALL ) != 0 )
+ return BOOST_FPE_INV;
+#endif
+
+ return ~old_cw & BOOST_FPE_ALL;
+#elif defined(__GLIBC__) && defined(__USE_GNU) && !defined(BOOST_CLANG) && !defined(BOOST_NO_FENV_H)
+ ::feclearexcept(BOOST_FPE_ALL);
+ int res = ::feenableexcept( mask );
+ return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res;
+#else
+ /* Not Implemented */
+ return 0;
+#endif
+}
+
+//____________________________________________________________________________//
+
+unsigned
+disable( unsigned mask )
+{
+ boost::ignore_unused(mask);
+
+#if defined(UNDER_CE)
+ /* Not Implemented in Windows CE */
+ return 0;
+#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING)
+ _clearfp();
+
+#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310)
+ unsigned old_cw = ::_controlfp( 0, 0 );
+ ::_controlfp( old_cw | mask, BOOST_FPE_ALL );
+#else
+ unsigned old_cw;
+ if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 )
+ return BOOST_FPE_INV;
+
+ // Set the control word
+ if( ::_controlfp_s( 0, old_cw | mask, BOOST_FPE_ALL ) != 0 )
+ return BOOST_FPE_INV;
+#endif
+
+ return ~old_cw & BOOST_FPE_ALL;
+#elif defined(__GLIBC__) && defined(__USE_GNU) && !defined(BOOST_CLANG) && !defined(BOOST_NO_FENV_H)
+ ::feclearexcept(BOOST_FPE_ALL);
+ int res = ::fedisableexcept( mask );
+ return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res;
+#else
+ /* Not Implemented */
+ return BOOST_FPE_INV;
+#endif
+}
+
+//____________________________________________________________________________//
+
+} // namespace fpe
+
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
diff --git a/boost/test/impl/framework.ipp b/boost/test/impl/framework.ipp
index a1e98b3771..a69d95cd2d 100644
--- a/boost/test/impl/framework.ipp
+++ b/boost/test/impl/framework.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -19,24 +19,36 @@
#include <boost/test/framework.hpp>
#include <boost/test/execution_monitor.hpp>
#include <boost/test/debug.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
+#include <boost/test/unit_test_parameters.hpp>
+
#include <boost/test/unit_test_log.hpp>
#include <boost/test/unit_test_monitor.hpp>
-#include <boost/test/test_observer.hpp>
#include <boost/test/results_collector.hpp>
#include <boost/test/progress_monitor.hpp>
#include <boost/test/results_reporter.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
-#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/tree/observer.hpp>
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/visitor.hpp>
+#include <boost/test/tree/traverse.hpp>
+#include <boost/test/tree/test_case_counter.hpp>
+
+#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR
+#include <boost/test/utils/iterator/token_iterator.hpp>
+#endif
#include <boost/test/utils/foreach.hpp>
+#include <boost/test/utils/basic_cstring/io.hpp>
+
+#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/detail/throw_exception.hpp>
// Boost
#include <boost/timer.hpp>
+#include <boost/bind.hpp>
// STL
+#include <limits>
#include <map>
#include <set>
#include <cstdlib>
@@ -51,148 +63,672 @@ namespace std { using ::time; using ::srand; }
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
+namespace framework {
+namespace impl {
// ************************************************************************** //
-// ************** test_start calls wrapper ************** //
+// ************** order detection helpers ************** //
// ************************************************************************** //
-namespace ut_detail {
+struct order_info {
+ order_info() : depth(-1) {}
-struct test_start_caller {
- test_start_caller( test_observer* to, counter_t tc_amount )
- : m_to( to )
- , m_tc_amount( tc_amount )
- {}
+ int depth;
+ std::vector<test_unit_id> dependant_siblings;
+};
- int operator()()
- {
- m_to->test_start( m_tc_amount );
+typedef std::set<test_unit_id> tu_id_set;
+typedef std::map<test_unit_id,order_info> order_info_per_tu; // !! ?? unordered map
+
+//____________________________________________________________________________//
+
+static test_unit_id
+get_tu_parent( test_unit_id tu_id )
+{
+ return framework::get( tu_id, TUT_ANY ).p_parent_id;
+}
+
+//____________________________________________________________________________//
+
+static int
+tu_depth( test_unit_id tu_id, test_unit_id master_tu_id, order_info_per_tu& tuoi )
+{
+ if( tu_id == master_tu_id )
return 0;
+
+ order_info& info = tuoi[tu_id];
+
+ if( info.depth == -1 )
+ info.depth = tu_depth( get_tu_parent( tu_id ), master_tu_id, tuoi ) + 1;
+
+ return info.depth;
+}
+
+//____________________________________________________________________________//
+
+static void
+collect_dependant_siblings( test_unit_id from, test_unit_id to, test_unit_id master_tu_id, order_info_per_tu& tuoi )
+{
+ int from_depth = tu_depth( from, master_tu_id, tuoi );
+ int to_depth = tu_depth( to, master_tu_id, tuoi );
+
+ while(from_depth > to_depth) {
+ from = get_tu_parent( from );
+ --from_depth;
+ }
+
+ while(from_depth < to_depth) {
+ to = get_tu_parent( to );
+ --to_depth;
+ }
+
+ while(true) {
+ test_unit_id from_parent = get_tu_parent( from );
+ test_unit_id to_parent = get_tu_parent( to );
+ if( from_parent == to_parent )
+ break;
+ from = from_parent;
+ to = to_parent;
+ }
+
+ tuoi[from].dependant_siblings.push_back( to );
+}
+
+//____________________________________________________________________________//
+
+static counter_t
+assign_sibling_rank( test_unit_id tu_id, order_info_per_tu& tuoi )
+{
+ test_unit& tu = framework::get( tu_id, TUT_ANY );
+
+ BOOST_TEST_SETUP_ASSERT( tu.p_sibling_rank != (std::numeric_limits<counter_t>::max)(),
+ "Cyclic dependency detected involving test unit \"" + tu.full_name() + "\"" );
+
+ if( tu.p_sibling_rank != 0 )
+ return tu.p_sibling_rank;
+
+ order_info const& info = tuoi[tu_id];
+
+ // indicate in progress
+ tu.p_sibling_rank.value = (std::numeric_limits<counter_t>::max)();
+
+ counter_t new_rank = 1;
+ BOOST_TEST_FOREACH( test_unit_id, sibling_id, info.dependant_siblings )
+ new_rank = (std::max)(new_rank, assign_sibling_rank( sibling_id, tuoi ) + 1);
+
+ return tu.p_sibling_rank.value = new_rank;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** test_init call wrapper ************** //
+// ************************************************************************** //
+
+static void
+invoke_init_func( init_unit_test_func init_func )
+{
+#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
+ if( !(*init_func)() )
+ BOOST_TEST_IMPL_THROW( std::runtime_error( "test module initialization failed" ) );
+#else
+ test_suite* manual_test_units = (*init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv );
+
+ if( manual_test_units )
+ framework::master_test_suite().add( manual_test_units );
+#endif
+}
+
+// ************************************************************************** //
+// ************** name_filter ************** //
+// ************************************************************************** //
+
+class name_filter : public test_tree_visitor {
+ struct component {
+ component( const_string name ) // has to be implicit
+ {
+ if( name == "*" )
+ m_kind = SFK_ALL;
+ else if( first_char( name ) == '*' && last_char( name ) == '*' ) {
+ m_kind = SFK_SUBSTR;
+ m_name = name.substr( 1, name.size()-1 );
+ }
+ else if( first_char( name ) == '*' ) {
+ m_kind = SFK_TRAILING;
+ m_name = name.substr( 1 );
+ }
+ else if( last_char( name ) == '*' ) {
+ m_kind = SFK_LEADING;
+ m_name = name.substr( 0, name.size()-1 );
+ }
+ else {
+ m_kind = SFK_MATCH;
+ m_name = name;
+ }
+ }
+
+ bool pass( test_unit const& tu ) const
+ {
+ const_string name( tu.p_name );
+
+ switch( m_kind ) {
+ default:
+ case SFK_ALL:
+ return true;
+ case SFK_LEADING:
+ return name.substr( 0, m_name.size() ) == m_name;
+ case SFK_TRAILING:
+ return name.size() >= m_name.size() && name.substr( name.size() - m_name.size() ) == m_name;
+ case SFK_SUBSTR:
+ return name.find( m_name ) != const_string::npos;
+ case SFK_MATCH:
+ return m_name == tu.p_name.get();
+ }
+ }
+ enum kind { SFK_ALL, SFK_LEADING, SFK_TRAILING, SFK_SUBSTR, SFK_MATCH };
+
+ kind m_kind;
+ const_string m_name;
+ };
+
+public:
+ // Constructor
+ name_filter( test_unit_id_list& targ_list, const_string filter_expr ) : m_targ_list( targ_list ), m_depth( 0 )
+ {
+#ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR
+ string_token_iterator tit( filter_expr, (dropped_delimeters = "/", kept_delimeters = dt_none) );
+
+ while( tit != string_token_iterator() ) {
+ m_components.push_back( std::vector<component>( string_token_iterator( *tit, (dropped_delimeters = ",", kept_delimeters = dt_none) ),
+ string_token_iterator() ) );
+
+ ++tit;
+ }
+#endif
}
private:
+ bool filter_unit( test_unit const& tu )
+ {
+ // skip master test suite
+ if( m_depth == 0 )
+ return true;
+
+ // corresponding name filters are at level m_depth-1
+ std::vector<component> const& filters = m_components[m_depth-1];
+
+ // look for match
+ return std::find_if( filters.begin(), filters.end(), bind( &component::pass, _1, boost::ref(tu) ) ) != filters.end();
+ }
+
+ // test_tree_visitor interface
+ virtual void visit( test_case const& tc )
+ {
+ // make sure we only accept test cases if we match last component of the filter
+ if( m_depth == m_components.size() && filter_unit( tc ) )
+ m_targ_list.push_back( tc.p_id ); // found a test case
+ }
+ virtual bool test_suite_start( test_suite const& ts )
+ {
+ if( !filter_unit( ts ) )
+ return false;
+
+ if( m_depth < m_components.size() ) {
+ ++m_depth;
+ return true;
+ }
+
+ m_targ_list.push_back( ts.p_id ); // found a test suite
+
+ return false;
+ }
+ virtual void test_suite_finish( test_suite const& /*ts*/ )
+ {
+ --m_depth;
+ }
+
// Data members
- test_observer* m_to;
- counter_t m_tc_amount;
+ typedef std::vector<std::vector<component> > components_per_level;
+
+ components_per_level m_components;
+ test_unit_id_list& m_targ_list;
+ unsigned m_depth;
};
-//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** label_filter ************** //
+// ************************************************************************** //
-struct test_init_caller {
- explicit test_init_caller( init_unit_test_func init_func )
- : m_init_func( init_func )
+class label_filter : public test_tree_visitor {
+public:
+ label_filter( test_unit_id_list& targ_list, const_string label )
+ : m_targ_list( targ_list )
+ , m_label( label )
{}
- int operator()()
+
+private:
+ // test_tree_visitor interface
+ virtual bool visit( test_unit const& tu )
{
-#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
- if( !(*m_init_func)() )
- throw std::runtime_error( "test module initialization failed" );
-#else
- test_suite* manual_test_units = (*m_init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv );
+ if( tu.has_label( m_label ) ) {
+ // found a test unit; add it to list of tu to enable with children and stop recursion in case of suites
+ m_targ_list.push_back( tu.p_id );
+ return false;
+ }
- if( manual_test_units )
- framework::master_test_suite().add( manual_test_units );
-#endif
- return 0;
+ return true;
+ }
+
+ // Data members
+ test_unit_id_list& m_targ_list;
+ const_string m_label;
+};
+
+// ************************************************************************** //
+// ************** set_run_status ************** //
+// ************************************************************************** //
+
+class set_run_status : public test_tree_visitor {
+public:
+ explicit set_run_status( test_unit::run_status rs, test_unit_id_list* dep_collector = 0 )
+ : m_new_status( rs )
+ , m_dep_collector( dep_collector )
+ {}
+
+private:
+ // test_tree_visitor interface
+ virtual bool visit( test_unit const& tu )
+ {
+ const_cast<test_unit&>(tu).p_run_status.value = m_new_status == test_unit::RS_INVALID ? tu.p_default_status : m_new_status;
+
+ if( m_dep_collector ) {
+ BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) {
+ test_unit const& dep = framework::get( dep_id, TUT_ANY );
+
+ if( dep.p_run_status == tu.p_run_status )
+ continue;
+
+ BOOST_TEST_MESSAGE( "Including test " << dep.p_type_name << ' ' << dep.full_name() <<
+ " as a dependency of test " << tu.p_type_name << ' ' << tu.full_name() );
+
+ m_dep_collector->push_back( dep_id );
+ }
+ }
+ return true;
}
// Data members
- init_unit_test_func m_init_func;
+ test_unit::run_status m_new_status;
+ test_unit_id_list* m_dep_collector;
};
+// ************************************************************************** //
+// ************** parse_filters ************** //
+// ************************************************************************** //
+
+static void
+add_filtered_test_units( test_unit_id master_tu_id, const_string filter, test_unit_id_list& targ )
+{
+ // Choose between two kinds of filters
+ if( filter[0] == '@' ) {
+ filter.trim_left( 1 );
+ label_filter lf( targ, filter );
+ traverse_test_tree( master_tu_id, lf, true );
+ }
+ else {
+ name_filter nf( targ, filter );
+ traverse_test_tree( master_tu_id, nf, true );
+ }
}
+//____________________________________________________________________________//
+
+static bool
+parse_filters( test_unit_id master_tu_id, test_unit_id_list& tu_to_enable, test_unit_id_list& tu_to_disable )
+{
+ // 10. collect tu to enable and disable based on filters
+ bool had_selector_filter = false;
+
+ BOOST_TEST_FOREACH( const_string, filter, runtime_config::test_to_run() ) {
+ BOOST_TEST_SETUP_ASSERT( !filter.is_empty(), "Invalid filter specification" );
+
+ enum { SELECTOR, ENABLER, DISABLER } filter_type = SELECTOR;
+
+ // 11. Deduce filter type
+ if( filter[0] == '!' || filter[0] == '+' ) {
+ filter_type = filter[0] == '+' ? ENABLER : DISABLER;
+ filter.trim_left( 1 );
+ BOOST_TEST_SETUP_ASSERT( !filter.is_empty(), "Invalid filter specification" );
+ }
+
+ had_selector_filter |= filter_type == SELECTOR;
+
+ // 12. Add test units to corresponding list
+ switch( filter_type ) {
+ case SELECTOR:
+ case ENABLER: add_filtered_test_units( master_tu_id, filter, tu_to_enable ); break;
+ case DISABLER: add_filtered_test_units( master_tu_id, filter, tu_to_disable ); break;
+ }
+ }
+
+ return had_selector_filter;
+}
+
+//____________________________________________________________________________//
+
+} // namespace impl
+
// ************************************************************************** //
-// ************** framework ************** //
+// ************** framework::state ************** //
// ************************************************************************** //
-class framework_impl : public test_tree_visitor {
+unsigned const TIMEOUT_EXCEEDED = static_cast<unsigned>( -1 );
+
+class state {
public:
- framework_impl()
- : m_master_test_suite( 0 )
- , m_curr_test_case( INV_TEST_UNIT_ID )
+ state()
+ : m_curr_test_case( INV_TEST_UNIT_ID )
, m_next_test_case_id( MIN_TEST_CASE_ID )
, m_next_test_suite_id( MIN_TEST_SUITE_ID )
- , m_is_initialized( false )
, m_test_in_progress( false )
- {}
+ , m_context_idx( 0 )
+ {
+ }
- ~framework_impl() { clear(); }
+ ~state() { clear(); }
void clear()
{
while( !m_test_units.empty() ) {
test_unit_store::value_type const& tu = *m_test_units.begin();
- test_unit* tu_ptr = tu.second;
+ test_unit const* tu_ptr = tu.second;
// the delete will erase this element from map
- if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == tut_suite )
- delete (test_suite const*)tu_ptr;
+ if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == TUT_SUITE )
+ delete static_cast<test_suite const*>(tu_ptr);
else
- delete (test_case const*)tu_ptr;
+ delete static_cast<test_case const*>(tu_ptr);
}
}
void set_tu_id( test_unit& tu, test_unit_id id ) { tu.p_id.value = id; }
- // test_tree_visitor interface implementation
- void visit( test_case const& tc )
+ //////////////////////////////////////////////////////////////////
+
+ // Validates the dependency graph and deduces the sibling dependency rank for each child
+ void deduce_siblings_order( test_unit_id tu_id, test_unit_id master_tu_id, impl::order_info_per_tu& tuoi )
{
- if( !tc.check_dependencies() ) {
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
- to->test_unit_skipped( tc );
+ test_unit& tu = framework::get( tu_id, TUT_ANY );
+
+ // collect all sibling dependancy from tu own list
+ BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() )
+ collect_dependant_siblings( tu_id, dep_id, master_tu_id, tuoi );
+ if( tu.p_type != TUT_SUITE )
return;
+
+ test_suite& ts = static_cast<test_suite&>(tu);
+
+ // recursive call to children first
+ BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children )
+ deduce_siblings_order( chld_id, master_tu_id, tuoi );
+
+ BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children ) {
+ counter_t rank = assign_sibling_rank( chld_id, tuoi );
+ ts.m_ranked_children.insert( std::make_pair( rank, chld_id ) );
}
+ }
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
- to->test_unit_start( tc );
+ //////////////////////////////////////////////////////////////////
- boost::timer tc_timer;
- test_unit_id bkup = m_curr_test_case;
- m_curr_test_case = tc.p_id;
- unit_test_monitor_t::error_level run_result = unit_test_monitor.execute_and_translate( tc );
+ // Finalize default run status:
+ // 1) inherit run status from parent where applicable
+ // 2) if any of test units in test suite enabled enable it as well
+ bool finalize_default_run_status( test_unit_id tu_id, test_unit::run_status parent_status )
+ {
+ test_unit& tu = framework::get( tu_id, TUT_ANY );
- unsigned long elapsed = static_cast<unsigned long>( tc_timer.elapsed() * 1e6 );
+ if( tu.p_default_status == test_suite::RS_INHERIT )
+ tu.p_default_status.value = parent_status;
- if( unit_test_monitor.is_critical_error( run_result ) ) {
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
- to->test_aborted();
+ // go through list of children
+ if( tu.p_type == TUT_SUITE ) {
+ bool has_enabled_child = false;
+ BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast<test_suite const&>(tu).m_children )
+ has_enabled_child |= finalize_default_run_status( chld_id, tu.p_default_status );
+
+ tu.p_default_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED;
}
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
- to->test_unit_finish( tc, elapsed );
+ return tu.p_default_status == test_suite::RS_ENABLED;
+ }
- m_curr_test_case = bkup;
+ //////////////////////////////////////////////////////////////////
+
+ bool finalize_run_status( test_unit_id tu_id )
+ {
+ test_unit& tu = framework::get( tu_id, TUT_ANY );
+
+ // go through list of children
+ if( tu.p_type == TUT_SUITE ) {
+ bool has_enabled_child = false;
+ BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast<test_suite const&>(tu).m_children)
+ has_enabled_child |= finalize_run_status( chld_id );
+
+ tu.p_run_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED;
+ }
- if( unit_test_monitor.is_critical_error( run_result ) )
- throw test_being_aborted();
+ return tu.is_enabled();
}
- bool test_suite_start( test_suite const& ts )
+ //////////////////////////////////////////////////////////////////
+
+ void deduce_run_status( test_unit_id master_tu_id )
{
- if( !ts.check_dependencies() ) {
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
- to->test_unit_skipped( ts );
+ using namespace framework::impl;
+ test_unit_id_list tu_to_enable;
+ test_unit_id_list tu_to_disable;
- return false;
+ // 10. If there are any filters supplied, figure out lists of test units to enable/disable
+ bool had_selector_filter = !runtime_config::test_to_run().empty() &&
+ parse_filters( master_tu_id, tu_to_enable, tu_to_disable );
+
+ // 20. Set the stage: either use default run status or disable all test units
+ set_run_status setter( had_selector_filter ? test_unit::RS_DISABLED : test_unit::RS_INVALID );
+ traverse_test_tree( master_tu_id, setter, true );
+
+ // 30. Apply all selectors and enablers.
+ while( !tu_to_enable.empty() ) {
+ test_unit& tu = framework::get( tu_to_enable.back(), TUT_ANY );
+
+ tu_to_enable.pop_back();
+
+ // 35. Ignore test units which already enabled
+ if( tu.is_enabled() )
+ continue;
+
+ // set new status and add all dependencies into tu_to_enable
+ set_run_status setter( test_unit::RS_ENABLED, &tu_to_enable );
+ traverse_test_tree( tu.p_id, setter, true );
}
- BOOST_TEST_FOREACH( test_observer*, to, m_observers )
- to->test_unit_start( ts );
+ // 40. Apply all disablers
+ while( !tu_to_disable.empty() ) {
+ test_unit const& tu = framework::get( tu_to_disable.back(), TUT_ANY );
- return true;
+ tu_to_disable.pop_back();
+
+ // 35. Ignore test units which already disabled
+ if( !tu.is_enabled() )
+ continue;
+
+ set_run_status setter( test_unit::RS_DISABLED );
+ traverse_test_tree( tu.p_id, setter, true );
+ }
+
+ // 50. Make sure parents of enabled test units are also enabled
+ finalize_run_status( master_tu_id );
}
- void test_suite_finish( test_suite const& ts )
+ //////////////////////////////////////////////////////////////////
+
+ typedef unit_test_monitor_t::error_level execution_result;
+
+ // Executed the test tree with the root at specified test unit
+ execution_result execute_test_tree( test_unit_id tu_id, unsigned timeout = 0 )
{
+ test_unit const& tu = framework::get( tu_id, TUT_ANY );
+
+ execution_result result = unit_test_monitor_t::test_ok;
+
+ if( !tu.is_enabled() )
+ return result;
+
+ // 10. Check preconditions, including zero time left for execution and
+ // successful execution of all dependencies
+ if( timeout == TIMEOUT_EXCEEDED ) {
+ // notify all observers about skipped test unit
+ BOOST_TEST_FOREACH( test_observer*, to, m_observers )
+ to->test_unit_skipped( tu, "timeout for the test unit is exceeded" );
+
+ return unit_test_monitor_t::os_timeout;
+ }
+ else if( timeout == 0 || timeout > tu.p_timeout ) // deduce timeout for this test unit
+ timeout = tu.p_timeout;
+
+ test_tools::assertion_result const precondition_res = tu.check_preconditions();
+ if( !precondition_res ) {
+ // notify all observers about skipped test unit
+ BOOST_TEST_FOREACH( test_observer*, to, m_observers )
+ to->test_unit_skipped( tu, precondition_res.message() );
+
+ return unit_test_monitor_t::precondition_failure;
+ }
+
+ // 20. Notify all observers about the start of the test unit
BOOST_TEST_FOREACH( test_observer*, to, m_observers )
- to->test_unit_finish( ts, 0 );
+ to->test_unit_start( tu );
+
+ // 30. Execute setup fixtures if any; any failure here leads to test unit abortion
+ BOOST_TEST_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) {
+ result = unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::setup, F ) );
+ if( result != unit_test_monitor_t::test_ok )
+ break;
+ }
+
+ // This is the time we are going to spend executing the test unit
+ unsigned long elapsed = 0;
+
+ if( result == unit_test_monitor_t::test_ok ) {
+ // 40. We are going to time the execution
+ boost::timer tu_timer;
+
+ if( tu.p_type == TUT_SUITE ) {
+ test_suite const& ts = static_cast<test_suite const&>( tu );
+
+ if( runtime_config::random_seed() == 0 ) {
+ typedef std::pair<counter_t,test_unit_id> value_type;
+
+ BOOST_TEST_FOREACH( value_type, chld, ts.m_ranked_children ) {
+ unsigned chld_timeout = child_timeout( timeout, tu_timer.elapsed() );
+
+ result = (std::min)( result, execute_test_tree( chld.second, chld_timeout ) );
+
+ if( unit_test_monitor.is_critical_error( result ) )
+ break;
+ }
+ }
+ else {
+ // Go through ranges of chldren with the same dependency rank and shuffle them
+ // independently. Execute each subtree in this order
+ test_unit_id_list children_with_the_same_rank;
+
+ typedef test_suite::children_per_rank::const_iterator it_type;
+ it_type it = ts.m_ranked_children.begin();
+ while( it != ts.m_ranked_children.end() ) {
+ children_with_the_same_rank.clear();
+
+ std::pair<it_type,it_type> range = ts.m_ranked_children.equal_range( it->first );
+ it = range.first;
+ while( it != range.second ) {
+ children_with_the_same_rank.push_back( it->second );
+ it++;
+ }
+
+ std::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end() );
+
+ BOOST_TEST_FOREACH( test_unit_id, chld, children_with_the_same_rank ) {
+ unsigned chld_timeout = child_timeout( timeout, tu_timer.elapsed() );
+
+ result = (std::min)( result, execute_test_tree( chld, chld_timeout ) );
+
+ if( unit_test_monitor.is_critical_error( result ) )
+ break;
+ }
+ }
+ }
+
+ elapsed = static_cast<unsigned long>( tu_timer.elapsed() * 1e6 );
+ }
+ else { // TUT_CASE
+ test_case const& tc = static_cast<test_case const&>( tu );
+
+ // setup contexts
+ m_context_idx = 0;
+
+ // setup current test case
+ test_unit_id bkup = m_curr_test_case;
+ m_curr_test_case = tc.p_id;
+
+ // execute the test case body
+ result = unit_test_monitor.execute_and_translate( tc.p_test_func, timeout );
+ elapsed = static_cast<unsigned long>( tu_timer.elapsed() * 1e6 );
+
+ // cleanup leftover context
+ m_context.clear();
+
+ // restore state and abort if necessary
+ m_curr_test_case = bkup;
+ }
+ }
+
+ // if run error is critical skip teardown, who knows what the state of the program at this point
+ if( !unit_test_monitor.is_critical_error( result ) ) {
+ // execute teardown fixtures if any in reverse order
+ BOOST_TEST_REVERSE_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) {
+ result = (std::min)( result, unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::teardown, F ), 0 ) );
+
+ if( unit_test_monitor.is_critical_error( result ) )
+ break;
+ }
+ }
+
+ // notify all observers about abortion
+ if( unit_test_monitor.is_critical_error( result ) ) {
+ BOOST_TEST_FOREACH( test_observer*, to, m_observers )
+ to->test_aborted();
+ }
+
+ // notify all observers about completion
+ BOOST_TEST_REVERSE_FOREACH( test_observer*, to, m_observers )
+ to->test_unit_finish( tu, elapsed );
+
+ return result;
}
//////////////////////////////////////////////////////////////////
+
+ unsigned child_timeout( unsigned tu_timeout, double elapsed )
+ {
+ if( tu_timeout == 0U )
+ return 0U;
+
+ unsigned elpsed_sec = static_cast<unsigned>(elapsed); // rounding to number of whole seconds
+
+ return tu_timeout > elpsed_sec ? tu_timeout - elpsed_sec : TIMEOUT_EXCEEDED;
+ }
+
struct priority_order {
bool operator()( test_observer* lhs, test_observer* rhs ) const
{
@@ -200,226 +736,467 @@ public:
}
};
+ // Data members
typedef std::map<test_unit_id,test_unit*> test_unit_store;
typedef std::set<test_observer*,priority_order> observer_store;
+ struct context_frame {
+ context_frame( std::string const& d, int id, bool sticky )
+ : descr( d )
+ , frame_id( id )
+ , is_sticky( sticky )
+ {}
+
+ std::string descr;
+ int frame_id;
+ bool is_sticky;
+ };
+ typedef std::vector<context_frame> context_data;
master_test_suite_t* m_master_test_suite;
+ std::vector<test_suite*> m_auto_test_suites;
+
test_unit_id m_curr_test_case;
test_unit_store m_test_units;
test_unit_id m_next_test_case_id;
test_unit_id m_next_test_suite_id;
- bool m_is_initialized;
bool m_test_in_progress;
observer_store m_observers;
+ context_data m_context;
+ int m_context_idx;
+
+ boost::execution_monitor m_aux_em;
};
//____________________________________________________________________________//
+namespace impl {
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; }
+framework::state& s_frk_state() { static framework::state* the_inst = 0; if(!the_inst) the_inst = new framework::state; return *the_inst; }
#else
-framework_impl& s_frk_impl() { static framework_impl the_inst; return the_inst; }
+framework::state& s_frk_state() { static framework::state the_inst; return the_inst; }
#endif
} // local namespace
+void
+setup_for_execution( test_unit const& tu )
+{
+ s_frk_state().deduce_run_status( tu.p_id );
+}
+
//____________________________________________________________________________//
-namespace framework {
+} // namespace impl
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** framework::init ************** //
+// ************************************************************************** //
void
init( init_unit_test_func init_func, int argc, char* argv[] )
{
+ // 10. Set up runtime parameters
runtime_config::init( argc, argv );
- // set the log level and format
+ // 20. Set the desired log level and format
unit_test_log.set_threshold_level( runtime_config::log_level() );
unit_test_log.set_format( runtime_config::log_format() );
- // set the report level and format
+ // 30. Set the desired report level and format
results_reporter::set_level( runtime_config::report_level() );
results_reporter::set_format( runtime_config::report_format() );
+ // 40. Register default test observers
register_observer( results_collector );
register_observer( unit_test_log );
if( runtime_config::show_progress() )
register_observer( progress_monitor );
+ // 50. Set up memory leak detection
if( runtime_config::detect_memory_leaks() > 0 ) {
- debug::detect_memory_leaks( true );
+ debug::detect_memory_leaks( true, runtime_config::memory_leaks_report_file() );
debug::break_memory_alloc( runtime_config::detect_memory_leaks() );
}
- // init master unit test suite
+ // 60. Initialize master unit test suite
master_test_suite().argc = argc;
master_test_suite().argv = argv;
- try {
- boost::execution_monitor em;
-
- ut_detail::test_init_caller tic( init_func );
+ using namespace impl;
- em.execute( tic );
+ // 70. Invoke test module initialization routine
+ BOOST_TEST_IMPL_TRY {
+ s_frk_state().m_aux_em.vexecute( boost::bind( &impl::invoke_init_func, init_func ) );
}
- catch( execution_exception const& ex ) {
- throw setup_error( ex.what() );
+ BOOST_TEST_IMPL_CATCH( execution_exception, ex ) {
+ BOOST_TEST_SETUP_ASSERT( false, ex.what() );
}
-
- s_frk_impl().m_is_initialized = true;
}
//____________________________________________________________________________//
+void
+finalize_setup_phase( test_unit_id master_tu_id )
+{
+ if( master_tu_id == INV_TEST_UNIT_ID )
+ master_tu_id = master_test_suite().p_id;
+
+ // 10. Apply all decorators to the auto test units
+ class apply_decorators : public test_tree_visitor {
+ private:
+ // test_tree_visitor interface
+ virtual bool visit( test_unit const& tu )
+ {
+ BOOST_TEST_FOREACH( decorator::base_ptr, d, tu.p_decorators.get() )
+ d->apply( const_cast<test_unit&>(tu) );
+
+ return true;
+ }
+ } ad;
+ traverse_test_tree( master_tu_id, ad, true );
+
+ // 20. Finalize setup phase
+ impl::order_info_per_tu tuoi;
+ impl::s_frk_state().deduce_siblings_order( master_tu_id, master_tu_id, tuoi );
+ impl::s_frk_state().finalize_default_run_status( master_tu_id, test_unit::RS_INVALID );
+}
+
+// ************************************************************************** //
+// ************** test_in_progress ************** //
+// ************************************************************************** //
+
bool
-is_initialized()
+test_in_progress()
+{
+ return impl::s_frk_state().m_test_in_progress;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** framework::shutdown ************** //
+// ************************************************************************** //
+
+void
+shutdown()
{
- return s_frk_impl().m_is_initialized;
+ // eliminating some fake memory leak reports. See for more details:
+ // http://connect.microsoft.com/VisualStudio/feedback/details/106937/memory-leaks-reported-by-debug-crt-inside-typeinfo-name
+
+# if BOOST_WORKAROUND(BOOST_MSVC, <= 1600 ) && !defined(_DLL) && defined(_DEBUG)
+# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 )
+#define _Next next
+#define _MemPtr memPtr
+#endif
+ __type_info_node* pNode = __type_info_root_node._Next;
+ __type_info_node* tmpNode = &__type_info_root_node;
+
+ for( ; pNode!=NULL; pNode = tmpNode ) {
+ tmpNode = pNode->_Next;
+ delete pNode->_MemPtr;
+ delete pNode;
+ }
+# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 )
+#undef _Next
+#undef _MemPtr
+#endif
+# endif
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** register_test_unit ************** //
+// ************************************************************************** //
+
void
register_test_unit( test_case* tc )
{
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;
+ test_unit_id new_id = impl::s_frk_state().m_next_test_case_id;
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;
+ typedef state::test_unit_store::value_type map_value_type;
- s_frk_impl().m_test_units.insert( map_value_type( new_id, tc ) );
- s_frk_impl().m_next_test_case_id++;
+ impl::s_frk_state().m_test_units.insert( map_value_type( new_id, tc ) );
+ impl::s_frk_state().m_next_test_case_id++;
- s_frk_impl().set_tu_id( *tc, new_id );
+ impl::s_frk_state().set_tu_id( *tc, new_id );
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** register_test_unit ************** //
+// ************************************************************************** //
+
void
register_test_unit( test_suite* ts )
{
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;
+ test_unit_id new_id = impl::s_frk_state().m_next_test_suite_id;
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 ) );
- s_frk_impl().m_next_test_suite_id++;
+ typedef state::test_unit_store::value_type map_value_type;
+
+ impl::s_frk_state().m_test_units.insert( map_value_type( new_id, ts ) );
+ impl::s_frk_state().m_next_test_suite_id++;
- s_frk_impl().set_tu_id( *ts, new_id );
+ impl::s_frk_state().set_tu_id( *ts, new_id );
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** deregister_test_unit ************** //
+// ************************************************************************** //
+
void
deregister_test_unit( test_unit* tu )
{
- s_frk_impl().m_test_units.erase( tu->p_id );
+ impl::s_frk_state().m_test_units.erase( tu->p_id );
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** clear ************** //
+// ************************************************************************** //
+
void
clear()
{
- s_frk_impl().clear();
+ impl::s_frk_state().clear();
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** register_observer ************** //
+// ************************************************************************** //
+
void
register_observer( test_observer& to )
{
- s_frk_impl().m_observers.insert( &to );
+ impl::s_frk_state().m_observers.insert( &to );
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** deregister_observer ************** //
+// ************************************************************************** //
+
void
deregister_observer( test_observer& to )
{
- s_frk_impl().m_observers.erase( &to );
+ impl::s_frk_state().m_observers.erase( &to );
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** add_context ************** //
+// ************************************************************************** //
+
+int
+add_context( ::boost::unit_test::lazy_ostream const& context_descr, bool sticky )
+{
+ std::stringstream buffer;
+ context_descr( buffer );
+ int res_idx = impl::s_frk_state().m_context_idx++;
+
+ impl::s_frk_state().m_context.push_back( state::context_frame( buffer.str(), res_idx, sticky ) );
+
+ return res_idx;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** clear_context ************** //
+// ************************************************************************** //
+
+struct frame_with_id {
+ explicit frame_with_id( int id ) : m_id( id ) {}
+
+ bool operator()( state::context_frame const& f )
+ {
+ return f.frame_id == m_id;
+ }
+ int m_id;
+};
+
+//____________________________________________________________________________//
+
void
-reset_observers()
+clear_context( int frame_id )
+{
+ if( frame_id == -1 ) { // clear all non sticky frames
+ for( int i=static_cast<int>(impl::s_frk_state().m_context.size())-1; i>=0; i-- )
+ if( !impl::s_frk_state().m_context[i].is_sticky )
+ impl::s_frk_state().m_context.erase( impl::s_frk_state().m_context.begin()+i );
+ }
+
+ else { // clear specific frame
+ state::context_data::iterator it =
+ std::find_if( impl::s_frk_state().m_context.begin(), impl::s_frk_state().m_context.end(), frame_with_id( frame_id ) );
+
+ if( it != impl::s_frk_state().m_context.end() ) // really an internal error if this is not true
+ impl::s_frk_state().m_context.erase( it );
+ }
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** get_context ************** //
+// ************************************************************************** //
+
+context_generator
+get_context()
+{
+ return context_generator();
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** context_generator ************** //
+// ************************************************************************** //
+
+bool
+context_generator::is_empty() const
{
- s_frk_impl().m_observers.clear();
+ return impl::s_frk_state().m_context.empty();
}
//____________________________________________________________________________//
+const_string
+context_generator::next() const
+{
+ return m_curr_frame < impl::s_frk_state().m_context.size() ? impl::s_frk_state().m_context[m_curr_frame++].descr : const_string();
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** master_test_suite ************** //
+// ************************************************************************** //
+
master_test_suite_t&
master_test_suite()
{
- if( !s_frk_impl().m_master_test_suite )
- s_frk_impl().m_master_test_suite = new master_test_suite_t;
+ if( !impl::s_frk_state().m_master_test_suite )
+ impl::s_frk_state().m_master_test_suite = new master_test_suite_t;
- return *s_frk_impl().m_master_test_suite;
+ return *impl::s_frk_state().m_master_test_suite;
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** current_auto_test_suite ************** //
+// ************************************************************************** //
+
+test_suite&
+current_auto_test_suite( test_suite* ts, bool push_or_pop )
+{
+ if( impl::s_frk_state().m_auto_test_suites.empty() )
+ impl::s_frk_state().m_auto_test_suites.push_back( &framework::master_test_suite() );
+
+ if( !push_or_pop )
+ impl::s_frk_state().m_auto_test_suites.pop_back();
+ else if( ts )
+ impl::s_frk_state().m_auto_test_suites.push_back( ts );
+
+ return *impl::s_frk_state().m_auto_test_suites.back();
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** current_test_case ************** //
+// ************************************************************************** //
+
test_case const&
current_test_case()
{
- return get<test_case>( s_frk_impl().m_curr_test_case );
+ return get<test_case>( impl::s_frk_state().m_curr_test_case );
}
//____________________________________________________________________________//
+test_unit_id
+current_test_case_id()
+{
+ return impl::s_frk_state().m_curr_test_case;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** framework::get ************** //
+// ************************************************************************** //
+
test_unit&
get( test_unit_id id, test_unit_type t )
{
- test_unit* res = s_frk_impl().m_test_units[id];
+ test_unit* res = impl::s_frk_state().m_test_units[id];
if( (res->p_type & t) == 0 )
- throw internal_error( "Invalid test unit type" );
+ BOOST_TEST_IMPL_THROW( internal_error( "Invalid test unit type" ) );
return *res;
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** framework::run ************** //
+// ************************************************************************** //
+
void
run( test_unit_id id, bool continue_test )
{
if( id == INV_TEST_UNIT_ID )
id = master_test_suite().p_id;
+ // Figure out run status for execution phase
+ impl::s_frk_state().deduce_run_status( id );
+
test_case_counter tcc;
traverse_test_tree( id, tcc );
- 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" ) );
+ BOOST_TEST_SETUP_ASSERT( tcc.p_count != 0 , runtime_config::test_to_run().empty()
+ ? BOOST_TEST_L( "test tree is empty" )
+ : BOOST_TEST_L( "no test cases matching filter or all test cases were disabled" ) );
- bool call_start_finish = !continue_test || !s_frk_impl().m_test_in_progress;
- bool was_in_progress = s_frk_impl().m_test_in_progress;
+ bool was_in_progress = framework::test_in_progress();
+ bool call_start_finish = !continue_test || !was_in_progress;
- s_frk_impl().m_test_in_progress = true;
+ impl::s_frk_state().m_test_in_progress = true;
if( call_start_finish ) {
- BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers ) {
- boost::execution_monitor em;
-
- try {
- em.execute( ut_detail::test_start_caller( to, tcc.p_count ) );
+ BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) {
+ BOOST_TEST_IMPL_TRY {
+ impl::s_frk_state().m_aux_em.vexecute( boost::bind( &test_observer::test_start, to, tcc.p_count ) );
}
- catch( execution_exception const& ex ) {
- throw setup_error( ex.what() );
+ BOOST_TEST_IMPL_CATCH( execution_exception, ex ) {
+ BOOST_TEST_SETUP_ASSERT( false, ex.what() );
}
}
}
@@ -428,7 +1205,7 @@ run( test_unit_id id, bool continue_test )
case 0:
break;
case 1: {
- unsigned int seed = static_cast<unsigned int>( std::time( 0 ) );
+ unsigned seed = static_cast<unsigned>( std::time( 0 ) );
BOOST_TEST_MESSAGE( "Test cases order is shuffled using seed: " << seed );
std::srand( seed );
break;
@@ -438,19 +1215,14 @@ run( test_unit_id id, bool continue_test )
std::srand( runtime_config::random_seed() );
}
- try {
- traverse_test_tree( id, s_frk_impl() );
- }
- catch( test_being_aborted const& ) {
- // abort already reported
- }
+ impl::s_frk_state().execute_test_tree( id );
if( call_start_finish ) {
- BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )
+ BOOST_TEST_REVERSE_FOREACH( test_observer*, to, impl::s_frk_state().m_observers )
to->test_finish();
}
- s_frk_impl().m_test_in_progress = was_in_progress;
+ impl::s_frk_state().m_test_in_progress = was_in_progress;
}
//____________________________________________________________________________//
@@ -463,41 +1235,49 @@ run( test_unit const* tu, bool continue_test )
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** assertion_result ************** //
+// ************************************************************************** //
+
void
-assertion_result( bool passed )
+assertion_result( unit_test::assertion_result ar )
{
- BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )
- to->assertion_result( passed );
+ BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers )
+ to->assertion_result( ar );
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** exception_caught ************** //
+// ************************************************************************** //
+
void
exception_caught( execution_exception const& ex )
{
- BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )
+ BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers )
to->exception_caught( ex );
}
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** test_unit_aborted ************** //
+// ************************************************************************** //
+
void
test_unit_aborted( test_unit const& tu )
{
- BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )
+ BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers )
to->test_unit_aborted( tu );
}
//____________________________________________________________________________//
} // namespace framework
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_FRAMEWORK_IPP_021005GER
diff --git a/boost/test/impl/interaction_based.ipp b/boost/test/impl/interaction_based.ipp
deleted file mode 100644
index ce2893364a..0000000000
--- a/boost/test/impl/interaction_based.ipp
+++ /dev/null
@@ -1,90 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Facilities to perform interaction-based testing
-// ***************************************************************************
-
-#ifndef BOOST_TEST_INTERACTION_BASED_IPP_112105GER
-#define BOOST_TEST_INTERACTION_BASED_IPP_112105GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-
-#if BOOST_TEST_SUPPORT_INTERACTION_TESTING
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/utils/callback.hpp>
-#include <boost/test/interaction_based.hpp>
-#include <boost/test/mock_object.hpp>
-#include <boost/test/framework.hpp> // for setup_error
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-// STL
-#include <stdexcept>
-#include <string>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace itest { // interaction-based testing
-
-// ************************************************************************** //
-// ************** manager ************** //
-// ************************************************************************** //
-
-manager::manager()
-{
- instance_ptr( true, this );
-}
-
-//____________________________________________________________________________//
-
-manager::~manager()
-{
- instance_ptr( true );
-}
-
-//____________________________________________________________________________//
-
-manager*
-manager::instance_ptr( bool reset, manager* new_ptr )
-{
- static manager dummy( 0 );
-
- static manager* ptr = &dummy;
-
- if( reset ) {
- if( new_ptr ) {
- BOOST_TEST_SETUP_ASSERT( ptr == &dummy, BOOST_TEST_L( "Can't run two interation based test the same time" ) );
-
- ptr = new_ptr;
- }
- else
- ptr = &dummy;
- }
-
- return ptr;
-}
-
-} // namespace itest
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // not ancient compiler
-
-#endif // BOOST_TEST_INTERACTION_BASED_IPP_112105GER
diff --git a/boost/test/impl/logged_expectations.ipp b/boost/test/impl/logged_expectations.ipp
deleted file mode 100644
index ff30628b8e..0000000000
--- a/boost/test/impl/logged_expectations.ipp
+++ /dev/null
@@ -1,246 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, ELOG_VER 1.0. (See accompanying file
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Facilities to perform interaction based testng of logged expectations
-// ***************************************************************************
-
-#ifndef BOOST_TEST_LOGGED_EXPECTATIONS_IPP_120905GER
-#define BOOST_TEST_LOGGED_EXPECTATIONS_IPP_120905GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-
-#if BOOST_TEST_SUPPORT_INTERACTION_TESTING
-
-#include <boost/test/detail/global_typedef.hpp>
-
-#include <boost/test/utils/callback.hpp>
-#include <boost/test/utils/iterator/token_iterator.hpp>
-
-#include <boost/test/interaction_based.hpp>
-#include <boost/test/test_tools.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-// Boost
-#include <boost/lexical_cast.hpp>
-
-// STL
-#include <fstream>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-using namespace ::boost::unit_test;
-
-namespace itest {
-
-// ************************************************************************** //
-// ************** logged expectation test implementation ************** //
-// ************************************************************************** //
-
-struct expectations_logger : itest::manager {
- // Constructor
- expectations_logger( const_string log_file_name, bool test_or_log );
-
- virtual bool decision_point( const_string, std::size_t );
- virtual unsigned enter_scope( const_string, std::size_t, const_string scope_name );
- virtual void allocated( const_string, std::size_t, void*, std::size_t s );
- virtual void data_flow( const_string d );
- virtual std::string return_value( const_string default_value );
-
-private:
- // Data members
- bool m_test_or_log;
- std::fstream m_log_file;
-};
-
-literal_string ELOG_VER = "1.0";
-literal_string CLMN_SEP = "|";
-static const char LINE_SEP = '\n';
-
-literal_string FILE_SIG = "ELOG";
-literal_string SCOPE_SIG = "SCOPE";
-literal_string ALLOC_SIG = "ALLOC";
-literal_string DP_SIG = "SWITCH";
-literal_string DATA_SIG = "DATA";
-literal_string RETURN_SIG = "RETURN";
-
-//____________________________________________________________________________//
-
-expectations_logger::expectations_logger( const_string log_file_name, bool test_or_log )
-: m_test_or_log( test_or_log )
-{
- BOOST_REQUIRE_MESSAGE( !log_file_name.is_empty(), "Empty expectations log file name" );
-
- 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(),
- "Can't open expectations log file " << log_file_name
- << " for " << ( m_test_or_log ? "reading" : "writing") );
-
- if( m_test_or_log ) {
- std::string line;
-
- std::getline( m_log_file, line, LINE_SEP );
-
- const_string cline( line );
- string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));
-
- BOOST_CHECK_EQUAL( *tit, FILE_SIG );
- ++tit;
- BOOST_CHECK_EQUAL( *tit, ELOG_VER );
- }
- else {
- m_log_file << FILE_SIG << CLMN_SEP << ELOG_VER << LINE_SEP;
- }
-}
-
-//____________________________________________________________________________//
-
-bool
-expectations_logger::decision_point( const_string, std::size_t )
-{
- if( m_test_or_log ) {
- std::string line;
-
- std::getline( m_log_file, line, LINE_SEP );
-
- const_string cline( line );
- string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));
-
- BOOST_CHECK_EQUAL( *tit, DP_SIG ); ++tit;
- return lexical_cast<bool>( *tit );
- }
- else {
- m_log_file << DP_SIG << CLMN_SEP << std::boolalpha << true << LINE_SEP;
-
- return true;
- }
-}
-
-//____________________________________________________________________________//
-
-unsigned
-expectations_logger::enter_scope( const_string, std::size_t, const_string scope_name )
-{
- if( m_test_or_log ) {
- std::string line;
-
- std::getline( m_log_file, line, LINE_SEP );
-
- const_string cline( line );
- string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));
-
- BOOST_CHECK_EQUAL( *tit, SCOPE_SIG ); ++tit;
- BOOST_CHECK_EQUAL( *tit, scope_name );
- }
- else {
- m_log_file << SCOPE_SIG << CLMN_SEP << scope_name << LINE_SEP;
- }
-
- return 0;
-}
-
-//____________________________________________________________________________//
-
-void
-expectations_logger::allocated( const_string, std::size_t, void*, std::size_t s )
-{
- if( m_test_or_log ) {
- std::string line;
-
- std::getline( m_log_file, line, LINE_SEP );
-
- const_string cline( line );
- string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));
-
- BOOST_CHECK_EQUAL( *tit, ALLOC_SIG ); ++tit;
- BOOST_CHECK_EQUAL( lexical_cast<std::size_t>( *tit ), s );
- }
- else {
- m_log_file << ALLOC_SIG << CLMN_SEP << s << LINE_SEP;
- }
-}
-
-//____________________________________________________________________________//
-
-void
-expectations_logger::data_flow( const_string d )
-{
- if( m_test_or_log ) {
- std::string line;
-
- std::getline( m_log_file, line, LINE_SEP );
-
- const_string cline( line );
- string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));
-
- BOOST_CHECK_EQUAL( *tit, DATA_SIG ); ++tit;
- BOOST_CHECK_EQUAL( *tit, d );
- }
- else {
- m_log_file << DATA_SIG << CLMN_SEP << d << LINE_SEP;
- }
-}
-
-//____________________________________________________________________________//
-
-std::string
-expectations_logger::return_value( const_string default_value )
-{
- if( m_test_or_log ) {
- std::string line;
-
- std::getline( m_log_file, line, LINE_SEP );
-
- const_string cline( line );
- string_token_iterator tit( cline, (dropped_delimeters = CLMN_SEP, kept_delimeters = dt_none));
-
- BOOST_CHECK_EQUAL( *tit, RETURN_SIG ); ++tit;
-
- return std::string( tit->begin(), tit->size() );
- }
- else {
- m_log_file << RETURN_SIG << CLMN_SEP << default_value << LINE_SEP;
-
- return std::string();
- }
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** logged expectations test ************** //
-// ************************************************************************** //
-
-void BOOST_TEST_DECL
-logged_expectations( callback0<> const& F, const_string log_file_name, bool test_or_log )
-{
- expectations_logger el( log_file_name, test_or_log );
-
- F();
-}
-
-//____________________________________________________________________________//
-
-} // namespace itest
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // not ancient compiler
-
-#endif // BOOST_TEST_LOGGED_EXPECTATIONS_IPP_120905GER
diff --git a/boost/test/impl/plain_report_formatter.ipp b/boost/test/impl/plain_report_formatter.ipp
index 95b662135d..f9e7db772a 100644
--- a/boost/test/impl/plain_report_formatter.ipp
+++ b/boost/test/impl/plain_report_formatter.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -19,9 +19,13 @@
#include <boost/test/output/plain_report_formatter.hpp>
#include <boost/test/utils/custom_manip.hpp>
#include <boost/test/results_collector.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
+
+#include <boost/test/tree/test_unit.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>
+#include <boost/test/utils/setcolor.hpp>
+
+#include <boost/test/unit_test_parameters.hpp>
// STL
#include <iomanip>
@@ -37,9 +41,7 @@ namespace std { using ::log10; }
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
namespace {
@@ -58,17 +60,16 @@ operator<<( custom_printer<quote> const& p, T const& value )
//____________________________________________________________________________//
void
-print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total,
- const_string name, const_string res )
+print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total, const_string name, const_string res )
{
- if( v > 0 ) {
- ostr << std::setw( indent ) << ""
- << v << ' ' << name << ( v != 1 ? "s" : "" );
- if( total > 0 )
- ostr << " out of " << total;
+ if( v == 0 )
+ return;
- ostr << ' ' << res << '\n';
- }
+ if( total > 0 )
+ ostr << std::setw( static_cast<int>(indent) ) << "" << v << ' ' << name << ( v != 1 ? "s" : "" )
+ << " out of " << total << ' ' << res << '\n';
+ else
+ ostr << std::setw( static_cast<int>(indent) ) << "" << v << ' ' << res << ' ' << name << ( v != 1 ? "s" : "" ) << '\n';
}
//____________________________________________________________________________//
@@ -104,40 +105,42 @@ plain_report_formatter::test_unit_report_start( test_unit const& tu, std::ostrea
const_string descr;
if( tr.passed() )
- descr = "passed";
+ descr = "has passed";
else if( tr.p_skipped )
- descr = "skipped";
+ descr = "was skipped";
else if( tr.p_aborted )
- descr = "aborted";
+ descr = "was aborted";
else
- descr = "failed";
+ descr = "has failed";
- ostr << std::setw( m_indent ) << ""
- << "Test " << (tu.p_type == tut_case ? "case " : "suite " ) << quote() << tu.p_name << ' ' << descr;
+ ostr << std::setw( static_cast<int>(m_indent) ) << ""
+ << "Test " << tu.p_type_name << ' ' << quote() << tu.full_name() << ' ' << descr;
if( tr.p_skipped ) {
- ostr << " due to " << (tu.check_dependencies() ? "test aborting\n" : "failed dependancy\n" );
+ ostr << "\n";
m_indent += 2;
return;
}
-
+
counter_t total_assertions = tr.p_assertions_passed + tr.p_assertions_failed;
- counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_failed + tr.p_test_cases_skipped;
+ counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_warned + tr.p_test_cases_failed + tr.p_test_cases_skipped;
- if( total_assertions > 0 || total_tc > 0 )
+ if( total_assertions > 0 || total_tc > 0 || tr.p_warnings_failed > 0)
ostr << " with:";
ostr << '\n';
m_indent += 2;
- print_stat_value( ostr, tr.p_assertions_passed, m_indent, total_assertions, "assertion", "passed" );
- print_stat_value( ostr, tr.p_assertions_failed, m_indent, total_assertions, "assertion", "failed" );
- print_stat_value( ostr, tr.p_expected_failures, m_indent, 0 , "failure" , "expected" );
- print_stat_value( ostr, tr.p_test_cases_passed, m_indent, total_tc , "test case", "passed" );
- print_stat_value( ostr, tr.p_test_cases_failed, m_indent, total_tc , "test case", "failed" );
- print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" );
- print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" );
-
+ print_stat_value( ostr, tr.p_test_cases_passed , m_indent, total_tc , "test case", "passed" );
+ print_stat_value( ostr, tr.p_test_cases_warned , m_indent, total_tc , "test case", "passed with warnings" );
+ print_stat_value( ostr, tr.p_test_cases_failed , m_indent, total_tc , "test case", "failed" );
+ print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" );
+ print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" );
+ print_stat_value( ostr, tr.p_assertions_passed , m_indent, total_assertions, "assertion", "passed" );
+ print_stat_value( ostr, tr.p_assertions_failed , m_indent, total_assertions, "assertion", "failed" );
+ print_stat_value( ostr, tr.p_warnings_failed , m_indent, 0 , "warning" , "failed" );
+ print_stat_value( ostr, tr.p_expected_failures , m_indent, 0 , "failure" , "expected" );
+
ostr << '\n';
}
@@ -155,44 +158,50 @@ void
plain_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr )
{
test_results const& tr = results_collector.results( tu.p_id );
-
+
if( tr.passed() ) {
+ BOOST_TEST_SCOPE_SETCOLOR( ostr, term_attr::BRIGHT, term_color::GREEN );
+
ostr << "*** No errors detected\n";
return;
}
-
+
+ BOOST_TEST_SCOPE_SETCOLOR( ostr, term_attr::BRIGHT, term_color::RED );
+
if( tr.p_skipped ) {
- ostr << "*** Test " << tu.p_type_name << " skipped due to "
- << (tu.check_dependencies() ? "test aborting\n" : "failed dependancy\n" );
+ ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was skipped"
+ << "; see standard output for details\n";
return;
}
- if( tr.p_assertions_failed == 0 ) {
- ostr << "*** errors detected in test " << tu.p_type_name << " " << quote() << tu.p_name
+ if( tr.p_aborted ) {
+ ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was aborted"
<< "; see standard output for details\n";
+ }
+
+ if( tr.p_assertions_failed == 0 ) {
+ if( !tr.p_aborted )
+ ostr << "*** Errors were detected in the test " << tu.p_type_name << ' ' << quote() << tu.full_name()
+ << "; see standard output for details\n";
return;
}
counter_t num_failures = tr.p_assertions_failed;
-
- ostr << "*** " << num_failures << " failure" << ( num_failures != 1 ? "s" : "" ) << " detected";
-
+
+ ostr << "*** " << num_failures << " failure" << ( num_failures != 1 ? "s are" : " is" ) << " detected";
+
if( tr.p_expected_failures > 0 )
- ostr << " (" << tr.p_expected_failures << " failure" << ( tr.p_expected_failures != 1 ? "s" : "" ) << " expected)";
-
- ostr << " in test " << tu.p_type_name << " " << quote() << tu.p_name << "\n";
+ ostr << " (" << tr.p_expected_failures << " failure" << ( tr.p_expected_failures != 1 ? "s are" : " is" ) << " expected)";
+
+ ostr << " in the test " << tu.p_type_name << " " << quote() << tu.full_name() << "\n";
}
//____________________________________________________________________________//
} // namespace output
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER
diff --git a/boost/test/impl/progress_monitor.ipp b/boost/test/impl/progress_monitor.ipp
index 5175755c3a..ebdd7e9320 100644
--- a/boost/test/impl/progress_monitor.ipp
+++ b/boost/test/impl/progress_monitor.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -17,12 +17,15 @@
// Boost.Test
#include <boost/test/progress_monitor.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
+#include <boost/test/unit_test_parameters.hpp>
+#include <boost/test/utils/setcolor.hpp>
+
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/test_case_counter.hpp>
+#include <boost/test/tree/traverse.hpp>
// Boost
-#include <boost/progress.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -30,13 +33,70 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
// ************** progress_monitor ************** //
// ************************************************************************** //
+struct progress_display {
+ progress_display( counter_t expected_count, std::ostream& os )
+ : m_os(os)
+ , m_count( 0 )
+ , m_expected_count( expected_count )
+ , m_next_tic_count( 0 )
+ , m_tic( 0 )
+ {
+
+ m_os << "\n0% 10 20 30 40 50 60 70 80 90 100%"
+ << "\n|----|----|----|----|----|----|----|----|----|----|"
+ << std::endl;
+
+ if( !m_expected_count )
+ m_expected_count = 1; // prevent divide by zero
+ }
+
+ unsigned long operator+=( unsigned long increment )
+ {
+ if( (m_count += increment) < m_next_tic_count )
+ return m_count;
+
+ // use of floating point ensures that both large and small counts
+ // work correctly. static_cast<>() is also used several places
+ // to suppress spurious compiler warnings.
+ unsigned int tics_needed = static_cast<unsigned int>(
+ (static_cast<double>(m_count)/m_expected_count)*50.0 );
+
+ do {
+ m_os << '*' << std::flush;
+ } while( ++m_tic < tics_needed );
+
+ m_next_tic_count = static_cast<unsigned long>((m_tic/50.0) * m_expected_count);
+
+ if( m_count == m_expected_count ) {
+ if( m_tic < 51 )
+ m_os << '*';
+
+ m_os << std::endl;
+ }
+
+ return m_count;
+ }
+ unsigned long operator++() { return operator+=( 1 ); }
+ unsigned long count() const { return m_count; }
+
+private:
+ BOOST_DELETED_FUNCTION(progress_display(progress_display const&))
+ BOOST_DELETED_FUNCTION(progress_display& operator=(progress_display const&))
+
+ std::ostream& m_os; // may not be present in all imps
+
+ unsigned long m_count;
+ unsigned long m_expected_count;
+ unsigned long m_next_tic_count;
+ unsigned int m_tic;
+};
+
namespace {
struct progress_monitor_impl {
@@ -58,6 +118,8 @@ progress_monitor_impl& s_pm_impl() { static progress_monitor_impl the_inst; retu
void
progress_monitor_t::test_start( counter_t test_cases_amount )
{
+ BOOST_TEST_SCOPE_SETCOLOR( *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA );
+
s_pm_impl().m_progress_display.reset( new progress_display( test_cases_amount, *s_pm_impl().m_stream ) );
}
@@ -66,6 +128,8 @@ progress_monitor_t::test_start( counter_t test_cases_amount )
void
progress_monitor_t::test_aborted()
{
+ BOOST_TEST_SCOPE_SETCOLOR( *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA );
+
(*s_pm_impl().m_progress_display) += s_pm_impl().m_progress_display->count();
}
@@ -74,18 +138,22 @@ progress_monitor_t::test_aborted()
void
progress_monitor_t::test_unit_finish( test_unit const& tu, unsigned long )
{
- if( tu.p_type == tut_case )
+ BOOST_TEST_SCOPE_SETCOLOR( *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA );
+
+ if( tu.p_type == TUT_CASE )
++(*s_pm_impl().m_progress_display);
}
//____________________________________________________________________________//
void
-progress_monitor_t::test_unit_skipped( test_unit const& tu )
+progress_monitor_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ )
{
+ BOOST_TEST_SCOPE_SETCOLOR( *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA );
+
test_case_counter tcc;
traverse_test_tree( tu, tcc );
-
+
(*s_pm_impl().m_progress_display) += tcc.p_count;
}
@@ -98,13 +166,10 @@ progress_monitor_t::set_stream( std::ostream& ostr )
}
//____________________________________________________________________________//
-
-} // namespace unit_test
+} // namespace unit_test
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER
diff --git a/boost/test/impl/results_collector.ipp b/boost/test/impl/results_collector.ipp
index 0d5691aab6..d04d64fd6d 100644
--- a/boost/test/impl/results_collector.ipp
+++ b/boost/test/impl/results_collector.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -16,11 +16,15 @@
#define BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER
// Boost.Test
-#include <boost/test/unit_test_suite_impl.hpp>
#include <boost/test/unit_test_log.hpp>
#include <boost/test/results_collector.hpp>
#include <boost/test/framework.hpp>
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/visitor.hpp>
+#include <boost/test/tree/test_case_counter.hpp>
+#include <boost/test/tree/traverse.hpp>
+
// Boost
#include <boost/cstdlib.hpp>
@@ -32,7 +36,6 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -52,6 +55,7 @@ test_results::passed() const
return !p_skipped &&
p_test_cases_failed == 0 &&
p_assertions_failed <= p_expected_failures &&
+ p_test_cases_skipped == 0 &&
!p_aborted;
}
@@ -73,7 +77,9 @@ test_results::operator+=( test_results const& tr )
{
p_assertions_passed.value += tr.p_assertions_passed;
p_assertions_failed.value += tr.p_assertions_failed;
+ p_warnings_failed.value += tr.p_warnings_failed;
p_test_cases_passed.value += tr.p_test_cases_passed;
+ p_test_cases_warned.value += tr.p_test_cases_warned;
p_test_cases_failed.value += tr.p_test_cases_failed;
p_test_cases_skipped.value += tr.p_test_cases_skipped;
p_test_cases_aborted.value += tr.p_test_cases_aborted;
@@ -84,25 +90,25 @@ test_results::operator+=( test_results const& tr )
void
test_results::clear()
{
- p_assertions_passed.value = 0;
- p_assertions_failed.value = 0;
- p_expected_failures.value = 0;
- p_test_cases_passed.value = 0;
- p_test_cases_failed.value = 0;
- p_test_cases_skipped.value = 0;
- p_test_cases_aborted.value = 0;
- p_aborted.value = false;
- p_skipped.value = true;
+ p_assertions_passed.value = 0;
+ p_assertions_failed.value = 0;
+ p_warnings_failed.value = 0;
+ p_expected_failures.value = 0;
+ p_test_cases_passed.value = 0;
+ p_test_cases_warned.value = 0;
+ p_test_cases_failed.value = 0;
+ p_test_cases_skipped.value = 0;
+ p_test_cases_aborted.value = 0;
+ p_aborted.value = false;
+ p_skipped.value = false;
}
//____________________________________________________________________________//
-
+
// ************************************************************************** //
// ************** results_collector ************** //
// ************************************************************************** //
-#if !BOOST_WORKAROUND(BOOST_MSVC, <1300)
-
namespace {
struct results_collector_impl {
@@ -113,16 +119,6 @@ results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; re
} // local namespace
-#else
-
-struct results_collector_impl {
- std::map<test_unit_id,test_results> m_results_store;
-};
-
-static results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; }
-
-#endif
-
//____________________________________________________________________________//
void
@@ -134,31 +130,14 @@ results_collector_t::test_start( counter_t )
//____________________________________________________________________________//
void
-results_collector_t::test_finish()
-{
- // do nothing
-}
-
-//____________________________________________________________________________//
-
-void
-results_collector_t::test_aborted()
-{
- // do nothing
-}
-
-//____________________________________________________________________________//
-
-void
results_collector_t::test_unit_start( test_unit const& tu )
{
// init test_results entry
test_results& tr = s_rc_impl().m_results_store[tu.p_id];
tr.clear();
-
- tr.p_expected_failures.value = tu.p_expected_failures;
- tr.p_skipped.value = false;
+
+ tr.p_expected_failures.value = tu.p_expected_failures;
}
//____________________________________________________________________________//
@@ -172,13 +151,18 @@ public:
test_results const& tr = results_collector.results( tc.p_id );
m_tr += tr;
- if( tr.passed() )
- m_tr.p_test_cases_passed.value++;
+ if( tr.passed() ) {
+ if( tr.p_warnings_failed )
+ m_tr.p_test_cases_warned.value++;
+ else
+ m_tr.p_test_cases_passed.value++;
+ }
else if( tr.p_skipped )
m_tr.p_test_cases_skipped.value++;
else {
if( tr.p_aborted )
m_tr.p_test_cases_aborted.value++;
+
m_tr.p_test_cases_failed.value++;
}
}
@@ -186,10 +170,9 @@ public:
{
if( m_ts.p_id == ts.p_id )
return true;
- else {
- m_tr += results_collector.results( ts.p_id );
- return false;
- }
+
+ m_tr += results_collector.results( ts.p_id );
+ return false;
}
private:
@@ -203,53 +186,55 @@ private:
void
results_collector_t::test_unit_finish( test_unit const& tu, unsigned long )
{
- if( tu.p_type == tut_suite ) {
+ if( tu.p_type == TUT_SUITE ) {
results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu );
traverse_test_tree( tu, ch );
}
else {
test_results const& tr = s_rc_impl().m_results_store[tu.p_id];
-
+
bool num_failures_match = tr.p_aborted || tr.p_assertions_failed >= tr.p_expected_failures;
if( !num_failures_match )
- BOOST_TEST_MESSAGE( "Test case " << tu.p_name << " has fewer failures than expected" );
+ BOOST_TEST_MESSAGE( "Test case " << tu.full_name() << " has fewer failures than expected" );
bool check_any_assertions = tr.p_aborted || (tr.p_assertions_failed != 0) || (tr.p_assertions_passed != 0);
if( !check_any_assertions )
- BOOST_TEST_MESSAGE( "Test case " << tu.p_name << " did not check any assertions" );
+ BOOST_TEST_MESSAGE( "Test case " << tu.full_name() << " did not check any assertions" );
}
}
//____________________________________________________________________________//
void
-results_collector_t::test_unit_skipped( test_unit const& tu )
+results_collector_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ )
{
- if( tu.p_type == tut_suite ) {
+ test_results& tr = s_rc_impl().m_results_store[tu.p_id];
+
+ tr.clear();
+
+ tr.p_skipped.value = true;
+
+ if( tu.p_type == TUT_SUITE ) {
test_case_counter tcc;
traverse_test_tree( tu, tcc );
- test_results& tr = s_rc_impl().m_results_store[tu.p_id];
-
- tr.clear();
-
- tr.p_skipped.value = true;
- tr.p_test_cases_skipped.value = tcc.p_count;
+ tr.p_test_cases_skipped.value = tcc.p_count;
}
}
//____________________________________________________________________________//
void
-results_collector_t::assertion_result( bool passed )
+results_collector_t::assertion_result( unit_test::assertion_result ar )
{
- test_results& tr = s_rc_impl().m_results_store[framework::current_test_case().p_id];
+ test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()];
- if( passed )
- tr.p_assertions_passed.value++;
- else
- tr.p_assertions_failed.value++;
+ switch( ar ) {
+ case AR_PASSED: tr.p_assertions_passed.value++; break;
+ case AR_FAILED: tr.p_assertions_failed.value++; break;
+ case AR_TRIGGERED: tr.p_warnings_failed.value++; break;
+ }
if( tr.p_assertions_failed == 1 )
first_failed_assertion();
@@ -260,7 +245,7 @@ results_collector_t::assertion_result( bool passed )
void
results_collector_t::exception_caught( execution_exception const& )
{
- test_results& tr = s_rc_impl().m_results_store[framework::current_test_case().p_id];
+ test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()];
tr.p_assertions_failed.value++;
}
@@ -284,11 +269,8 @@ results_collector_t::results( test_unit_id id ) const
//____________________________________________________________________________//
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER
diff --git a/boost/test/impl/results_reporter.ipp b/boost/test/impl/results_reporter.ipp
index 54447c3932..885295c928 100644
--- a/boost/test/impl/results_reporter.ipp
+++ b/boost/test/impl/results_reporter.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -17,13 +17,16 @@
// Boost.Test
#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
#include <boost/test/results_collector.hpp>
#include <boost/test/framework.hpp>
#include <boost/test/output/plain_report_formatter.hpp>
#include <boost/test/output/xml_report_formatter.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
+#include <boost/test/tree/visitor.hpp>
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/traverse.hpp>
+
+#include <boost/test/unit_test_parameters.hpp>
// Boost
#include <boost/scoped_ptr.hpp>
@@ -38,9 +41,7 @@ typedef ::boost::io::ios_base_all_saver io_saver_type;
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace results_reporter {
// ************************************************************************** //
@@ -126,14 +127,13 @@ void
set_format( output_format rf )
{
switch( rf ) {
- case CLF:
+ default:
+ case OF_CLF:
set_format( new output::plain_report_formatter );
break;
- case XML:
+ case OF_XML:
set_format( new output::xml_report_formatter );
break;
- default:
- break;
}
}
@@ -190,13 +190,9 @@ make_report( report_level l, test_unit_id id )
//____________________________________________________________________________//
} // namespace results_reporter
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_RESULTS_REPORTER_IPP_020105GER
diff --git a/boost/test/impl/test_main.ipp b/boost/test/impl/test_main.ipp
index b08f5e16c7..c95c91e88b 100644
--- a/boost/test/impl/test_main.ipp
+++ b/boost/test/impl/test_main.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// (C) Copyright Beman Dawes 1995-2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -6,11 +6,8 @@
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $$Revision$
-//
-// Description : implements main function for Test Execution Monitor.
+/// @file
+/// @brief Implements main function for Test Execution Monitor.
// ***************************************************************************
#ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER
@@ -32,16 +29,16 @@ extern int test_main( int argc, char* argv[] ); // prototype for user's test_
struct test_main_caller {
test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {}
-
+
void operator()() {
int test_main_result = test_main( m_argc, m_argv );
// translate a test_main non-success return into a test error
BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success );
}
-
+
private:
- // Data members
+ // Data members
int m_argc;
char** m_argv;
};
@@ -53,11 +50,11 @@ private:
::boost::unit_test::test_suite*
init_unit_test_suite( int argc, char* argv[] ) {
using namespace ::boost::unit_test;
-
+
framework::master_test_suite().p_name.value = "Test Program";
-
+
framework::master_test_suite().add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) );
-
+
return 0;
}
diff --git a/boost/test/impl/test_tools.ipp b/boost/test/impl/test_tools.ipp
index 6f5d7e9edf..03fea91605 100644
--- a/boost/test/impl/test_tools.ipp
+++ b/boost/test/impl/test_tools.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -16,12 +16,18 @@
#define BOOST_TEST_TEST_TOOLS_IPP_012205GER
// Boost.Test
-#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_log.hpp>
-#include <boost/test/output_test_stream.hpp>
+#include <boost/test/tools/context.hpp>
+#include <boost/test/tools/output_test_stream.hpp>
+
+#include <boost/test/tools/detail/fwd.hpp>
+#include <boost/test/tools/detail/print_helper.hpp>
+
#include <boost/test/framework.hpp>
+#include <boost/test/tree/test_unit.hpp>
#include <boost/test/execution_monitor.hpp> // execution_aborted
-#include <boost/test/unit_test_suite_impl.hpp>
+
+#include <boost/test/detail/throw_exception.hpp>
// Boost
#include <boost/config.hpp>
@@ -33,6 +39,8 @@
#include <cctype>
#include <cwchar>
#include <stdexcept>
+#include <vector>
+#include <utility>
#include <ios>
// !! should we use #include <cstdarg>
@@ -50,8 +58,8 @@ namespace std { using ::wcscmp; }
# endif
namespace boost {
-
namespace test_tools {
+namespace tt_detail {
// ************************************************************************** //
// ************** print_log_value ************** //
@@ -105,119 +113,78 @@ print_log_value<wchar_t const*>::operator()( std::ostream& ostr, wchar_t const*
//____________________________________________________________________________//
-namespace tt_detail {
-
// ************************************************************************** //
// ************** TOOL BOX Implementation ************** //
// ************************************************************************** //
using ::boost::unit_test::lazy_ostream;
-bool
-check_impl( predicate_result const& pr, lazy_ostream const& check_descr,
- const_string file_name, std::size_t line_num,
- tool_level tl, check_type ct,
- std::size_t num_of_args, ... )
+static char const* check_str [] = { " == ", " != ", " < " , " <= ", " > " , " >= " };
+static char const* rever_str [] = { " != ", " == ", " >= ", " > " , " <= ", " < " };
+
+template<typename OutStream>
+void
+format_report( OutStream& os, assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr,
+ tool_level tl, check_type ct,
+ std::size_t num_args, va_list args,
+ char const* prefix, char const* suffix )
{
using namespace unit_test;
- if( !framework::is_initialized() )
- throw std::runtime_error( "can't use testing tools before framework is initialized" );
-
- if( !!pr )
- tl = PASS;
-
- log_level ll;
- char const* prefix;
- char const* suffix;
-
- switch( tl ) {
- case PASS:
- ll = log_successful_tests;
- prefix = "check ";
- suffix = " passed";
- break;
- case WARN:
- ll = log_warnings;
- prefix = "condition ";
- suffix = " is not satisfied";
- break;
- case CHECK:
- ll = log_all_errors;
- prefix = "check ";
- suffix = " failed";
- break;
- case REQUIRE:
- ll = log_fatal_errors;
- prefix = "critical check ";
- suffix = " failed";
- break;
- default:
- return true;
- }
-
switch( ct ) {
case CHECK_PRED:
- unit_test_log << unit_test::log::begin( file_name, line_num )
- << ll << prefix << check_descr << suffix;
-
+ os << prefix << assertion_descr << suffix;
+
if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
-
- unit_test_log << unit_test::log::end();
+ os << ". " << pr.message();
break;
+ case CHECK_BUILT_ASSERTION: {
+ os << prefix << assertion_descr << suffix;
+
+ if( tl != PASS ) {
+ const_string details_message = pr.message();
+
+ if( !details_message.is_empty() ) {
+ os << details_message;
+ }
+ }
+ break;
+ }
+
case CHECK_MSG:
- unit_test_log << unit_test::log::begin( file_name, line_num ) << ll;
-
if( tl == PASS )
- unit_test_log << prefix << "'" << check_descr << "'" << suffix;
+ os << prefix << "'" << assertion_descr << "'" << suffix;
else
- unit_test_log << check_descr;
-
- if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
+ os << assertion_descr;
- unit_test_log << unit_test::log::end();
+ if( !pr.has_empty_message() )
+ os << ". " << pr.message();
break;
- case CHECK_EQUAL:
- case CHECK_NE:
- case CHECK_LT:
- case CHECK_LE:
- case CHECK_GT:
+ case CHECK_EQUAL:
+ case CHECK_NE:
+ case CHECK_LT:
+ case CHECK_LE:
+ case CHECK_GT:
case CHECK_GE: {
- static char const* check_str [] = { " == ", " != ", " < " , " <= ", " > " , " >= " };
- static char const* rever_str [] = { " != ", " == ", " >= ", " > " , " <= ", " < " };
-
- va_list args;
-
- va_start( args, num_of_args );
char const* arg1_descr = va_arg( args, char const* );
lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* );
char const* arg2_descr = va_arg( args, char const* );
lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* );
- unit_test_log << unit_test::log::begin( file_name, line_num )
- << ll << prefix << arg1_descr << check_str[ct-CHECK_EQUAL] << arg2_descr << suffix;
+ os << prefix << arg1_descr << check_str[ct-CHECK_EQUAL] << arg2_descr << suffix;
if( tl != PASS )
- unit_test_log << " [" << *arg1_val << rever_str[ct-CHECK_EQUAL] << *arg2_val << "]" ;
+ os << " [" << *arg1_val << rever_str[ct-CHECK_EQUAL] << *arg2_val << "]" ;
- va_end( args );
-
if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
-
- unit_test_log << unit_test::log::end();
+ os << ". " << pr.message();
break;
}
case CHECK_CLOSE:
case CHECK_CLOSE_FRACTION: {
- va_list args;
-
- va_start( args, num_of_args );
char const* arg1_descr = va_arg( args, char const* );
lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* );
char const* arg2_descr = va_arg( args, char const* );
@@ -225,151 +192,172 @@ check_impl( predicate_result const& pr, lazy_ostream const& check_descr,
/* toler_descr = */ va_arg( args, char const* );
lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* );
- unit_test_log << unit_test::log::begin( file_name, line_num ) << ll;
-
- 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;
+ os << "difference{" << pr.message()
+ << "} 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 );
-
- unit_test_log << unit_test::log::end();
+ os << "%";
break;
}
case CHECK_SMALL: {
- va_list args;
-
- va_start( args, num_of_args );
char const* arg1_descr = va_arg( args, char const* );
lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* );
/* toler_descr = */ va_arg( args, char const* );
lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* );
- unit_test_log << unit_test::log::begin( file_name, line_num ) << ll;
-
- unit_test_log << "absolute value of " << arg1_descr << "{" << *arg1_val << "}"
- << ( tl == PASS ? " doesn't exceed " : " exceeds " )
- << *toler_val;
+ os << "absolute value of " << arg1_descr << "{" << *arg1_val << "}"
+ << ( tl == PASS ? " doesn't exceed " : " exceeds " )
+ << *toler_val;
- va_end( args );
-
if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
-
- unit_test_log << unit_test::log::end();
+ os << ". " << pr.message();
break;
}
case CHECK_PRED_WITH_ARGS: {
- unit_test_log << unit_test::log::begin( file_name, line_num )
- << ll << prefix << check_descr;
+ std::vector< std::pair<char const*, lazy_ostream const*> > args_copy;
+ args_copy.reserve( num_args );
+ for( std::size_t i = 0; i < num_args; ++i ) {
+ char const* desc = va_arg( args, char const* );
+ lazy_ostream const* value = va_arg( args, lazy_ostream const* );
+ args_copy.push_back( std::make_pair( desc, value ) );
+ }
+
+ os << prefix << assertion_descr;
// print predicate call description
- {
- va_list args;
- va_start( args, num_of_args );
-
- unit_test_log << "( ";
- for( std::size_t i = 0; i < num_of_args; ++i ) {
- unit_test_log << va_arg( args, char const* );
- va_arg( args, lazy_ostream const* ); // skip argument value;
-
- if( i != num_of_args-1 )
- unit_test_log << ", ";
- }
- unit_test_log << " )" << suffix;
- va_end( args );
+ os << "( ";
+ for( std::size_t i = 0; i < num_args; ++i ) {
+ os << args_copy[i].first;
+
+ if( i != num_args-1 )
+ os << ", ";
}
-
+ os << " )" << suffix;
+
if( tl != PASS ) {
- va_list args;
- va_start( args, num_of_args );
-
- unit_test_log << " for ( ";
- for( std::size_t i = 0; i < num_of_args; ++i ) {
- va_arg( args, char const* ); // skip argument description;
- unit_test_log << *va_arg( args, lazy_ostream const* );
-
- if( i != num_of_args-1 )
- unit_test_log << ", ";
+ os << " for ( ";
+ for( std::size_t i = 0; i < num_args; ++i ) {
+ os << *args_copy[i].second;
+
+ if( i != num_args-1 )
+ os << ", ";
}
- unit_test_log << " )";
- va_end( args );
+ os << " )";
}
-
- if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
- unit_test_log << unit_test::log::end();
+ if( !pr.has_empty_message() )
+ os << ". " << pr.message();
break;
}
case CHECK_EQUAL_COLL: {
- va_list args;
-
- va_start( args, num_of_args );
char const* left_begin_descr = va_arg( args, char const* );
char const* left_end_descr = va_arg( args, char const* );
char const* right_begin_descr = va_arg( args, char const* );
char const* right_end_descr = va_arg( args, char const* );
- unit_test_log << unit_test::log::begin( file_name, line_num )
- << ll << prefix
- << "{ " << left_begin_descr << ", " << left_end_descr << " } == { "
- << right_begin_descr << ", " << right_end_descr << " }"
- << suffix;
+ os << prefix << "{ " << left_begin_descr << ", " << left_end_descr << " } == { "
+ << right_begin_descr << ", " << right_end_descr << " }"
+ << suffix;
- va_end( args );
-
if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
-
- unit_test_log << unit_test::log::end();
+ os << ". " << pr.message();
break;
}
case CHECK_BITWISE_EQUAL: {
- va_list args;
-
- va_start( args, num_of_args );
char const* left_descr = va_arg( args, char const* );
char const* right_descr = va_arg( args, char const* );
- unit_test_log << unit_test::log::begin( file_name, line_num )
- << ll << prefix << left_descr << " =.= " << right_descr << suffix;
+ os << prefix << left_descr << " =.= " << right_descr << suffix;
- va_end( args );
-
if( !pr.has_empty_message() )
- unit_test_log << ". " << pr.message();
-
- unit_test_log << unit_test::log::end();
+ os << ". " << pr.message();
break;
}
}
+}
+
+//____________________________________________________________________________//
+
+bool
+report_assertion( assertion_result const& ar,
+ lazy_ostream const& assertion_descr,
+ const_string file_name,
+ std::size_t line_num,
+ tool_level tl,
+ check_type ct,
+ std::size_t num_args, ... )
+{
+ using namespace unit_test;
+
+ if( framework::current_test_case_id() == INV_TEST_UNIT_ID )
+ BOOST_TEST_IMPL_THROW(
+ std::runtime_error( "can't use testing tools outside of test case implementation" ) );
+
+ if( !!ar )
+ tl = PASS;
+
+ log_level ll;
+ char const* prefix;
+ char const* suffix;
switch( tl ) {
case PASS:
- framework::assertion_result( true );
+ ll = log_successful_tests;
+ prefix = "check ";
+ suffix = " has passed";
+ break;
+ case WARN:
+ ll = log_warnings;
+ prefix = "condition ";
+ suffix = " is not satisfied";
+ break;
+ case CHECK:
+ ll = log_all_errors;
+ prefix = "check ";
+ suffix = " has failed";
+ break;
+ case REQUIRE:
+ ll = log_fatal_errors;
+ prefix = "critical check ";
+ suffix = " has failed";
+ break;
+ default:
+ return true;
+ }
+
+ unit_test_log << unit_test::log::begin( file_name, line_num ) << ll;
+ va_list args;
+ va_start( args, num_args );
+
+ format_report( unit_test_log, ar, assertion_descr, tl, ct, num_args, args, prefix, suffix );
+
+ va_end( args );
+ unit_test_log << unit_test::log::end();
+
+ switch( tl ) {
+ case PASS:
+ framework::assertion_result( AR_PASSED );
return true;
case WARN:
+ framework::assertion_result( AR_TRIGGERED );
return false;
case CHECK:
- framework::assertion_result( false );
+ framework::assertion_result( AR_FAILED );
return false;
-
+
case REQUIRE:
- framework::assertion_result( false );
+ framework::assertion_result( AR_FAILED );
framework::test_unit_aborted( framework::current_test_case() );
- throw execution_aborted();
+ BOOST_TEST_IMPL_THROW( execution_aborted() );
}
return true;
@@ -377,7 +365,51 @@ check_impl( predicate_result const& pr, lazy_ostream const& check_descr,
//____________________________________________________________________________//
-predicate_result
+assertion_result
+format_assertion_result( const_string expr_val, const_string details )
+{
+ assertion_result res(false);
+
+ bool starts_new_line = first_char( expr_val ) == '\n';
+
+ if( !starts_new_line && !expr_val.is_empty() )
+ res.message().stream() << " [" << expr_val << "]";
+
+ if( !details.is_empty() ) {
+ if( first_char(details) != '[' )
+ res.message().stream() << ". ";
+ else
+ res.message().stream() << " ";
+
+ res.message().stream() << details;
+ }
+
+ if( starts_new_line )
+ res.message().stream() << "." << expr_val;
+
+ return res;
+}
+
+//____________________________________________________________________________//
+
+BOOST_TEST_DECL std::string
+prod_report_format( assertion_result const& ar, unit_test::lazy_ostream const& assertion_descr, check_type ct, std::size_t num_args, ... )
+{
+ std::ostringstream msg_buff;
+
+ va_list args;
+ va_start( args, num_args );
+
+ format_report( msg_buff, ar, assertion_descr, CHECK, ct, num_args, args, "assertion ", " failed" );
+
+ va_end( args );
+
+ return msg_buff.str();
+}
+
+//____________________________________________________________________________//
+
+assertion_result
equal_impl( char const* left, char const* right )
{
return (left && right) ? std::strcmp( left, right ) == 0 : (left == right);
@@ -387,7 +419,7 @@ equal_impl( char const* left, char const* right )
#if !defined( BOOST_NO_CWCHAR )
-predicate_result
+assertion_result
equal_impl( wchar_t const* left, wchar_t const* right )
{
return (left && right) ? std::wcscmp( left, right ) == 0 : (left == right);
@@ -406,6 +438,31 @@ is_defined_impl( const_string symbol_name, const_string symbol_value )
//____________________________________________________________________________//
+// ************************************************************************** //
+// ************** context_frame ************** //
+// ************************************************************************** //
+
+context_frame::context_frame( ::boost::unit_test::lazy_ostream const& context_descr )
+: m_frame_id( unit_test::framework::add_context( context_descr, true ) )
+{
+}
+
+//____________________________________________________________________________//
+
+context_frame::~context_frame()
+{
+ unit_test::framework::clear_context( m_frame_id );
+}
+
+//____________________________________________________________________________//
+
+context_frame::operator bool()
+{
+ return true;
+}
+
+//____________________________________________________________________________//
+
} // namespace tt_detail
// ************************************************************************** //
@@ -429,7 +486,7 @@ struct output_test_stream::Impl
return res;
}
- void check_and_fill( predicate_result& res )
+ void check_and_fill( assertion_result& res )
{
if( !res.p_predicate_value )
res.message() << "Output content: \"" << m_synced_string << '\"';
@@ -448,9 +505,8 @@ output_test_stream::output_test_stream( const_string pattern_file_name, bool mat
m_pimpl->m_pattern.open( pattern_file_name.begin(), m );
- BOOST_WARN_MESSAGE( m_pimpl->m_pattern.is_open(),
- "Can't open pattern file " << pattern_file_name
- << " for " << (match_or_save ? "reading" : "writing") );
+ if( !m_pimpl->m_pattern.is_open() )
+ BOOST_TEST_MESSAGE( "Can't open pattern file " << pattern_file_name << " for " << (match_or_save ? "reading" : "writing") );
}
m_pimpl->m_match_or_save = match_or_save;
@@ -466,12 +522,12 @@ output_test_stream::~output_test_stream()
//____________________________________________________________________________//
-predicate_result
+assertion_result
output_test_stream::is_empty( bool flush_stream )
{
sync();
- result_type res( m_pimpl->m_synced_string.empty() );
+ assertion_result res( m_pimpl->m_synced_string.empty() );
m_pimpl->check_and_fill( res );
@@ -483,12 +539,12 @@ output_test_stream::is_empty( bool flush_stream )
//____________________________________________________________________________//
-predicate_result
+assertion_result
output_test_stream::check_length( std::size_t length_, bool flush_stream )
{
sync();
- result_type res( m_pimpl->m_synced_string.length() == length_ );
+ assertion_result res( m_pimpl->m_synced_string.length() == length_ );
m_pimpl->check_and_fill( res );
@@ -500,12 +556,12 @@ output_test_stream::check_length( std::size_t length_, bool flush_stream )
//____________________________________________________________________________//
-predicate_result
+assertion_result
output_test_stream::is_equal( const_string arg, bool flush_stream )
{
sync();
- result_type res( const_string( m_pimpl->m_synced_string ) == arg );
+ assertion_result res( const_string( m_pimpl->m_synced_string ) == arg );
m_pimpl->check_and_fill( res );
@@ -517,12 +573,12 @@ output_test_stream::is_equal( const_string arg, bool flush_stream )
//____________________________________________________________________________//
-predicate_result
+assertion_result
output_test_stream::match_pattern( bool flush_stream )
{
sync();
- result_type result( true );
+ assertion_result result( true );
if( !m_pimpl->m_pattern.is_open() ) {
result = false;
@@ -548,18 +604,18 @@ output_test_stream::match_pattern( bool flush_stream )
std::string::size_type counter = suffix_size;
while( --counter ) {
- char c = m_pimpl->get_char();
+ char c2 = m_pimpl->get_char();
if( m_pimpl->m_pattern.fail() || m_pimpl->m_pattern.eof() )
break;
- result.message() << c;
+ result.message() << c2;
}
result.message() << "...";
// skip rest of the bytes. May help for further matching
- m_pimpl->m_pattern.ignore(
+ m_pimpl->m_pattern.ignore(
static_cast<std::streamsize>( m_pimpl->m_synced_string.length() - i - suffix_size) );
break;
}
@@ -618,11 +674,8 @@ output_test_stream::sync()
//____________________________________________________________________________//
} // namespace test_tools
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_TEST_TOOLS_IPP_012205GER
diff --git a/boost/test/impl/test_tree.ipp b/boost/test/impl/test_tree.ipp
new file mode 100644
index 0000000000..712cb9ee42
--- /dev/null
+++ b/boost/test/impl/test_tree.ipp
@@ -0,0 +1,459 @@
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Provides core implementation for Unit Test Framework.
+/// Extensions can be provided in separate files
+// ***************************************************************************
+
+#ifndef BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
+#define BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
+
+// Boost.Test
+#include <boost/detail/workaround.hpp>
+
+#include <boost/test/framework.hpp>
+#include <boost/test/results_collector.hpp>
+
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/visitor.hpp>
+#include <boost/test/tree/traverse.hpp>
+#include <boost/test/tree/auto_registration.hpp>
+#include <boost/test/tree/global_fixture.hpp>
+
+#include <boost/test/utils/foreach.hpp>
+#include <boost/test/utils/basic_cstring/io.hpp>
+
+#include <boost/test/unit_test_parameters.hpp>
+
+// Boost
+#include <boost/timer.hpp>
+
+// STL
+#include <algorithm>
+#include <vector>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) && BOOST_WORKAROUND(_STLPORT_VERSION, <= 0x450)
+ using std::rand; // rand is in std and random_shuffle is in _STL
+#endif
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** test_unit ************** //
+// ************************************************************************** //
+
+test_unit::test_unit( const_string name, const_string file_name, std::size_t line_num, test_unit_type t )
+: p_type( t )
+, p_type_name( t == TUT_CASE ? "case" : "suite" )
+, p_file_name( file_name )
+, p_line_num( line_num )
+, p_id( INV_TEST_UNIT_ID )
+, p_parent_id( INV_TEST_UNIT_ID )
+, p_name( std::string( name.begin(), name.size() ) )
+, p_timeout( 0 )
+, p_expected_failures( 0 )
+, p_default_status( RS_INHERIT )
+, p_run_status( RS_INVALID )
+, p_sibling_rank(0)
+{
+}
+
+//____________________________________________________________________________//
+
+test_unit::test_unit( const_string module_name )
+: p_type( TUT_SUITE )
+, p_type_name( "module" )
+, p_line_num( 0 )
+, p_id( INV_TEST_UNIT_ID )
+, p_parent_id( INV_TEST_UNIT_ID )
+, p_name( std::string( module_name.begin(), module_name.size() ) )
+, p_timeout( 0 )
+, p_expected_failures( 0 )
+, p_default_status( RS_INHERIT )
+, p_run_status( RS_INVALID )
+, p_sibling_rank(0)
+{
+}
+
+//____________________________________________________________________________//
+
+test_unit::~test_unit()
+{
+ framework::deregister_test_unit( this );
+}
+
+//____________________________________________________________________________//
+
+void
+test_unit::depends_on( test_unit* tu )
+{
+ BOOST_TEST_SETUP_ASSERT( p_id != framework::master_test_suite().p_id,
+ "Can't add dependency to the master test suite" );
+
+ p_dependencies.value.push_back( tu->p_id );
+}
+
+//____________________________________________________________________________//
+
+void
+test_unit::add_precondition( precondition_t const& pc )
+{
+ p_preconditions.value.push_back( pc );
+}
+
+//____________________________________________________________________________//
+
+test_tools::assertion_result
+test_unit::check_preconditions() const
+{
+ BOOST_TEST_FOREACH( test_unit_id, dep_id, p_dependencies.get() ) {
+ test_unit const& dep = framework::get( dep_id, TUT_ANY );
+
+ if( !dep.is_enabled() ) {
+ test_tools::assertion_result res(false);
+ res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" is disabled";
+ return res;
+ }
+
+ test_results const& test_rslt = unit_test::results_collector.results( dep_id );
+ if( !test_rslt.passed() ) {
+ test_tools::assertion_result res(false);
+ res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" has failed";
+ return res;
+ }
+
+ if( test_rslt.p_test_cases_skipped > 0 ) {
+ test_tools::assertion_result res(false);
+ res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" has skipped test cases";
+ return res;
+ }
+ }
+
+ BOOST_TEST_FOREACH( precondition_t, precondition, p_preconditions.get() ) {
+ test_tools::assertion_result res = precondition( p_id );
+ if( !res )
+ return res;
+ }
+
+ return true;
+}
+
+//____________________________________________________________________________//
+
+void
+test_unit::increase_exp_fail( counter_t num )
+{
+ p_expected_failures.value += num;
+
+ if( p_parent_id != INV_TEST_UNIT_ID )
+ framework::get<test_suite>( p_parent_id ).increase_exp_fail( num );
+}
+
+//____________________________________________________________________________//
+
+std::string
+test_unit::full_name() const
+{
+ if( p_parent_id == INV_TEST_UNIT_ID || p_parent_id == framework::master_test_suite().p_id )
+ return p_name;
+
+ std::string res = framework::get<test_suite>( p_parent_id ).full_name();
+ res.append("/");
+
+ res.append( p_name );
+
+ return res;
+}
+
+//____________________________________________________________________________//
+
+void
+test_unit::add_label( const_string l )
+{
+ p_labels.value.push_back( std::string() + l );
+}
+
+//____________________________________________________________________________//
+
+bool
+test_unit::has_label( const_string l ) const
+{
+ return std::find( p_labels->begin(), p_labels->end(), l ) != p_labels->end();
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** test_case ************** //
+// ************************************************************************** //
+
+test_case::test_case( const_string name, boost::function<void ()> const& test_func )
+: test_unit( name, "", 0, static_cast<test_unit_type>(type) )
+, p_test_func( test_func )
+{
+ framework::register_test_unit( this );
+}
+
+//____________________________________________________________________________//
+
+test_case::test_case( const_string name, const_string file_name, std::size_t line_num, boost::function<void ()> const& test_func )
+: test_unit( name, file_name, line_num, static_cast<test_unit_type>(type) )
+, p_test_func( test_func )
+{
+ framework::register_test_unit( this );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** test_suite ************** //
+// ************************************************************************** //
+
+//____________________________________________________________________________//
+
+test_suite::test_suite( const_string name, const_string file_name, std::size_t line_num )
+: test_unit( name, file_name, line_num, static_cast<test_unit_type>(type) )
+{
+ framework::register_test_unit( this );
+}
+
+//____________________________________________________________________________//
+
+test_suite::test_suite( const_string module_name )
+: test_unit( module_name )
+{
+ framework::register_test_unit( this );
+}
+
+//____________________________________________________________________________//
+
+void
+test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout )
+{
+ tu->p_timeout.value = timeout;
+
+ m_children.push_back( tu->p_id );
+ tu->p_parent_id.value = p_id;
+
+ if( tu->p_expected_failures != 0 )
+ increase_exp_fail( tu->p_expected_failures );
+
+ if( expected_failures )
+ tu->increase_exp_fail( expected_failures );
+}
+
+//____________________________________________________________________________//
+
+void
+test_suite::add( test_unit_generator const& gen, unsigned timeout )
+{
+ test_unit* tu;
+ while((tu = gen.next()) != 0)
+ add( tu, 0, timeout );
+}
+
+//____________________________________________________________________________//
+
+void
+test_suite::add( test_unit_generator const& gen, decorator::collector& decorators )
+{
+ test_unit* tu;
+ while((tu = gen.next()) != 0) {
+ decorators.store_in( *tu );
+ add( tu, 0 );
+ }
+
+ decorators.reset();
+}
+
+//____________________________________________________________________________//
+
+void
+test_suite::remove( test_unit_id id )
+{
+ test_unit_id_list::iterator it = std::find( m_children.begin(), m_children.end(), id );
+
+ if( it != m_children.end() )
+ m_children.erase( it );
+}
+
+//____________________________________________________________________________//
+
+test_unit_id
+test_suite::get( const_string tu_name ) const
+{
+ BOOST_TEST_FOREACH( test_unit_id, id, m_children ) {
+ if( tu_name == framework::get( id, ut_detail::test_id_2_unit_type( id ) ).p_name.get() )
+ return id;
+ }
+
+ return INV_TEST_UNIT_ID;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** master_test_suite ************** //
+// ************************************************************************** //
+
+master_test_suite_t::master_test_suite_t()
+: test_suite( "Master Test Suite" )
+, argc( 0 )
+, argv( 0 )
+{
+ p_default_status.value = RS_ENABLED;
+}
+
+// ************************************************************************** //
+// ************** traverse_test_tree ************** //
+// ************************************************************************** //
+
+void
+traverse_test_tree( test_case const& tc, test_tree_visitor& V, bool ignore_status )
+{
+ if( tc.is_enabled() || ignore_status )
+ V.visit( tc );
+}
+
+//____________________________________________________________________________//
+
+void
+traverse_test_tree( test_suite const& suite, test_tree_visitor& V, bool ignore_status )
+{
+ // skip disabled test suite unless we asked to ignore this condition
+ if( !ignore_status && !suite.is_enabled() )
+ return;
+
+ // Invoke test_suite_start callback
+ if( !V.test_suite_start( suite ) )
+ return;
+
+ // Recurse into children
+ std::size_t total_children = suite.m_children.size();
+ for( std::size_t i=0; i < total_children; ) {
+ // this statement can remove the test unit from this list
+ traverse_test_tree( suite.m_children[i], V, ignore_status );
+ if( total_children > suite.m_children.size() )
+ total_children = suite.m_children.size();
+ else
+ ++i;
+ }
+
+ // Invoke test_suite_finish callback
+ V.test_suite_finish( suite );
+}
+
+//____________________________________________________________________________//
+
+void
+traverse_test_tree( test_unit_id id, test_tree_visitor& V, bool ignore_status )
+{
+ if( ut_detail::test_id_2_unit_type( id ) == TUT_CASE )
+ traverse_test_tree( framework::get<test_case>( id ), V, ignore_status );
+ else
+ traverse_test_tree( framework::get<test_suite>( id ), V, ignore_status );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** object generators ************** //
+// ************************************************************************** //
+
+namespace ut_detail {
+
+std::string
+normalize_test_case_name( const_string name )
+{
+ std::string norm_name( name.begin(), name.size() );
+
+ if( name[0] == '&' )
+ norm_name = norm_name.substr( 1 );
+
+ std::replace(norm_name.begin(), norm_name.end(), ' ', '_');
+
+ return norm_name;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** auto_test_unit_registrar ************** //
+// ************************************************************************** //
+
+auto_test_unit_registrar::auto_test_unit_registrar( test_case* tc, decorator::collector& decorators, counter_t exp_fail )
+{
+ framework::current_auto_test_suite().add( tc, exp_fail );
+
+ decorators.store_in( *tc );
+ decorators.reset();
+}
+
+//____________________________________________________________________________//
+
+auto_test_unit_registrar::auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector& decorators )
+{
+ test_unit_id id = framework::current_auto_test_suite().get( ts_name );
+
+ test_suite* ts;
+
+ if( id != INV_TEST_UNIT_ID ) {
+ ts = &framework::get<test_suite>( id );
+ BOOST_ASSERT( ts->p_parent_id == framework::current_auto_test_suite().p_id );
+ }
+ else {
+ ts = new test_suite( ts_name, ts_file, ts_line );
+ framework::current_auto_test_suite().add( ts );
+ }
+
+ decorators.store_in( *ts );
+ decorators.reset();
+
+ framework::current_auto_test_suite( ts );
+}
+
+//____________________________________________________________________________//
+
+auto_test_unit_registrar::auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector& decorators )
+{
+ framework::current_auto_test_suite().add( tc_gen, decorators );
+}
+
+//____________________________________________________________________________//
+
+auto_test_unit_registrar::auto_test_unit_registrar( int )
+{
+ framework::current_auto_test_suite( 0, false );
+}
+
+//____________________________________________________________________________//
+
+} // namespace ut_detail
+
+// ************************************************************************** //
+// ************** global_fixture ************** //
+// ************************************************************************** //
+
+global_fixture::global_fixture()
+{
+ framework::register_observer( *this );
+}
+
+//____________________________________________________________________________//
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
diff --git a/boost/test/impl/unit_test_log.ipp b/boost/test/impl/unit_test_log.ipp
index 7cb4f4b4a8..f202f5027d 100644
--- a/boost/test/impl/unit_test_log.ipp
+++ b/boost/test/impl/unit_test_log.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -18,10 +18,10 @@
// Boost.Test
#include <boost/test/unit_test_log.hpp>
#include <boost/test/unit_test_log_formatter.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
#include <boost/test/execution_monitor.hpp>
+#include <boost/test/framework.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
+#include <boost/test/unit_test_parameters.hpp>
#include <boost/test/utils/basic_cstring/compare.hpp>
@@ -38,7 +38,6 @@ typedef ::boost::io::ios_base_all_saver io_saver_type;
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -57,7 +56,7 @@ entry_value_collector::operator<<( lazy_ostream const& v ) const
//____________________________________________________________________________//
-entry_value_collector const&
+entry_value_collector const&
entry_value_collector::operator<<( const_string v ) const
{
unit_test_log << v;
@@ -194,7 +193,7 @@ unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed )
//____________________________________________________________________________//
void
-unit_test_log_t::test_unit_skipped( test_unit const& tu )
+unit_test_log_t::test_unit_skipped( test_unit const& tu, const_string reason )
{
if( s_log_impl().m_threshold_level > log_test_units )
return;
@@ -202,23 +201,7 @@ unit_test_log_t::test_unit_skipped( test_unit const& tu )
if( s_log_impl().m_entry_in_progress )
*this << log::end();
- s_log_impl().m_log_formatter->test_unit_skipped( s_log_impl().stream(), tu );
-}
-
-//____________________________________________________________________________//
-
-void
-unit_test_log_t::test_unit_aborted( test_unit const& )
-{
- // do nothing
-}
-
-//____________________________________________________________________________//
-
-void
-unit_test_log_t::assertion_result( bool )
-{
- // do nothing
+ s_log_impl().m_log_formatter->test_unit_skipped( s_log_impl().stream(), tu, reason );
}
//____________________________________________________________________________//
@@ -235,8 +218,14 @@ unit_test_log_t::exception_caught( execution_exception const& ex )
if( s_log_impl().m_entry_in_progress )
*this << log::end();
- s_log_impl().m_log_formatter->log_exception( s_log_impl().stream(), s_log_impl().m_checkpoint_data, ex );
+ s_log_impl().m_log_formatter->log_exception_start( s_log_impl().stream(), s_log_impl().m_checkpoint_data, ex );
+
+ log_entry_context( l );
+
+ s_log_impl().m_log_formatter->log_exception_finish( s_log_impl().stream() );
}
+
+ clear_entry_context();
}
//____________________________________________________________________________//
@@ -254,7 +243,7 @@ set_unix_slash( char in )
{
return in == '\\' ? '/' : in;
}
-
+
unit_test_log_t&
unit_test_log_t::operator<<( log::begin const& b )
{
@@ -282,10 +271,15 @@ unit_test_log_t::operator<<( log::begin const& b )
unit_test_log_t&
unit_test_log_t::operator<<( log::end const& )
{
- if( s_log_impl().m_entry_in_progress )
+ if( s_log_impl().m_entry_in_progress ) {
+ log_entry_context( s_log_impl().m_entry_data.m_level );
+
s_log_impl().m_log_formatter->log_entry_finish( s_log_impl().stream() );
- s_log_impl().m_entry_in_progress = false;
+ s_log_impl().m_entry_in_progress = false;
+ }
+
+ clear_entry_context();
return *this;
}
@@ -315,7 +309,7 @@ unit_test_log_t::operator()( log_level l )
bool
unit_test_log_t::log_entry_start()
{
- if( s_log_impl().m_entry_in_progress )
+ if( s_log_impl().m_entry_in_progress )
return true;
switch( s_log_impl().m_entry_data.m_level ) {
@@ -377,6 +371,33 @@ unit_test_log_t::operator<<( lazy_ostream const& value )
//____________________________________________________________________________//
void
+unit_test_log_t::log_entry_context( log_level l )
+{
+ framework::context_generator const& context = framework::get_context();
+ if( context.is_empty() )
+ return;
+
+ const_string frame;
+
+ s_log_impl().m_log_formatter->entry_context_start( s_log_impl().stream(), l );
+
+ while( !(frame=context.next()).is_empty() )
+ s_log_impl().m_log_formatter->log_entry_context( s_log_impl().stream(), frame );
+
+ s_log_impl().m_log_formatter->entry_context_finish( s_log_impl().stream() );
+}
+
+//____________________________________________________________________________//
+
+void
+unit_test_log_t::clear_entry_context()
+{
+ framework::clear_context();
+}
+
+//____________________________________________________________________________//
+
+void
unit_test_log_t::set_stream( std::ostream& str )
{
if( s_log_impl().m_entry_in_progress )
@@ -405,10 +426,15 @@ unit_test_log_t::set_format( output_format log_format )
if( s_log_impl().m_entry_in_progress )
return;
- if( log_format == CLF )
+ switch( log_format ) {
+ default:
+ case OF_CLF:
set_formatter( new output::compiler_log_formatter );
- else
+ break;
+ case OF_XML:
set_formatter( new output::xml_log_formatter );
+ break;
+ }
}
//____________________________________________________________________________//
@@ -434,11 +460,8 @@ unit_test_log_formatter::log_entry_value( std::ostream& ostr, lazy_ostream const
//____________________________________________________________________________//
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER
diff --git a/boost/test/impl/unit_test_main.ipp b/boost/test/impl/unit_test_main.ipp
index adedf35180..327e14de30 100644
--- a/boost/test/impl/unit_test_main.ipp
+++ b/boost/test/impl/unit_test_main.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -18,154 +18,164 @@
// Boost.Test
#include <boost/test/framework.hpp>
#include <boost/test/results_collector.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
#include <boost/test/results_reporter.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
+#include <boost/test/tree/visitor.hpp>
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/traverse.hpp>
-#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
+#include <boost/test/unit_test_parameters.hpp>
+
+#include <boost/test/utils/foreach.hpp>
+#include <boost/test/utils/basic_cstring/io.hpp>
// Boost
#include <boost/cstdlib.hpp>
-#include <boost/bind.hpp>
// STL
+#include <cstdio>
#include <stdexcept>
#include <iostream>
+#include <iomanip>
+#include <set>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
+namespace ut_detail {
+
// ************************************************************************** //
-// ************** test_case_filter ************** //
+// ************** hrf_content_reporter ************** //
// ************************************************************************** //
-class test_case_filter : public test_tree_visitor {
-public:
- struct single_filter {
- single_filter( const_string in )
- {
- if( in == "*" )
- m_kind = SFK_ALL;
- else if( first_char( in ) == '*' && last_char( in ) == '*' ) {
- m_kind = SFK_SUBSTR;
- m_value = in.substr( 1, in.size()-1 );
- }
- else if( first_char( in ) == '*' ) {
- m_kind = SFK_TRAILING;
- m_value = in.substr( 1 );
- }
- else if( last_char( in ) == '*' ) {
- m_kind = SFK_LEADING;
- m_value = in.substr( 0, in.size()-1 );
- }
- else {
- m_kind = SFK_MATCH;
- m_value = in;
- }
- };
+struct hrf_content_reporter : test_tree_visitor {
+ explicit hrf_content_reporter( std::ostream& os ) : m_os( os ), m_indent( -4 ) {} // skip master test suite
- bool pass( test_unit const& tu ) const
- {
- const_string name( tu.p_name );
-
- switch( m_kind ) {
- default:
- case SFK_ALL:
- return true;
+private:
+ void report_test_unit( test_unit const& tu )
+ {
+ m_os << std::setw( m_indent ) << "" << tu.p_name;
+ m_os << (tu.p_default_status == test_unit::RS_ENABLED ? "*" : " ");
+ //m_os << '[' << tu.p_sibling_rank << ']';
+ if( !tu.p_description->empty() )
+ m_os << ": " << tu.p_description;
- case SFK_LEADING:
- return name.substr( 0, m_value.size() ) == m_value;
+ m_os << "\n";
+ }
+ virtual void visit( test_case const& tc ) { report_test_unit( tc ); }
+ virtual bool test_suite_start( test_suite const& ts )
+ {
+ if( m_indent >= 0 )
+ report_test_unit( ts );
+ m_indent += 4;
+ return true;
+ }
+ virtual void test_suite_finish( test_suite const& )
+ {
+ m_indent -= 4;
+ }
- case SFK_TRAILING:
- return name.size() >= m_value.size() && name.substr( name.size() - m_value.size() ) == m_value;
+ // Data members
+ std::ostream& m_os;
+ int m_indent;
+};
- case SFK_SUBSTR:
- return name.find( m_value ) != const_string::npos;
+// ************************************************************************** //
+// ************** dot_content_reporter ************** //
+// ************************************************************************** //
- case SFK_MATCH:
- return m_value == tu.p_name.get();
- }
- }
- enum kind { SFK_ALL, SFK_LEADING, SFK_TRAILING, SFK_SUBSTR, SFK_MATCH };
-
- kind m_kind;
- const_string m_value;
- };
- // Constructor
-#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_run )
- : m_depth( 0 )
+struct dot_content_reporter : test_tree_visitor {
+ explicit dot_content_reporter( std::ostream& os ) : m_os( os ) {}
+
+private:
+ void report_test_unit( test_unit const& tu )
{
- string_token_iterator tit( tc_to_run, (dropped_delimeters = "/", kept_delimeters = dt_none) );
+ bool master_ts = tu.p_parent_id == INV_TEST_UNIT_ID;
- while( tit != string_token_iterator() ) {
- m_filters.push_back(
- std::vector<single_filter>( string_token_iterator( *tit, (dropped_delimeters = ",", kept_delimeters = dt_none) ),
- string_token_iterator() ) );
+ m_os << "tu" << tu.p_id;
- ++tit;
- }
- }
-#endif
-
- void filter_unit( test_unit const& tu )
- {
- if( (++m_depth - 1) > m_filters.size() ) {
- tu.p_enabled.value = true;
- return;
- }
+ m_os << (master_ts ? "[shape=ellipse,peripheries=2" : "[shape=Mrecord" );
- if( m_depth == 1 )
- return;
+ m_os << ",fontname=Helvetica";
- std::vector<single_filter> const& filters = m_filters[m_depth-2];
+ m_os << (tu.is_enabled() ? ",color=green" : ",color=yellow");
- tu.p_enabled.value =
- std::find_if( filters.begin(), filters.end(), bind( &single_filter::pass, _1, boost::ref(tu) ) ) != filters.end();
- }
+ if( master_ts )
+ m_os << ",label=\"" << tu.p_name << "\"];\n";
+ else {
+ m_os << ",label=\"" << tu.p_name << "|" << tu.p_file_name << "(" << tu.p_line_num << ")";
+ if( tu.p_timeout > 0 )
+ m_os << "|timeout=" << tu.p_timeout;
+ if( tu.p_expected_failures != 0 )
+ m_os << "|expected failures=" << tu.p_expected_failures;
+ if( !tu.p_labels->empty() ) {
+ m_os << "|labels:";
- // test tree visitor interface
- virtual void visit( test_case const& tc )
- {
- if( m_depth < m_filters.size() ) {
- tc.p_enabled.value = false;
- return;
+ BOOST_TEST_FOREACH( std::string const&, l, tu.p_labels.get() )
+ m_os << " @" << l;
+ }
+ m_os << "\"];\n";
}
- filter_unit( tc );
+ if( !master_ts )
+ m_os << "tu" << tu.p_parent_id << " -> " << "tu" << tu.p_id << ";\n";
- --m_depth;
- }
+ BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) {
+ test_unit const& dep = framework::get( dep_id, TUT_ANY );
- virtual bool test_suite_start( test_suite const& ts )
+ m_os << "tu" << tu.p_id << " -> " << "tu" << dep.p_id << "[color=red,style=dotted,constraint=false];\n";
+ }
+
+ }
+ virtual void visit( test_case const& tc )
{
- filter_unit( ts );
+ report_test_unit( tc );
+ }
+ virtual bool test_suite_start( test_suite const& ts )
+ {
+ if( ts.p_parent_id == INV_TEST_UNIT_ID )
+ m_os << "digraph G {rankdir=LR;\n";
- if( !ts.p_enabled )
- --m_depth;
+ report_test_unit( ts );
- return ts.p_enabled;
+ m_os << "{\n";
+
+ return true;
+ }
+ virtual void test_suite_finish( test_suite const& ts )
+ {
+ m_os << "}\n";
+ if( ts.p_parent_id == INV_TEST_UNIT_ID )
+ m_os << "}\n";
}
- virtual void test_suite_finish( test_suite const& ) { --m_depth; }
+ std::ostream& m_os;
+};
+
+// ************************************************************************** //
+// ************** labels_collector ************** //
+// ************************************************************************** //
+
+struct labels_collector : test_tree_visitor {
+ std::set<std::string> const& labels() const { return m_labels; }
private:
+ virtual bool visit( test_unit const& tu )
+ {
+ m_labels.insert( tu.p_labels->begin(), tu.p_labels->end() );
+ return true;
+ }
+
// Data members
- std::vector<std::vector<single_filter> > m_filters;
- unsigned m_depth;
+ std::set<std::string> m_labels;
};
+} // namespace ut_detail
+
// ************************************************************************** //
// ************** unit_test_main ************** //
// ************************************************************************** //
@@ -173,45 +183,81 @@ private:
int BOOST_TEST_DECL
unit_test_main( init_unit_test_func init_func, int argc, char* argv[] )
{
- try {
+ int result_code = 0;
+
+ BOOST_TEST_IMPL_TRY {
framework::init( init_func, argc, argv );
- if( !runtime_config::test_to_run().is_empty() ) {
- test_case_filter filter( runtime_config::test_to_run() );
+ if( runtime_config::wait_for_debugger() ) {
+ results_reporter::get_stream() << "Press any key to continue..." << std::endl;
+
+ std::getchar();
+ results_reporter::get_stream() << "Continuing..." << std::endl;
+ }
+
+ framework::finalize_setup_phase();
+
+ if( runtime_config::list_content() != unit_test::OF_INVALID ) {
+ if( runtime_config::list_content() == unit_test::OF_DOT ) {
+ ut_detail::dot_content_reporter reporter( results_reporter::get_stream() );
+
+ traverse_test_tree( framework::master_test_suite().p_id, reporter, true );
+ }
+ else {
+ ut_detail::hrf_content_reporter reporter( results_reporter::get_stream() );
+
+ traverse_test_tree( framework::master_test_suite().p_id, reporter, true );
+ }
- traverse_test_tree( framework::master_test_suite().p_id, filter );
+ return boost::exit_success;
+ }
+
+ if( runtime_config::list_labels() ) {
+ ut_detail::labels_collector collector;
+
+ traverse_test_tree( framework::master_test_suite().p_id, collector, true );
+
+ results_reporter::get_stream() << "Available labels:\n ";
+ std::copy( collector.labels().begin(), collector.labels().end(),
+ std::ostream_iterator<std::string>( results_reporter::get_stream(), "\n " ) );
+ results_reporter::get_stream() << "\n";
+
+ return boost::exit_success;
}
framework::run();
results_reporter::make_report();
- return runtime_config::no_result_code()
- ? boost::exit_success
- : results_collector.results( framework::master_test_suite().p_id ).result_code();
+ result_code = runtime_config::no_result_code()
+ ? boost::exit_success
+ : results_collector.results( framework::master_test_suite().p_id ).result_code();
}
- catch( framework::nothing_to_test const& ) {
- return boost::exit_success;
+ BOOST_TEST_IMPL_CATCH0( framework::nothing_to_test ) {
+ result_code = boost::exit_success;
}
- catch( framework::internal_error const& ex ) {
+ BOOST_TEST_IMPL_CATCH( framework::internal_error, ex ) {
results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl;
-
- return boost::exit_exception_failure;
+
+ result_code = boost::exit_exception_failure;
}
- catch( framework::setup_error const& ex ) {
+ BOOST_TEST_IMPL_CATCH( framework::setup_error, ex ) {
results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl;
-
- return boost::exit_exception_failure;
+
+ result_code = boost::exit_exception_failure;
}
- catch( ... ) {
+ BOOST_TEST_IMPL_CATCHALL() {
results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl;
-
- return boost::exit_exception_failure;
+
+ result_code = boost::exit_exception_failure;
}
+
+ framework::shutdown();
+
+ return result_code;
}
} // namespace unit_test
-
} // namespace boost
#if !defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN)
diff --git a/boost/test/impl/unit_test_monitor.ipp b/boost/test/impl/unit_test_monitor.ipp
index dc912f544e..8c931f203f 100644
--- a/boost/test/impl/unit_test_monitor.ipp
+++ b/boost/test/impl/unit_test_monitor.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -18,57 +18,34 @@
// Boost.Test
#include <boost/test/unit_test_monitor.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
-#include <boost/test/test_tools.hpp>
#include <boost/test/framework.hpp>
-
-#include <boost/test/detail/unit_test_parameters.hpp>
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/unit_test_parameters.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-namespace {
-
-template<typename F>
-struct zero_return_wrapper_t {
- explicit zero_return_wrapper_t( F const& f ) : m_f( f ) {}
-
- int operator()() { m_f(); return 0; }
-
- F const& m_f;
-};
-
-template<typename F>
-zero_return_wrapper_t<F>
-zero_return_wrapper( F const& f )
-{
- return zero_return_wrapper_t<F>( f );
-}
-
-}
-
// ************************************************************************** //
// ************** unit_test_monitor ************** //
// ************************************************************************** //
unit_test_monitor_t::error_level
-unit_test_monitor_t::execute_and_translate( test_case const& tc )
+unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func, unsigned timeout )
{
- try {
+ BOOST_TEST_IMPL_TRY {
p_catch_system_errors.value = runtime_config::catch_sys_errors();
- p_timeout.value = tc.p_timeout.get();
+ p_timeout.value = timeout;
p_auto_start_dbg.value = runtime_config::auto_start_dbg();
p_use_alt_stack.value = runtime_config::use_alt_stack();
p_detect_fp_exceptions.value = runtime_config::detect_fp_exceptions();
- execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ) );
+ vexecute( func );
}
- catch( execution_exception const& ex ) {
+ BOOST_TEST_IMPL_CATCH( execution_exception, ex ) {
framework::exception_caught( ex );
framework::test_unit_aborted( framework::current_test_case() );
@@ -91,11 +68,8 @@ unit_test_monitor_t::execute_and_translate( test_case const& tc )
//____________________________________________________________________________//
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER
diff --git a/boost/test/impl/unit_test_parameters.ipp b/boost/test/impl/unit_test_parameters.ipp
index f220792b34..2ffa495e67 100644
--- a/boost/test/impl/unit_test_parameters.ipp
+++ b/boost/test/impl/unit_test_parameters.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -19,7 +19,7 @@
#define BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER
// Boost.Test
-#include <boost/test/detail/unit_test_parameters.hpp>
+#include <boost/test/unit_test_parameters.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <boost/test/utils/basic_cstring/compare.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>
@@ -27,6 +27,8 @@
#include <boost/test/debug.hpp>
#include <boost/test/framework.hpp>
+#include <boost/test/detail/throw_exception.hpp>
+
// Boost.Runtime.Param
#include <boost/test/utils/runtime/cla/dual_name_parameter.hpp>
#include <boost/test/utils/runtime/cla/parser.hpp>
@@ -34,14 +36,12 @@
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>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -63,7 +63,6 @@ namespace std { using ::getenv; using ::strncmp; using ::strcmp; }
# endif
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -127,18 +126,19 @@ 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,
+ "HRF", unit_test::OF_CLF,
+ "CLF", unit_test::OF_CLF,
+ "XML", unit_test::OF_XML,
+ "DOT", unit_test::OF_DOT,
- unit_test::INV_OF
+ unit_test::OF_INVALID
);
std::string val;
in >> val;
of = output_format_name[val];
- BOOST_TEST_SETUP_ASSERT( of != unit_test::INV_OF, "invalid output format " + val );
+ BOOST_TEST_SETUP_ASSERT( of != unit_test::OF_INVALID, "invalid output format " + val );
return in;
}
@@ -158,8 +158,11 @@ 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 COLOR_OUTPUT = "color_output";
std::string DETECT_FP_EXCEPT = "detect_fp_exceptions";
std::string DETECT_MEM_LEAKS = "detect_memory_leaks";
+std::string LIST_CONTENT = "list_content";
+std::string LIST_LABELS = "list_labels";
std::string LOG_FORMAT = "log_format";
std::string LOG_LEVEL = "log_level";
std::string LOG_SINK = "log_sink";
@@ -173,39 +176,55 @@ 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";
+std::string WAIT_FOR_DEBUGGER = "wait_for_debugger";
+
+static const_string
+parameter_2_env_var( const_string param_name )
+{
+ typedef std::map<const_string,const_string> mtype;
+ static mtype s_mapping;
+
+ if( s_mapping.empty() ) {
+ s_mapping[AUTO_START_DBG] = "BOOST_TEST_AUTO_START_DBG";
+ s_mapping[BREAK_EXEC_PATH] = "BOOST_TEST_BREAK_EXEC_PATH";
+ s_mapping[BUILD_INFO] = "BOOST_TEST_BUILD_INFO";
+ s_mapping[CATCH_SYS_ERRORS] = "BOOST_TEST_CATCH_SYSTEM_ERRORS";
+ s_mapping[COLOR_OUTPUT] = "BOOST_TEST_COLOR_OUTPUT";
+ s_mapping[DETECT_FP_EXCEPT] = "BOOST_TEST_DETECT_FP_EXCEPTIONS";
+ s_mapping[DETECT_MEM_LEAKS] = "BOOST_TEST_DETECT_MEMORY_LEAK";
+ s_mapping[LIST_CONTENT] = "BOOST_TEST_LIST_CONTENT";
+ s_mapping[LIST_CONTENT] = "BOOST_TEST_LIST_LABELS";
+ s_mapping[LOG_FORMAT] = "BOOST_TEST_LOG_FORMAT";
+ s_mapping[LOG_LEVEL] = "BOOST_TEST_LOG_LEVEL";
+ s_mapping[LOG_SINK] = "BOOST_TEST_LOG_SINK";
+ s_mapping[OUTPUT_FORMAT] = "BOOST_TEST_OUTPUT_FORMAT";
+ s_mapping[RANDOM_SEED] = "BOOST_TEST_RANDOM";
+ s_mapping[REPORT_FORMAT] = "BOOST_TEST_REPORT_FORMAT";
+ s_mapping[REPORT_LEVEL] = "BOOST_TEST_REPORT_LEVEL";
+ s_mapping[REPORT_SINK] = "BOOST_TEST_REPORT_SINK";
+ s_mapping[RESULT_CODE] = "BOOST_TEST_RESULT_CODE";
+ s_mapping[TESTS_TO_RUN] = "BOOST_TESTS_TO_RUN";
+ s_mapping[SAVE_TEST_PATTERN] = "BOOST_TEST_SAVE_PATTERN";
+ s_mapping[SHOW_PROGRESS] = "BOOST_TEST_SHOW_PROGRESS";
+ s_mapping[USE_ALT_STACK] = "BOOST_TEST_USE_ALT_STACK";
+ s_mapping[WAIT_FOR_DEBUGGER] = "BOOST_TEST_WAIT_FOR_DEBUGGER";
+ }
-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",
- LOG_SINK , "BOOST_TEST_LOG_SINK",
- OUTPUT_FORMAT , "BOOST_TEST_OUTPUT_FORMAT",
- RANDOM_SEED , "BOOST_TEST_RANDOM",
- REPORT_FORMAT , "BOOST_TEST_REPORT_FORMAT",
- REPORT_LEVEL , "BOOST_TEST_REPORT_LEVEL",
- REPORT_SINK , "BOOST_TEST_REPORT_SINK",
- 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",
-
- ""
-);
+ mtype::const_iterator it = s_mapping.find( param_name );
+
+ return it == s_mapping.end() ? const_string() : it->second;
+}
//____________________________________________________________________________//
// storage for the CLAs
-cla::parser s_cla_parser;
-std::string s_empty;
+cla::parser s_cla_parser;
+std::string s_empty;
+
+output_format s_report_format;
+output_format s_log_format;
-output_format s_report_format;
-output_format s_log_format;
+std::list<std::string> s_test_to_run;
//____________________________________________________________________________//
@@ -229,7 +248,7 @@ retrieve_parameter( const_string parameter_name, cla::parser const& s_cla_parser
boost::optional<T> v;
#ifndef UNDER_CE
- env::get( parameter_2_env_var[parameter_name], v );
+ env::get( parameter_2_env_var(parameter_name), v );
#endif
if( v )
@@ -240,101 +259,127 @@ retrieve_parameter( const_string parameter_name, cla::parser const& s_cla_parser
//____________________________________________________________________________//
-} // local namespace
+void
+disable_use( cla::parameter const&, std::string const& )
+{
+ BOOST_TEST_SETUP_ASSERT( false, "parameter break_exec_path is disabled in this release" );
+}
+
+//____________________________________________________________________________//
+
+} // 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<std::string>( LOG_SINK + "|k" )
- - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
- cla::description = "Specifies log sink:stdout(default),stderr or file name")
- << 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<std::string>( REPORT_SINK + "|e" )
- - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
- cla::description = "Specifies report sink:stderr(default),stdout or file name")
- << 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")
- ;
+ BOOST_TEST_IMPL_TRY {
+ if( s_cla_parser.num_params() != 0 )
+ s_cla_parser.reset();
+ else
+ 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::handler = &disable_use)
+ << 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::dual_name_parameter<bool>( COLOR_OUTPUT + "|x" )
+ - (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<std::string>( DETECT_MEM_LEAKS )
+ - (cla::prefix = "--",cla::separator = "=",cla::guess_name,cla::optional,cla::optional_value,
+ 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<std::string>( LOG_SINK + "|k" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Specifies log sink:stdout(default),stderr or file name")
+ << 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<unsigned>( 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<std::string>( REPORT_SINK + "|e" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,
+ cla::description = "Specifies report sink:stderr(default),stdout or file name")
+ << 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::multiplicable,
+ 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::dual_name_parameter<unit_test::output_format>( LIST_CONTENT + "|j" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,cla::optional_value,
+ cla::description = "Lists the content of test tree - names of all test suites and test cases")
+ << cla::named_parameter<bool>( LIST_LABELS )
+ - (cla::prefix = "--",cla::separator = "= ",cla::guess_name,cla::optional,
+ cla::description = "Lists all available labels")
+ << 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>( WAIT_FOR_DEBUGGER + "|w" )
+ - (cla::prefix = "--|-",cla::separator = "=| ",cla::guess_name,cla::optional,cla::optional_value,
+ cla::description = "Forces test module to wait for button to be pressed before starting test run")
+
+ << 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();
+ BOOST_TEST_IMPL_THROW( framework::nothing_to_test() );
}
- s_report_format = retrieve_parameter( REPORT_FORMAT, s_cla_parser, unit_test::CLF );
- s_log_format = retrieve_parameter( LOG_FORMAT, s_cla_parser, unit_test::CLF );
+ s_report_format = retrieve_parameter( REPORT_FORMAT, s_cla_parser, unit_test::OF_CLF );
+ s_log_format = retrieve_parameter( LOG_FORMAT, s_cla_parser, unit_test::OF_CLF );
- unit_test::output_format of = retrieve_parameter( OUTPUT_FORMAT, s_cla_parser, unit_test::INV_OF );
+ unit_test::output_format of = retrieve_parameter( OUTPUT_FORMAT, s_cla_parser, unit_test::OF_INVALID );
- if( of != unit_test::INV_OF )
+ if( of != unit_test::OF_INVALID )
s_report_format = s_log_format = of;
+
+ s_test_to_run = retrieve_parameter<std::list<std::string> >( TESTS_TO_RUN, s_cla_parser );
}
- catch( rt::logic_error const& ex ) {
+ BOOST_TEST_IMPL_CATCH( rt::logic_error, ex ) {
std::ostringstream err;
-
+
err << "Fail to process runtime parameters: " << ex.msg() << std::endl;
s_cla_parser.usage( err );
- throw framework::setup_error( err.str() );
+ BOOST_TEST_SETUP_ASSERT( false, err.str() );
}
}
@@ -364,11 +409,9 @@ report_level()
//____________________________________________________________________________//
-const_string
+std::list<std::string> const&
test_to_run()
{
- static std::string s_test_to_run = retrieve_parameter( TESTS_TO_RUN, s_cla_parser, s_empty );
-
return s_test_to_run;
}
@@ -408,14 +451,30 @@ show_build_info()
//____________________________________________________________________________//
+output_format
+list_content()
+{
+ return retrieve_parameter( LIST_CONTENT, s_cla_parser, unit_test::OF_INVALID, unit_test::OF_CLF );
+}
+
+//____________________________________________________________________________//
+
+bool
+list_labels()
+{
+ return retrieve_parameter( LIST_LABELS, s_cla_parser, false );
+}
+
+//____________________________________________________________________________//
+
bool
catch_sys_errors()
{
- return retrieve_parameter( CATCH_SYS_ERRORS, s_cla_parser,
+ return retrieve_parameter( CATCH_SYS_ERRORS, s_cla_parser,
#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP
false
#else
- true
+ true
#endif
);
}
@@ -423,9 +482,17 @@ catch_sys_errors()
//____________________________________________________________________________//
bool
+color_output()
+{
+ return retrieve_parameter( COLOR_OUTPUT, s_cla_parser, false );
+}
+
+//____________________________________________________________________________//
+
+bool
auto_start_dbg()
{
- // !! set debugger as an option
+ // !! ?? set debugger as an option
return retrieve_parameter( AUTO_START_DBG, s_cla_parser, false );
;
}
@@ -433,6 +500,14 @@ auto_start_dbg()
//____________________________________________________________________________//
bool
+wait_for_debugger()
+{
+ return retrieve_parameter( WAIT_FOR_DEBUGGER, s_cla_parser, false );
+}
+
+//____________________________________________________________________________//
+
+bool
use_alt_stack()
{
return retrieve_parameter( USE_ALT_STACK, s_cla_parser, true );
@@ -470,13 +545,13 @@ report_sink()
std::string sink_name = retrieve_parameter( REPORT_SINK, s_cla_parser, s_empty );
if( sink_name.empty() || sink_name == "stderr" )
- return &std::cerr;
-
+ return &std::cerr;
+
if( sink_name == "stdout" )
return &std::cout;
- static std::ofstream log_file( sink_name.c_str() );
- return &log_file;
+ static std::ofstream report_file( sink_name.c_str() );
+ return &report_file;
}
//____________________________________________________________________________//
@@ -487,13 +562,13 @@ log_sink()
std::string sink_name = retrieve_parameter( LOG_SINK, s_cla_parser, s_empty );
if( sink_name.empty() || sink_name == "stdout" )
- return &std::cout;
+ return &std::cout;
if( sink_name == "stderr" )
- return &std::cerr;
+ return &std::cerr;
- static std::ofstream report_file( sink_name.c_str() );
- return &report_file;
+ static std::ofstream log_file( sink_name.c_str() );
+ return &log_file;
}
//____________________________________________________________________________//
@@ -501,27 +576,65 @@ log_sink()
long
detect_memory_leaks()
{
- return retrieve_parameter( DETECT_MEM_LEAKS, s_cla_parser, static_cast<long>(1) );
+ static long s_value = -1;
+
+ if( s_value >= 0 )
+ return s_value;
+
+ std::string value = retrieve_parameter( DETECT_MEM_LEAKS, s_cla_parser, s_empty );
+
+ optional<bool> bool_val;
+ if( runtime::interpret_argument_value_impl<bool>::_( value, bool_val ) )
+ s_value = *bool_val ? 1L : 0L;
+ else {
+ BOOST_TEST_IMPL_TRY {
+ // if representable as long - this is leak number
+ s_value = boost::lexical_cast<long>( value );
+ }
+ BOOST_TEST_IMPL_CATCH0( boost::bad_lexical_cast ) {
+ // value is leak report file and detection is enabled
+ s_value = 1L;
+ }
+ }
+
+ return s_value;
+}
+
+//____________________________________________________________________________//
+
+const_string
+memory_leaks_report_file()
+{
+ if( detect_memory_leaks() != 1 )
+ return const_string();
+
+ static std::string s_value;
+
+ if( s_value.empty() ) {
+ s_value = retrieve_parameter<std::string>( DETECT_MEM_LEAKS, s_cla_parser );
+
+ optional<bool> bool_val;
+ if( runtime::interpret_argument_value_impl<bool>::_( s_value, bool_val ) )
+ s_value.clear();
+ }
+
+ return s_value;
}
//____________________________________________________________________________//
-int
+unsigned
random_seed()
{
- return retrieve_parameter( RANDOM_SEED, s_cla_parser, 0, 1 );
+ return retrieve_parameter( RANDOM_SEED, s_cla_parser, 0U, 1U );
}
//____________________________________________________________________________//
} // namespace runtime_config
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER
diff --git a/boost/test/impl/unit_test_suite.ipp b/boost/test/impl/unit_test_suite.ipp
deleted file mode 100644
index 32efc6059e..0000000000
--- a/boost/test/impl/unit_test_suite.ipp
+++ /dev/null
@@ -1,346 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : privides core implementation for Unit Test Framework.
-// Extensions can be provided in separate files
-// ***************************************************************************
-
-#ifndef BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
-#define BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
-
-// Boost.Test
-#include <boost/detail/workaround.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
-#include <boost/test/framework.hpp>
-#include <boost/test/utils/foreach.hpp>
-#include <boost/test/results_collector.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
-
-// Boost
-#include <boost/timer.hpp>
-
-// STL
-#include <algorithm>
-#include <vector>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \
- BOOST_WORKAROUND(_STLPORT_VERSION, <= 0x450) \
- /**/
- using std::rand; // rand is in std and random_shuffle is in _STL
-#endif
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace unit_test {
-
-// ************************************************************************** //
-// ************** test_unit ************** //
-// ************************************************************************** //
-
-test_unit::test_unit( const_string name, test_unit_type t )
-: p_type( t )
-, p_type_name( t == tut_case ? "case" : "suite" )
-, p_id( INV_TEST_UNIT_ID )
-, p_name( std::string( name.begin(), name.size() ) )
-, p_enabled( true )
-{
-}
-
-//____________________________________________________________________________//
-
-test_unit::~test_unit()
-{
- framework::deregister_test_unit( this );
-}
-
-//____________________________________________________________________________//
-
-void
-test_unit::depends_on( test_unit* tu )
-{
- m_dependencies.push_back( tu->p_id );
-}
-
-//____________________________________________________________________________//
-
-bool
-test_unit::check_dependencies() const
-{
- BOOST_TEST_FOREACH( test_unit_id, tu_id, m_dependencies ) {
- if( !unit_test::results_collector.results( tu_id ).passed() )
- return false;
- }
-
- return true;
-}
-
-//____________________________________________________________________________//
-
-void
-test_unit::increase_exp_fail( unsigned num )
-{
- p_expected_failures.value += num;
-
- if( p_parent_id != 0 )
- framework::get<test_suite>( p_parent_id ).increase_exp_fail( num );
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** test_case ************** //
-// ************************************************************************** //
-
-test_case::test_case( const_string name, callback0<> const& test_func )
-: 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
-#if BOOST_WORKAROUND(BOOST_MSVC,<1300)
- 0;
-#endif
- framework::register_test_unit( this );
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** test_suite ************** //
-// ************************************************************************** //
-
-//____________________________________________________________________________//
-
-test_suite::test_suite( const_string name )
-: test_unit( name, static_cast<test_unit_type>(type) )
-{
- framework::register_test_unit( this );
-}
-
-//____________________________________________________________________________//
-
-void
-test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout )
-{
- if( timeout != 0 )
- tu->p_timeout.value = timeout;
-
- m_members.push_back( tu->p_id );
- tu->p_parent_id.value = p_id;
-
- if( tu->p_expected_failures )
- increase_exp_fail( tu->p_expected_failures );
-
- if( expected_failures )
- tu->increase_exp_fail( expected_failures );
-}
-
-//____________________________________________________________________________//
-
-void
-test_suite::add( test_unit_generator const& gen, unsigned timeout )
-{
- test_unit* tu;
- while((tu = gen.next(), tu))
- add( tu, 0, timeout );
-}
-
-//____________________________________________________________________________//
-
-void
-test_suite::remove( test_unit_id 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 );
-}
-
-//____________________________________________________________________________//
-
-test_unit_id
-test_suite::get( const_string tu_name ) const
-{
- BOOST_TEST_FOREACH( test_unit_id, id, m_members ) {
- if( tu_name == framework::get( id, ut_detail::test_id_2_unit_type( id ) ).p_name.get() )
- return id;
- }
-
- return INV_TEST_UNIT_ID;
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** traverse_test_tree ************** //
-// ************************************************************************** //
-
-void
-traverse_test_tree( test_case const& tc, test_tree_visitor& V )
-{
- if( tc.p_enabled )
- V.visit( tc );
-}
-
-//____________________________________________________________________________//
-
-void
-traverse_test_tree( test_suite const& suite, test_tree_visitor& V )
-{
- if( !suite.p_enabled || !V.test_suite_start( suite ) )
- return;
-
- try {
- if( runtime_config::random_seed() == 0 ) {
- BOOST_TEST_FOREACH( test_unit_id, id, suite.m_members )
- traverse_test_tree( id, V );
- }
- else {
- std::vector<test_unit_id> members( suite.m_members );
- std::random_shuffle( members.begin(), members.end() );
- BOOST_TEST_FOREACH( test_unit_id, id, members )
- traverse_test_tree( id, V );
- }
-
- } catch( test_being_aborted const& ) {
- V.test_suite_finish( suite );
- framework::test_unit_aborted( suite );
-
- throw;
- }
-
- V.test_suite_finish( suite );
-}
-
-//____________________________________________________________________________//
-
-void
-traverse_test_tree( test_unit_id id, test_tree_visitor& V )
-{
- 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 );
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** test_case_counter ************** //
-// ************************************************************************** //
-
-void
-test_case_counter::visit( test_case const& tc )
-{
- if( tc.p_enabled )
- ++p_count.value;
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** object generators ************** //
-// ************************************************************************** //
-
-namespace ut_detail {
-
-std::string
-normalize_test_case_name( const_string name )
-{
- return ( name[0] == '&'
- ? std::string( name.begin()+1, name.size()-1 )
- : std::string( name.begin(), name.size() ) );
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** auto_test_unit_registrar ************** //
-// ************************************************************************** //
-
-auto_test_unit_registrar::auto_test_unit_registrar( test_case* tc, counter_t exp_fail )
-{
- curr_ts_store().back()->add( tc, exp_fail );
-}
-
-//____________________________________________________________________________//
-
-auto_test_unit_registrar::auto_test_unit_registrar( const_string ts_name )
-{
- test_unit_id id = curr_ts_store().back()->get( ts_name );
-
- test_suite* ts;
-
- if( id != INV_TEST_UNIT_ID ) {
- ts = &framework::get<test_suite>( id ); // !! test for invalid tu type
- BOOST_ASSERT( ts->p_parent_id == curr_ts_store().back()->p_id );
- }
- else {
- ts = new test_suite( ts_name );
- curr_ts_store().back()->add( ts );
- }
-
- curr_ts_store().push_back( ts );
-}
-
-//____________________________________________________________________________//
-
-auto_test_unit_registrar::auto_test_unit_registrar( test_unit_generator const& tc_gen )
-{
- curr_ts_store().back()->add( tc_gen );
-}
-
-//____________________________________________________________________________//
-
-auto_test_unit_registrar::auto_test_unit_registrar( int )
-{
- if( curr_ts_store().size() == 0 )
- return; // report error?
-
- curr_ts_store().pop_back();
-}
-
-//____________________________________________________________________________//
-
-std::list<test_suite*>&
-auto_test_unit_registrar::curr_ts_store()
-{
- static std::list<test_suite*> inst( 1, &framework::master_test_suite() );
- return inst;
-}
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-// ************************************************************************** //
-// ************** global_fixture ************** //
-// ************************************************************************** //
-
-global_fixture::global_fixture()
-{
- framework::register_observer( *this );
-}
-
-//____________________________________________________________________________//
-
-} // namespace unit_test
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER
diff --git a/boost/test/impl/xml_log_formatter.ipp b/boost/test/impl/xml_log_formatter.ipp
index 6c0127bb57..286cd60005 100644
--- a/boost/test/impl/xml_log_formatter.ipp
+++ b/boost/test/impl/xml_log_formatter.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,7 +9,7 @@
//
// Version : $Revision$
//
-// Description : implements XML Log formatter
+// Description : implements OF_XML Log formatter
// ***************************************************************************
#ifndef BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER
@@ -17,10 +17,10 @@
// Boost.Test
#include <boost/test/output/xml_log_formatter.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
+#include <boost/test/execution_monitor.hpp>
#include <boost/test/framework.hpp>
+#include <boost/test/tree/test_unit.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>
-
#include <boost/test/utils/xml_printer.hpp>
// Boost
@@ -34,14 +34,12 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
static const_string tu_type_name( test_unit const& tu )
{
- return tu.p_type == tut_case ? "TestCase" : "TestSuite";
+ return tu.p_type == TUT_CASE ? "TestCase" : "TestSuite";
}
// ************************************************************************** //
@@ -82,7 +80,13 @@ xml_log_formatter::log_build_info( std::ostream& ostr )
void
xml_log_formatter::test_unit_start( std::ostream& ostr, test_unit const& tu )
{
- ostr << "<" << tu_type_name( tu ) << " name" << attr_value() << tu.p_name.get() << ">";
+ ostr << "<" << tu_type_name( tu ) << " name" << attr_value() << tu.p_name.get();
+
+ if( !tu.p_file_name.get().empty() )
+ ostr << BOOST_TEST_L( " file" ) << attr_value() << tu.p_file_name
+ << BOOST_TEST_L( " line" ) << attr_value() << tu.p_line_num;
+
+ ostr << ">";
}
//____________________________________________________________________________//
@@ -90,27 +94,28 @@ xml_log_formatter::test_unit_start( std::ostream& ostr, test_unit const& tu )
void
xml_log_formatter::test_unit_finish( std::ostream& ostr, test_unit const& tu, unsigned long elapsed )
{
- if( tu.p_type == tut_case )
+ if( tu.p_type == TUT_CASE )
ostr << "<TestingTime>" << elapsed << "</TestingTime>";
-
+
ostr << "</" << tu_type_name( tu ) << ">";
}
//____________________________________________________________________________//
void
-xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu )
+xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu, const_string reason )
{
ostr << "<" << tu_type_name( tu )
<< " name" << attr_value() << tu.p_name.get()
<< " skipped" << attr_value() << "yes"
+ << " reason" << attr_value() << reason
<< "/>";
}
-
+
//____________________________________________________________________________//
void
-xml_log_formatter::log_exception( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, execution_exception const& ex )
+xml_log_formatter::log_exception_start( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, execution_exception const& ex )
{
execution_exception::location const& loc = ex.where();
@@ -129,7 +134,13 @@ xml_log_formatter::log_exception( std::ostream& ostr, log_checkpoint_data const&
<< cdata() << checkpoint_data.m_message
<< "</LastCheckpoint>";
}
+}
+
+//____________________________________________________________________________//
+void
+xml_log_formatter::log_exception_finish( std::ostream& ostr )
+{
ostr << "</Exception>";
}
@@ -145,6 +156,8 @@ xml_log_formatter::log_entry_start( std::ostream& ostr, log_entry_data const& en
<< BOOST_TEST_L( " file" ) << attr_value() << entry_data.m_file_name
<< BOOST_TEST_L( " line" ) << attr_value() << entry_data.m_line_num
<< BOOST_TEST_L( "><![CDATA[" );
+
+ m_value_closed = false;
}
//____________________________________________________________________________//
@@ -152,7 +165,7 @@ xml_log_formatter::log_entry_start( std::ostream& ostr, log_entry_data const& en
void
xml_log_formatter::log_entry_value( std::ostream& ostr, const_string value )
{
- ostr << value;
+ print_escaped_cdata( ostr, value );
}
//____________________________________________________________________________//
@@ -160,21 +173,52 @@ xml_log_formatter::log_entry_value( std::ostream& ostr, const_string value )
void
xml_log_formatter::log_entry_finish( std::ostream& ostr )
{
- ostr << BOOST_TEST_L( "]]></" ) << m_curr_tag << BOOST_TEST_L( ">" );
+ if( !m_value_closed ) {
+ ostr << BOOST_TEST_L( "]]>" );
+ m_value_closed = true;
+ }
+
+ ostr << BOOST_TEST_L( "</" ) << m_curr_tag << BOOST_TEST_L( ">" );
m_curr_tag.clear();
}
//____________________________________________________________________________//
-} // namespace output
+void
+xml_log_formatter::entry_context_start( std::ostream& ostr, log_level )
+{
+ if( !m_value_closed ) {
+ ostr << BOOST_TEST_L( "]]>" );
+ m_value_closed = true;
+ }
-} // namespace unit_test
+ ostr << BOOST_TEST_L( "<Context>" );
-} // namespace boost
+}
+
+//____________________________________________________________________________//
+
+void
+xml_log_formatter::entry_context_finish( std::ostream& ostr )
+{
+ ostr << BOOST_TEST_L( "</Context>" );
+}
//____________________________________________________________________________//
+void
+xml_log_formatter::log_entry_context( std::ostream& ostr, const_string context_descr )
+{
+ ostr << BOOST_TEST_L( "<Frame>" ) << cdata() << context_descr << BOOST_TEST_L( "</Frame>" );
+}
+
+//____________________________________________________________________________//
+
+} // namespace output
+} // namespace unit_test
+} // namespace boost
+
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER
diff --git a/boost/test/impl/xml_report_formatter.ipp b/boost/test/impl/xml_report_formatter.ipp
index 261db788b3..5606fdc0b1 100644
--- a/boost/test/impl/xml_report_formatter.ipp
+++ b/boost/test/impl/xml_report_formatter.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,7 +9,7 @@
//
// Version : $Revision$
//
-// Description : XML report formatter
+// Description : OF_XML report formatter
// ***************************************************************************
#ifndef BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER
@@ -17,9 +17,9 @@
// Boost.Test
#include <boost/test/results_collector.hpp>
-#include <boost/test/unit_test_suite_impl.hpp>
#include <boost/test/output/xml_report_formatter.hpp>
+#include <boost/test/tree/test_unit.hpp>
#include <boost/test/utils/xml_printer.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>
@@ -28,9 +28,7 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
void
@@ -66,20 +64,23 @@ xml_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream&
else
descr = "failed";
- ostr << '<' << ( tu.p_type == tut_case ? "TestCase" : "TestSuite" )
+ ostr << '<' << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" )
<< " name" << attr_value() << tu.p_name.get()
<< " result" << attr_value() << descr
<< " assertions_passed" << attr_value() << tr.p_assertions_passed
<< " assertions_failed" << attr_value() << tr.p_assertions_failed
+ << " warnings_failed" << attr_value() << tr.p_warnings_failed
<< " expected_failures" << attr_value() << tr.p_expected_failures;
- if( tu.p_type == tut_suite )
+ if( tu.p_type == TUT_SUITE ) {
ostr << " test_cases_passed" << attr_value() << tr.p_test_cases_passed
+ << " test_cases_passed_with_warnings" << attr_value() << tr.p_test_cases_warned
<< " test_cases_failed" << attr_value() << tr.p_test_cases_failed
<< " test_cases_skipped" << attr_value() << tr.p_test_cases_skipped
<< " test_cases_aborted" << attr_value() << tr.p_test_cases_aborted;
-
-
+ }
+
+
ostr << '>';
}
@@ -88,7 +89,7 @@ xml_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream&
void
xml_report_formatter::test_unit_report_finish( test_unit const& tu, std::ostream& ostr )
{
- ostr << "</" << ( tu.p_type == tut_case ? "TestCase" : "TestSuite" ) << '>';
+ ostr << "</" << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" ) << '>';
}
//____________________________________________________________________________//
@@ -97,19 +98,15 @@ void
xml_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr )
{
test_unit_report_start( tu, ostr );
- test_unit_report_finish( tu, ostr );
+ test_unit_report_finish( tu, ostr );
}
//____________________________________________________________________________//
} // namespace output
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER
diff --git a/boost/test/included/execution_monitor.hpp b/boost/test/included/execution_monitor.hpp
new file mode 100644
index 0000000000..d372084604
--- /dev/null
+++ b/boost/test/included/execution_monitor.hpp
@@ -0,0 +1,21 @@
+// (C) Copyright Gennadiy Rozental 2010-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision$
+//
+// Description : included variant of Execution Monitor to be used independently
+// ***************************************************************************
+
+#ifndef BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER
+#define BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER
+
+#include <boost/test/impl/execution_monitor.ipp>
+#include <boost/test/impl/debug.ipp>
+
+#endif // BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER
diff --git a/boost/test/included/prg_exec_monitor.hpp b/boost/test/included/prg_exec_monitor.hpp
index 530cc3feba..e8d655be7d 100644
--- a/boost/test/included/prg_exec_monitor.hpp
+++ b/boost/test/included/prg_exec_monitor.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
diff --git a/boost/test/included/test_exec_monitor.hpp b/boost/test/included/test_exec_monitor.hpp
index 8d351b158b..0d5e4b1bf4 100644
--- a/boost/test/included/test_exec_monitor.hpp
+++ b/boost/test/included/test_exec_monitor.hpp
@@ -1,15 +1,13 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
//
-// Version : $Revision$
-//
-// Description : included (vs. linked) version of Test Execution Monitor
+/// @file
+/// @brief Included (vs. linked) version of Test Execution Monitor
// ***************************************************************************
#ifndef BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER
@@ -17,6 +15,7 @@
#include <boost/test/impl/compiler_log_formatter.ipp>
#include <boost/test/impl/debug.ipp>
+#include <boost/test/impl/decorator.ipp>
#include <boost/test/impl/execution_monitor.ipp>
#include <boost/test/impl/framework.ipp>
#include <boost/test/impl/plain_report_formatter.ipp>
@@ -25,11 +24,11 @@
#include <boost/test/impl/results_reporter.ipp>
#include <boost/test/impl/test_main.ipp>
#include <boost/test/impl/test_tools.ipp>
+#include <boost/test/impl/test_tree.ipp>
#include <boost/test/impl/unit_test_log.ipp>
#include <boost/test/impl/unit_test_main.ipp>
#include <boost/test/impl/unit_test_monitor.ipp>
#include <boost/test/impl/unit_test_parameters.ipp>
-#include <boost/test/impl/unit_test_suite.ipp>
#include <boost/test/impl/xml_log_formatter.ipp>
#include <boost/test/impl/xml_report_formatter.ipp>
diff --git a/boost/test/included/unit_test.hpp b/boost/test/included/unit_test.hpp
index 5b2d50ab71..5bc17a38cb 100644
--- a/boost/test/included/unit_test.hpp
+++ b/boost/test/included/unit_test.hpp
@@ -1,15 +1,12 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : included (vs. linked) version of Unit Test Framework
+//!@file
+//!@brief Included (vs. linked) version of Unit Test Framework
// ***************************************************************************
#ifndef BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER
@@ -17,21 +14,19 @@
#include <boost/test/impl/compiler_log_formatter.ipp>
#include <boost/test/impl/debug.ipp>
+#include <boost/test/impl/decorator.ipp>
#include <boost/test/impl/framework.ipp>
-#include <boost/test/impl/exception_safety.ipp>
#include <boost/test/impl/execution_monitor.ipp>
-#include <boost/test/impl/interaction_based.ipp>
-#include <boost/test/impl/logged_expectations.ipp>
#include <boost/test/impl/plain_report_formatter.ipp>
#include <boost/test/impl/progress_monitor.ipp>
#include <boost/test/impl/results_collector.ipp>
#include <boost/test/impl/results_reporter.ipp>
#include <boost/test/impl/test_tools.ipp>
+#include <boost/test/impl/test_tree.ipp>
#include <boost/test/impl/unit_test_log.ipp>
#include <boost/test/impl/unit_test_main.ipp>
#include <boost/test/impl/unit_test_monitor.ipp>
#include <boost/test/impl/unit_test_parameters.ipp>
-#include <boost/test/impl/unit_test_suite.ipp>
#include <boost/test/impl/xml_log_formatter.ipp>
#include <boost/test/impl/xml_report_formatter.ipp>
diff --git a/boost/test/included/unit_test_framework.hpp b/boost/test/included/unit_test_framework.hpp
index 2eab54ea91..219cc6c283 100644
--- a/boost/test/included/unit_test_framework.hpp
+++ b/boost/test/included/unit_test_framework.hpp
@@ -1,2 +1,12 @@
-// deprecated
+// (C) Copyright Gennadiy Rozental 2001-2012.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// @deprecated
+// ***************************************************************************
+
#include <boost/test/included/unit_test.hpp>
diff --git a/boost/test/interaction_based.hpp b/boost/test/interaction_based.hpp
deleted file mode 100644
index e77128abd2..0000000000
--- a/boost/test/interaction_based.hpp
+++ /dev/null
@@ -1,262 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Facilities to perform interaction-based testing
-// ***************************************************************************
-
-#ifndef BOOST_TEST_INTERACTION_BASED_HPP_112105GER
-#define BOOST_TEST_INTERACTION_BASED_HPP_112105GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/detail/global_typedef.hpp>
-
-#include <boost/test/utils/wrap_stringstream.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-// Boost
-#include <boost/lexical_cast.hpp>
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** BOOST_ITEST_EPOINT ************** //
-// ************************************************************************** //
-
-#define BOOST_ITEST_EPOINT( description ) \
- ::boost::itest::manager::instance().exception_point( BOOST_TEST_L(__FILE__), __LINE__, description )
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_ITEST_DPOINT ************** //
-// ************************************************************************** //
-
-#define BOOST_ITEST_DPOINT() \
- ::boost::itest::manager::instance().decision_point( BOOST_TEST_L(__FILE__), __LINE__ )
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_ITEST_SCOPE ************** //
-// ************************************************************************** //
-
-#define BOOST_ITEST_SCOPE( scope_name ) \
- ::boost::itest::scope_guard itest_scope_guard ## __LINE__( BOOST_TEST_L(__FILE__), __LINE__, BOOST_STRINGIZE(scope_name) )
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_ITEST_NEW ************** //
-// ************************************************************************** //
-
-#define BOOST_ITEST_NEW( type_name ) \
- new ( ::boost::itest::location( BOOST_TEST_L(__FILE__), __LINE__ ) ) type_name
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_ITEST_DATA_FLOW ************** //
-// ************************************************************************** //
-
-#define BOOST_ITEST_DATA_FLOW( v ) \
- ::boost::itest::manager::instance().generic_data_flow( v )
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_ITEST_RETURN ************** //
-// ************************************************************************** //
-
-#define BOOST_ITEST_RETURN( type, default_value ) \
- ::boost::itest::manager::instance().generic_return<type>( default_value )
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_ITEST_MOCK_FUNC ************** //
-// ************************************************************************** //
-
-#define BOOST_ITEST_MOCK_FUNC( function_name ) \
- BOOST_ITEST_SCOPE( function_name ); \
- BOOST_ITEST_EPOINT( 0 ); \
- return ::boost::itest::mock_object<>::prototype(); \
-/**/
-
-namespace boost {
-
-namespace itest { // interaction-based testing
-
-using unit_test::const_string;
-
-// ************************************************************************** //
-// ************** manager ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL manager {
-public:
- // instance access
- static manager& instance() { return *instance_ptr(); }
-
- // Mock objects interface hooks
- virtual void exception_point( const_string /*file*/,
- std::size_t /*line_num*/,
- const_string /*descr*/ ){}
- virtual bool decision_point( const_string /*file*/,
- std::size_t /*line_num*/ ) { return true; }
- virtual unsigned enter_scope( const_string /*file*/,
- std::size_t /*line_num*/,
- const_string /*scope_name*/){ return 0; }
- virtual void leave_scope( unsigned ) {}
- virtual void allocated( const_string /*file*/,
- std::size_t /*line_num*/,
- void* /*p*/, std::size_t /*s*/ ) {}
- virtual void freed( void* /*p*/ ) {}
- virtual void data_flow( const_string /*d*/ ) {}
- virtual std::string return_value( const_string /*default_value */ ) { return ""; }
-
- template<typename T>
- void generic_data_flow( T const& t )
- {
- wrap_stringstream ws;
-
- data_flow( (ws << t).str() );
- }
- template<typename T, typename DefaultValueType>
- T generic_return( DefaultValueType const& dv )
- {
- wrap_stringstream ws;
-
- std::string const& res = return_value( (ws << dv).str() );
-
- if( res.empty() )
- return dv;
-
- return lexical_cast<T>( res );
- }
-
-protected:
- manager();
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-public:
-#endif
- BOOST_TEST_PROTECTED_VIRTUAL ~manager();
-
-private:
- struct dummy_constr{};
- explicit manager( dummy_constr* ) {}
-
- static manager* instance_ptr( bool reset = false, manager* ptr = 0 );
-}; // manager
-
-// ************************************************************************** //
-// ************** scope_guard ************** //
-// ************************************************************************** //
-
-class scope_guard {
-public:
- // Constructor
- scope_guard( const_string file, std::size_t line_num, const_string scope_name )
- {
- m_scope_index = manager::instance().enter_scope( file, line_num, scope_name );
- }
- ~scope_guard()
- {
- manager::instance().leave_scope( m_scope_index );
- }
-
- unsigned m_scope_index;
-};
-
-// ************************************************************************** //
-// ************** location ************** //
-// ************************************************************************** //
-
-struct location {
- location( const_string file, std::size_t line )
- : m_file_name( file )
- , m_line_num( line )
- {}
-
- const_string m_file_name;
- std::size_t m_line_num;
-};
-
-} // namespace itest
-
-} // namespace boost
-
-// ************************************************************************** //
-// ************** operator new overload ************** //
-// ************************************************************************** //
-
-#if !defined(BOOST_ITEST_NO_NEW_OVERLOADS)
-
-// STL
-#include <cstdlib>
-
-# ifdef BOOST_NO_STDC_NAMESPACE
-namespace std { using ::malloc; using ::free; }
-# endif
-# ifdef _CRTDBG_MAP_ALLOC
-namespace std { using ::_malloc_dbg; using ::_free_dbg; }
-# endif
-
-inline void*
-operator new( std::size_t s, ::boost::itest::location const& l )
-{
- void* res = std::malloc(s ? s : 1);
-
- if( res )
- ::boost::itest::manager::instance().allocated( l.m_file_name, l.m_line_num, res, s );
- else
- throw std::bad_alloc();
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-inline void*
-operator new[]( std::size_t s, ::boost::itest::location const& l )
-{
- void* res = std::malloc(s ? s : 1);
-
- if( res )
- ::boost::itest::manager::instance().allocated( l.m_file_name, l.m_line_num, res, s );
- else
- throw std::bad_alloc();
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-inline void
-operator delete( void* p, ::boost::itest::location const& )
-{
- ::boost::itest::manager::instance().freed( p );
-
- std::free( p );
-}
-
-//____________________________________________________________________________//
-
-inline void
-operator delete[]( void* p, ::boost::itest::location const& )
-{
- ::boost::itest::manager::instance().freed( p );
-
- std::free( p );
-}
-
-//____________________________________________________________________________//
-
-#endif
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_INTERACTION_BASED_HPP_112105GER
diff --git a/boost/test/logged_expectations.hpp b/boost/test/logged_expectations.hpp
deleted file mode 100644
index 868281216a..0000000000
--- a/boost/test/logged_expectations.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Facilities to perform interaction based testng of logged expectations
-// ***************************************************************************
-
-#ifndef BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER
-#define BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/detail/unit_test_parameters.hpp>
-#include <boost/test/utils/callback.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** BOOST_TEST_LOGGED_EXPECTATIONS ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_LOGGED_EXPECTATIONS( test_name ) \
-struct test_name : public BOOST_AUTO_TEST_CASE_FIXTURE \
-{ void test_method(); }; \
- \
-static void BOOST_AUTO_TC_INVOKER( test_name )() \
-{ \
- test_name t; \
- ::boost::itest::logged_expectations( \
- boost::bind( &test_name::test_method, t ), \
- BOOST_STRINGIZE(test_name) ".elog", \
- !::boost::unit_test::runtime_config::save_pattern() ); \
-} \
- \
-struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
- \
-BOOST_AUTO_TU_REGISTRAR( test_name )( \
- boost::unit_test::make_test_case( \
- &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
- boost::unit_test::ut_detail::auto_tc_exp_fail< \
- BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
- \
-void test_name::test_method() \
-/**/
-
-namespace boost {
-
-namespace itest {
-
-// ************************************************************************** //
-// ************** logged expectations test ************** //
-// ************************************************************************** //
-
-void BOOST_TEST_DECL
-logged_expectations( unit_test::callback0<> const& F,
- unit_test::const_string log_file_name,
- bool test_or_log = true );
-
-} // namespace itest
-
-} // namespace boost
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER
diff --git a/boost/test/minimal.hpp b/boost/test/minimal.hpp
index 7d32150560..dfaa68c6e2 100644
--- a/boost/test/minimal.hpp
+++ b/boost/test/minimal.hpp
@@ -1,15 +1,31 @@
-// (C) Copyright Gennadiy Rozental 2002-2008.
+// (C) Copyright Gennadiy Rozental 2002-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : simple minimal testing definitions and implementation
+/// @file
+/// @brief Deprecated implementation of simple minimal testing
+/// @deprecated
+/// To convert to Unit Test Framework simply rewrite:
+/// @code
+/// #include <boost/test/minimal.hpp>
+///
+/// int test_main( int, char *[] )
+/// {
+/// ...
+/// }
+/// @endcode
+/// as
+/// @code
+/// #include <boost/test/included/unit_test.hpp>
+///
+/// BOOST_AUTO_TEST_CASE(test_main)
+/// {
+/// ...
+/// }
+/// @endcode
// ***************************************************************************
#ifndef BOOST_TEST_MINIMAL_HPP_071894GER
@@ -40,7 +56,7 @@
#include <boost/test/utils/basic_cstring/io.hpp>
// Boost
-#include <boost/cstdlib.hpp> // for exit codes#include <boost/cstdlib.hpp> // for exit codes
+#include <boost/cstdlib.hpp> // for exit codes
#include <boost/current_function.hpp> // for BOOST_CURRENT_FUNCTION
// STL
@@ -101,7 +117,6 @@ private:
}; // monitor
} // namespace minimal_test
-
} // namespace boost
//____________________________________________________________________________//
@@ -118,9 +133,7 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] )
}
catch( boost::execution_exception const& exex ) {
if( exex.code() != boost::execution_exception::no_error )
- BOOST_ERROR( (std::string( "exception \"" ).
- append( exex.what().begin(), exex.what().end() ).
- append( "\" caught" ) ).c_str() );
+ BOOST_ERROR( (std::string( "exception \"" ) + exex.what() + "\" caught").c_str() );
std::cerr << "\n**** Testing aborted.";
}
@@ -132,7 +145,7 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] )
}
std::cout << "\n**** no errors detected\n";
-
+
return boost::exit_success;
}
diff --git a/boost/test/mock_object.hpp b/boost/test/mock_object.hpp
deleted file mode 100644
index dbc4cb410a..0000000000
--- a/boost/test/mock_object.hpp
+++ /dev/null
@@ -1,328 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Facilities to perform exception safety_tests
-// ***************************************************************************
-
-#ifndef BOOST_TEST_MOCK_OBJECT_HPP_112205GER
-#define BOOST_TEST_MOCK_OBJECT_HPP_112205GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/interaction_based.hpp>
-
-// Boost
-#include <boost/preprocessor/punctuation/comma.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace itest {
-
-// ************************************************************************** //
-// ************** mock_object_base ************** //
-// ************************************************************************** //
-
-class mock_object_base {
-public:
- mock_object_base() {}
-
- template<typename T1>
- mock_object_base( T1 const& ) {}
-
- template<typename T1, typename T2>
- mock_object_base( T1 const&, T2 const& ) {}
-
- template<typename T1, typename T2, typename T3>
- mock_object_base( T1 const&, T2 const&, T3 const& ) {}
-
- template<typename T1, typename T2, typename T3, typename T4>
- mock_object_base( T1 const&, T2 const&, T3 const&, T4 const& ) {}
-
- template<typename T1, typename T2, typename T3, typename T4, typename T5>
- mock_object_base( T1 const&, T2 const&, T3 const&, T4 const&, T5 const& ) {}
-};
-
-// ************************************************************************** //
-// ************** mock_object implementation helpers ************** //
-// ************************************************************************** //
-
-#define MO_OP_IMPL( op, descr, ret ) \
- BOOST_ITEST_SCOPE( mock_object::operator op ); \
- BOOST_ITEST_EPOINT( descr ); \
- return ret \
-/**/
-
-#define MO_UNARY_OP( op, descr ) \
-self_type const& operator op() const \
-{ \
- MO_OP_IMPL( op, descr, prototype() ); \
-} \
-/**/
-
-#define MO_UNARY_BOOL_OP( op, descr ) \
-bool operator op() const \
-{ \
- MO_OP_IMPL( op, descr, (!!BOOST_ITEST_DPOINT()) ); \
-} \
-/**/
-
-#define MO_BINARY_OP( op, descr ) \
-template<int i1, typename Base1,int i2, typename Base2> \
-inline mock_object<i1,Base1> const& \
-operator op( mock_object<i1,Base1> const& mo, \
- mock_object<i2,Base2> const& ) \
-{ \
- MO_OP_IMPL( op, descr, mo ); \
-} \
- \
-template<int i, typename Base, typename T> \
-inline mock_object<i,Base> const& \
-operator op( mock_object<i,Base> const& mo, T const& ) \
-{ \
- MO_OP_IMPL( op, descr, mo ); \
-} \
- \
-template<int i, typename Base, typename T> \
-inline mock_object<i,Base> const& \
-operator op( T const&, mock_object<i,Base> const& mo ) \
-{ \
- MO_OP_IMPL( op, descr, mo ); \
-} \
-/**/
-
-#define MO_BINARY_BOOL_OP( op, descr ) \
-template<int i1, typename Base1,int i2, typename Base2> \
-inline bool \
-operator op( mock_object<i1,Base1> const&, \
- mock_object<i2,Base2> const& ) \
-{ \
- MO_OP_IMPL( op, descr, BOOST_ITEST_DPOINT() ); \
-} \
- \
-template<int i, typename Base, typename T> \
-inline bool \
-operator op( mock_object<i,Base> const&, T const& ) \
-{ \
- MO_OP_IMPL( op, descr, BOOST_ITEST_DPOINT() ); \
-} \
- \
-template<int i, typename Base, typename T> \
-inline bool \
-operator op( T const&, mock_object<i,Base> const& ) \
-{ \
- MO_OP_IMPL( op, descr, BOOST_ITEST_DPOINT() ); \
-} \
-/**/
-
-// ************************************************************************** //
-// ************** mock_object ************** //
-// ************************************************************************** //
-
-template<int i = 0, typename Base=mock_object_base>
-class mock_object;
-
-template<int i, typename Base>
-class mock_object : public Base {
- // Private typeefs
- typedef mock_object<i,Base> self_type;
- struct dummy { void nonnull() {}; };
- typedef void (dummy::*safe_bool)();
-
- // prototype constructor
- mock_object( dummy* ) {}
-
-public:
- static mock_object& prototype()
- {
- static mock_object p( reinterpret_cast<dummy*>(0) );
- return p;
- }
-
- // Constructors
- mock_object()
- {
- BOOST_ITEST_SCOPE( mock_object::mock_object );
- BOOST_ITEST_EPOINT( "Mock object default constructor" );
- }
-
- template<typename T1>
- mock_object( T1 const& arg1 )
- : mock_object_base( arg1 )
- {
- BOOST_ITEST_SCOPE( mock_object::mock_object );
- BOOST_ITEST_EPOINT( "Mock object constructor" );
- }
-
- template<typename T1, typename T2>
- mock_object( T1 const& arg1, T2 const& arg2 )
- : mock_object_base( arg1, arg2 )
- {
- BOOST_ITEST_SCOPE( mock_object::mock_object );
- BOOST_ITEST_EPOINT( "Mock object constructor" );
- }
-
- template<typename T1, typename T2, typename T3>
- mock_object( T1 const& arg1, T2 const& arg2, T3 const& arg3 )
- : mock_object_base( arg1, arg2, arg3 )
- {
- BOOST_ITEST_SCOPE( mock_object::mock_object );
- BOOST_ITEST_EPOINT( "Mock object constructor" );
- }
-
- template<typename T1, typename T2, typename T3, typename T4>
- mock_object( T1 const& arg1, T2 const& arg2, T3 const& arg3, T4 const& arg4 )
- : mock_object_base( arg1, arg2, arg3, arg4 )
- {
- BOOST_ITEST_SCOPE( mock_object::mock_object );
- BOOST_ITEST_EPOINT( "Mock object constructor" );
- }
-
- template<typename T1, typename T2, typename T3, typename T4, typename T5>
- mock_object( T1 const& arg1, T2 const& arg2, T3 const& arg3, T4 const& arg4, T5 const& arg5 )
- : mock_object_base( arg1, arg2, arg3, arg4, arg5 )
- {
- BOOST_ITEST_SCOPE( mock_object::mock_object );
- BOOST_ITEST_EPOINT( "Mock object constructor" );
- }
-
- mock_object( mock_object const& )
- {
- BOOST_ITEST_SCOPE( mock_object::mock_object );
- BOOST_ITEST_EPOINT( "Mock object copy constructor" );
- }
-
- // assignment
- self_type const& operator =( mock_object const& ) const
- {
- MO_OP_IMPL( =, "Copy assignment", prototype() );
- }
-
- template <typename T>
- self_type const& operator =( T const& ) const
- {
- MO_OP_IMPL( =, "Copy assignment", prototype() );
- }
-
- // Unary operators
- MO_UNARY_BOOL_OP( !, "Logical NOT operator" )
- MO_UNARY_OP( &, "Address-of operator" )
- MO_UNARY_OP( ~, "One's complement operator" )
- MO_UNARY_OP( *, "Pointer dereference" )
- MO_UNARY_OP( +, "Unary plus" )
-
- // Increment and Decrement
- MO_UNARY_OP( ++, "Prefix increment" )
- MO_UNARY_OP( --, "Prefix decrement" )
- self_type const& operator ++(int) const
- {
- MO_OP_IMPL( ++, "Postfix increment", prototype() );
- }
- self_type const& operator --(int) const
- {
- MO_OP_IMPL( --, "Postfix decrement", prototype() );
- }
-
- // Bool context convertion
- operator safe_bool() const
- {
- MO_OP_IMPL( safe_bool, "Bool context conversion",
- (BOOST_ITEST_DPOINT() ? 0 : &dummy::nonnull) );
- }
-
- // Function-call operators
- self_type const& operator ()() const
- {
- MO_OP_IMPL( (), "0-arity function-call", prototype() );
- }
- template<typename T1>
- self_type const& operator ()( T1 const& arg1 ) const
- {
- MO_OP_IMPL( (), "1-arity function-call", prototype() );
- }
- template<typename T1, typename T2>
- self_type const& operator ()( T1 const&, T2 const& ) const
- {
- MO_OP_IMPL( (), "2-arity function-call", prototype() );
- }
- template<typename T1, typename T2, typename T3>
- self_type const& operator ()( T1 const&, T2 const&, T3 const& ) const
- {
- MO_OP_IMPL( (), "3-arity function-call", prototype() );
- }
- template<typename T1, typename T2, typename T3, typename T4>
- self_type const& operator ()( T1 const&, T2 const&, T3 const&, T4 const& ) const
- {
- MO_OP_IMPL( (), "4-arity function-call", prototype() );
- }
- template<typename T1, typename T2, typename T3, typename T4, typename T5>
- self_type const& operator ()( T1 const&, T2 const&, T3 const&, T4 const&, T5 const& ) const
- {
- MO_OP_IMPL( (), "5-arity function-call", prototype() );
- }
-
- // Substripting
- template<typename T>
- self_type const& operator []( T const& ) const
- {
- MO_OP_IMPL( [], "Substripting", prototype() );
- }
-
- // Class member access
- self_type const* operator->() const
- {
- MO_OP_IMPL( ->, "Class member access", this );
- }
-};
-
-// !! MO_BINARY_OP( BOOST_PP_COMMA(), "Comma operator" )
-
-MO_BINARY_BOOL_OP( !=, "Inequality" )
-MO_BINARY_OP( %, "Modulus" )
-MO_BINARY_OP( %=, "Modulus/assignment" )
-MO_BINARY_OP( &, "Bitwise AND" )
-MO_BINARY_BOOL_OP( &&, "Logical AND" )
-MO_BINARY_OP( &=, "Bitwise AND/assignment" )
-MO_BINARY_OP( *, "Multiplication" )
-MO_BINARY_OP( *=, "Multiplication/assignment" )
-MO_BINARY_OP( +, "Addition" )
-MO_BINARY_OP( +=, "Addition/assignment" )
-//MO_BINARY_OP( -, "Subtraction" )
-MO_BINARY_OP( -=, "Subtraction/assignment" )
-MO_BINARY_OP( ->*, "Pointer-to-member selection" )
-MO_BINARY_OP( /, "Division" )
-MO_BINARY_OP( /=, "Division/assignment" )
-MO_BINARY_BOOL_OP( <, "Less than" )
-MO_BINARY_OP( <<=, "Left shift/assignment" )
-MO_BINARY_BOOL_OP( <=, "Less than or equal to" )
-MO_BINARY_BOOL_OP( ==, "Equality" )
-MO_BINARY_BOOL_OP( >, "Greater than" )
-MO_BINARY_BOOL_OP( >=, "Greater than or equal to" )
-MO_BINARY_OP( >>=, "Right shift/assignment" )
-MO_BINARY_OP( ^, "Exclusive OR" )
-MO_BINARY_OP( ^=, "Exclusive OR/assignment" )
-MO_BINARY_OP( |, "Bitwise inclusive OR" )
-MO_BINARY_OP( |=, "Bitwise inclusive OR/assignment" )
-MO_BINARY_BOOL_OP( ||, "Logical OR" )
-
-MO_BINARY_OP( <<, "Left shift" )
-MO_BINARY_OP( >>, "Right shift" )
-
-} // namespace itest
-
-} // namespace boost
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_MOCK_OBJECT_HPP_112205GER
diff --git a/boost/test/output/compiler_log_formatter.hpp b/boost/test/output/compiler_log_formatter.hpp
index 23795b99eb..0b3e881179 100644
--- a/boost/test/output/compiler_log_formatter.hpp
+++ b/boost/test/output/compiler_log_formatter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -24,9 +24,7 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
// ************************************************************************** //
@@ -42,27 +40,28 @@ public:
void test_unit_start( std::ostream&, test_unit const& tu );
void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed );
- void test_unit_skipped( std::ostream&, test_unit const& tu );
+ void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason );
- void log_exception( std::ostream&, log_checkpoint_data const&, execution_exception const& ex );
+ void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex );
+ void log_exception_finish( std::ostream& );
void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let );
void log_entry_value( std::ostream&, const_string value );
void log_entry_value( std::ostream&, lazy_ostream const& value );
void log_entry_finish( std::ostream& );
+ void entry_context_start( std::ostream&, log_level );
+ void log_entry_context( std::ostream&, const_string );
+ void entry_context_finish( std::ostream& );
+
protected:
virtual void print_prefix( std::ostream&, const_string file, std::size_t line );
};
} // namespace output
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER
diff --git a/boost/test/output/plain_report_formatter.hpp b/boost/test/output/plain_report_formatter.hpp
index 2785e697d6..ff8924f623 100644
--- a/boost/test/output/plain_report_formatter.hpp
+++ b/boost/test/output/plain_report_formatter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -24,9 +24,7 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
// ************************************************************************** //
@@ -50,13 +48,9 @@ private:
};
} // namespace output
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER
diff --git a/boost/test/output/xml_log_formatter.hpp b/boost/test/output/xml_log_formatter.hpp
index 43b4ce82de..7c05e482e7 100644
--- a/boost/test/output/xml_log_formatter.hpp
+++ b/boost/test/output/xml_log_formatter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,7 +9,7 @@
//
// Version : $Revision$
//
-// Description : contains XML Log formatter definition
+// Description : contains OF_XML Log formatter definition
// ***************************************************************************
#ifndef BOOST_TEST_XML_LOG_FORMATTER_020105GER
@@ -27,9 +27,7 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
// ************************************************************************** //
@@ -45,28 +43,30 @@ public:
void test_unit_start( std::ostream&, test_unit const& tu );
void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed );
- void test_unit_skipped( std::ostream&, test_unit const& tu );
+ void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason );
- void log_exception( std::ostream&, log_checkpoint_data const&, execution_exception const& ex );
+ void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex );
+ void log_exception_finish( std::ostream& );
void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let );
using unit_test_log_formatter::log_entry_value; // bring base class functions into overload set
void log_entry_value( std::ostream&, const_string value );
void log_entry_finish( std::ostream& );
+ void entry_context_start( std::ostream&, log_level );
+ void log_entry_context( std::ostream&, const_string );
+ void entry_context_finish( std::ostream& );
+
private:
// Data members
const_string m_curr_tag;
+ bool m_value_closed;
};
} // namespace output
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_XML_LOG_FORMATTER_020105GER
diff --git a/boost/test/output/xml_report_formatter.hpp b/boost/test/output/xml_report_formatter.hpp
index 0ee81d9457..ab183d02ae 100644
--- a/boost/test/output/xml_report_formatter.hpp
+++ b/boost/test/output/xml_report_formatter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,7 +9,7 @@
//
// Version : $Revision$
//
-// Description : XML report formatter implementation
+// Description : OF_XML report formatter implementation
// ***************************************************************************
#ifndef BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER
@@ -24,9 +24,7 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace output {
// ************************************************************************** //
@@ -46,13 +44,9 @@ public:
};
} // namespace output
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER
diff --git a/boost/test/output_test_stream.hpp b/boost/test/output_test_stream.hpp
index 2f2184a933..83f9264635 100644
--- a/boost/test/output_test_stream.hpp
+++ b/boost/test/output_test_stream.hpp
@@ -1,78 +1,14 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2011-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : output_test_stream class definition
+//!@file
+//!@brief Deprecated header.
+//!@deprecated Use boost/test/tools/output_test_stream.hpp instead
// ***************************************************************************
-#ifndef BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
-#define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
-
// Boost.Test
-#include <boost/test/detail/global_typedef.hpp>
-#include <boost/test/utils/wrap_stringstream.hpp>
-#include <boost/test/predicate_result.hpp>
-
-// STL
-#include <cstddef> // for std::size_t
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** output_test_stream ************** //
-// ************************************************************************** //
-
-// class to be used to simplify testing of ostream-based output operations
-
-namespace boost {
-
-namespace test_tools {
-
-class BOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream {
- typedef unit_test::const_string const_string;
- typedef predicate_result result_type;
-public:
- // Constructor
- explicit output_test_stream( const_string pattern_file_name = const_string(),
- bool match_or_save = true,
- bool text_or_binary = true );
-
- // Destructor
- ~output_test_stream();
-
- // checking function
- result_type is_empty( bool flush_stream = true );
- result_type check_length( std::size_t length, bool flush_stream = true );
- result_type is_equal( const_string arg_, bool flush_stream = true );
- result_type match_pattern( bool flush_stream = true );
-
- // explicit flush
- void flush();
-
-private:
- // helper functions
- std::size_t length();
- void sync();
-
- struct Impl;
- Impl* m_pimpl;
-};
-
-} // namespace test_tools
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
+#include <boost/test/tools/output_test_stream.hpp>
diff --git a/boost/test/parameterized_test.hpp b/boost/test/parameterized_test.hpp
index 7654409a8e..4e08567d31 100644
--- a/boost/test/parameterized_test.hpp
+++ b/boost/test/parameterized_test.hpp
@@ -1,15 +1,12 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : generators and helper macros for parameterized tests
+//!@file
+//!@brief generators and helper macros for parameterized tests
// ***************************************************************************
#ifndef BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER
@@ -17,12 +14,14 @@
// Boost.Test
#include <boost/test/unit_test_suite.hpp>
-#include <boost/test/utils/callback.hpp>
// Boost
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
+#include <boost/bind.hpp>
+#include <boost/function/function1.hpp>
+
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
@@ -30,41 +29,23 @@
#define BOOST_PARAM_TEST_CASE( function, begin, end ) \
boost::unit_test::make_test_case( function, \
BOOST_TEST_STRINGIZE( function ), \
+ __FILE__, __LINE__, \
(begin), (end) ) \
/**/
#define BOOST_PARAM_CLASS_TEST_CASE( function, tc_instance, begin, end ) \
boost::unit_test::make_test_case( function, \
BOOST_TEST_STRINGIZE( function ), \
+ __FILE__, __LINE__, \
(tc_instance), \
(begin), (end) ) \
/**/
namespace boost {
-
namespace unit_test {
-// ************************************************************************** //
-// ************** test_func_with_bound_param ************** //
-// ************************************************************************** //
-
namespace ut_detail {
-template<typename ParamType>
-struct test_func_with_bound_param {
- template<typename T>
- test_func_with_bound_param( callback1<ParamType> test_func, T const& param )
- : m_test_func( test_func )
- , m_param( param )
- {}
-
- void operator()() { m_test_func( m_param ); }
-
-private:
- callback1<ParamType> m_test_func;
- ParamType m_param;
-};
-
// ************************************************************************** //
// ************** param_test_case_generator ************** //
// ************************************************************************** //
@@ -72,12 +53,16 @@ private:
template<typename ParamType, typename ParamIter>
class param_test_case_generator : public test_unit_generator {
public:
- param_test_case_generator( callback1<ParamType> const& test_func,
- const_string tc_name,
- ParamIter par_begin,
- ParamIter par_end )
+ param_test_case_generator( boost::function<void (ParamType)> const& test_func,
+ const_string tc_name,
+ const_string tc_file,
+ std::size_t tc_line,
+ ParamIter par_begin,
+ ParamIter par_end )
: m_test_func( test_func )
, m_tc_name( ut_detail::normalize_test_case_name( tc_name ) )
+ , m_tc_file( tc_file )
+ , m_tc_line( tc_line )
, m_par_begin( par_begin )
, m_par_end( par_end )
{}
@@ -87,8 +72,7 @@ public:
if( m_par_begin == m_par_end )
return (test_unit*)0;
- test_func_with_bound_param<ParamType> bound_test_func( m_test_func, *m_par_begin );
- test_unit* res = new test_case( m_tc_name, bound_test_func );
+ test_unit* res = new test_case( m_tc_name, m_tc_file, m_tc_line, boost::bind( m_test_func, *m_par_begin ) );
++m_par_begin;
@@ -97,8 +81,10 @@ public:
private:
// Data members
- callback1<ParamType> m_test_func;
+ boost::function<void (ParamType)> m_test_func;
std::string m_tc_name;
+ const_string m_tc_file;
+ std::size_t m_tc_line;
mutable ParamIter m_par_begin;
ParamIter m_par_end;
};
@@ -126,12 +112,14 @@ struct user_param_tc_method_invoker {
template<typename ParamType, typename ParamIter>
inline ut_detail::param_test_case_generator<ParamType,ParamIter>
-make_test_case( callback1<ParamType> const& test_func,
- const_string tc_name,
- ParamIter par_begin,
- ParamIter par_end )
+make_test_case( boost::function<void (ParamType)> const& test_func,
+ const_string tc_name,
+ const_string tc_file,
+ std::size_t tc_line,
+ ParamIter par_begin,
+ ParamIter par_end )
{
- return ut_detail::param_test_case_generator<ParamType,ParamIter>( test_func, tc_name, par_begin, par_end );
+ return ut_detail::param_test_case_generator<ParamType,ParamIter>( test_func, tc_name, tc_file, tc_line, par_begin, par_end );
}
//____________________________________________________________________________//
@@ -140,12 +128,14 @@ template<typename ParamType, typename ParamIter>
inline ut_detail::param_test_case_generator<
BOOST_DEDUCED_TYPENAME remove_const<BOOST_DEDUCED_TYPENAME remove_reference<ParamType>::type>::type,ParamIter>
make_test_case( void (*test_func)( ParamType ),
- const_string tc_name,
+ const_string tc_name,
+ const_string tc_file,
+ std::size_t tc_line,
ParamIter par_begin,
ParamIter par_end )
{
typedef BOOST_DEDUCED_TYPENAME remove_const<BOOST_DEDUCED_TYPENAME remove_reference<ParamType>::type>::type param_value_type;
- return ut_detail::param_test_case_generator<param_value_type,ParamIter>( test_func, tc_name, par_begin, par_end );
+ return ut_detail::param_test_case_generator<param_value_type,ParamIter>( test_func, tc_name, tc_file, tc_line, par_begin, par_end );
}
//____________________________________________________________________________//
@@ -155,14 +145,18 @@ inline ut_detail::param_test_case_generator<
BOOST_DEDUCED_TYPENAME remove_const<BOOST_DEDUCED_TYPENAME remove_reference<ParamType>::type>::type,ParamIter>
make_test_case( void (UserTestCase::*test_method )( ParamType ),
const_string tc_name,
+ const_string tc_file,
+ std::size_t tc_line,
boost::shared_ptr<UserTestCase> const& user_test_case,
ParamIter par_begin,
ParamIter par_end )
{
typedef BOOST_DEDUCED_TYPENAME remove_const<BOOST_DEDUCED_TYPENAME remove_reference<ParamType>::type>::type param_value_type;
- return ut_detail::param_test_case_generator<param_value_type,ParamIter>(
- ut_detail::user_param_tc_method_invoker<UserTestCase,ParamType>( user_test_case, test_method ),
+ return ut_detail::param_test_case_generator<param_value_type,ParamIter>(
+ ut_detail::user_param_tc_method_invoker<UserTestCase,ParamType>( user_test_case, test_method ),
tc_name,
+ tc_file,
+ tc_line,
par_begin,
par_end );
}
@@ -170,11 +164,8 @@ make_test_case( void (UserTestCase::*test_method )( ParamType ),
//____________________________________________________________________________//
} // unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER
diff --git a/boost/test/predicate_result.hpp b/boost/test/predicate_result.hpp
index 8ac18b754b..fb924c7733 100644
--- a/boost/test/predicate_result.hpp
+++ b/boost/test/predicate_result.hpp
@@ -1,88 +1,14 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2011-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : enhanced result for test predicate that include message explaining failure
+/// @file
+/// @brief Deprecated header
+/// @deprecated Use boost/test/tools/assertion_result.hpp instead
// ***************************************************************************
-#ifndef BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
-#define BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
-
// Boost.Test
-#include <boost/test/utils/class_properties.hpp>
-#include <boost/test/utils/wrap_stringstream.hpp>
-#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
-
-// Boost
-#include <boost/shared_ptr.hpp>
-#include <boost/detail/workaround.hpp>
-
-// STL
-#include <cstddef> // for std::size_t
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace test_tools {
-
-// ************************************************************************** //
-// ************** predicate_result ************** //
-// ************************************************************************** //
-
-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_ )
- : p_predicate_value( pv_ )
- {}
-
- 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;
-
- // Access methods
- bool has_empty_message() const { return !m_message; }
- wrap_stringstream& message()
- {
- if( !m_message )
- m_message.reset( new wrap_stringstream );
-
- return *m_message;
- }
- const_string message() const { return !m_message ? const_string() : const_string( m_message->str() ); }
-
-private:
- // Data members
- shared_ptr<wrap_stringstream> m_message;
-};
-
-} // namespace test_tools
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
+#include <boost/test/tools/assertion_result.hpp>
diff --git a/boost/test/prg_exec_monitor.hpp b/boost/test/prg_exec_monitor.hpp
index 6d65f20776..7234833f72 100644
--- a/boost/test/prg_exec_monitor.hpp
+++ b/boost/test/prg_exec_monitor.hpp
@@ -1,15 +1,20 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Entry point for the end user into the Program Execution Monitor.
+/// @file
+/// @brief Entry point for the end user into the Program Execution Monitor.
+///
+/// Use this header to forward declare function prg_exec_monitor_main and to automatically define a main
+/// function for you. If you prefer to use your own main you are free to do so, but you need to define
+/// BOOST_TEST_NO_MAIN before incuding this header. To initiate your main program body execution you
+/// would use statement like this:
+/// @code ::boost::prg_exec_monitor_main( &my_main, argc, argv ); @endcode
+/// Also this header facilitate auto linking with the Program Execution Monitor library if this feature
+/// is supported
// ***************************************************************************
#ifndef BOOST_PRG_EXEC_MONITOR_HPP_071894GER
@@ -23,7 +28,7 @@
// ************** Auto Linking ************** //
// ************************************************************************** //
-// Automatically link to the correct build variant where possible.
+// Automatically link to the correct build variant where possible.
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \
!defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED)
# define BOOST_LIB_NAME boost_prg_exec_monitor
@@ -41,11 +46,18 @@
// ************** prg_exec_monitor_main ************** //
// ************************************************************************** //
-namespace boost {
+namespace boost {
+/// @brief Wrapper around the main function
+///
+/// Call this routine instead of your own main body implementation directly. This routine impements all the monitoring
+/// functionality. THe monitor behavior is configurable by using the environment variable BOOST_TEST_CATCH_SYSTEM_ERRORS.
+/// If set to string value "no", the monitor will not attempt to catch system errors (signals)
+/// @param[in] cpp_main main function body. Should have the same signature as regular main function
+/// @param[in] argc, argv command line arguments
int BOOST_TEST_DECL prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] );
-}
+} // boost
#if defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN)
@@ -53,7 +65,8 @@ int BOOST_TEST_DECL prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv
// ************** main function for tests using dll ************** //
// ************************************************************************** //
-int cpp_main( int argc, char* argv[] ); // prototype for user's cpp_main()
+// prototype for user's cpp_main()
+int cpp_main( int argc, char* argv[] );
int BOOST_TEST_CALL_DECL
main( int argc, char* argv[] )
diff --git a/boost/test/progress_monitor.hpp b/boost/test/progress_monitor.hpp
index 5bf69257a8..3d66152297 100644
--- a/boost/test/progress_monitor.hpp
+++ b/boost/test/progress_monitor.hpp
@@ -1,22 +1,19 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines simple text based progress monitor
+/// @file
+/// @brief defines simple text based progress monitor
// ***************************************************************************
#ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER
#define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER
// Boost.Test
-#include <boost/test/test_observer.hpp>
+#include <boost/test/tree/observer.hpp>
#include <boost/test/utils/trivial_singleton.hpp>
// STL
@@ -27,39 +24,38 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
// ************** progress_monitor ************** //
// ************************************************************************** //
+/// This class implements test observer interface and updates test progress as test units finish or get aborted
class BOOST_TEST_DECL progress_monitor_t : public test_observer, public singleton<progress_monitor_t> {
public:
- // test observer interface
- void test_start( counter_t test_cases_amount );
- void test_finish() {}
- void test_aborted();
+ /// @name Test observer interface
+ /// @{
+ virtual void test_start( counter_t test_cases_amount );
+ virtual void test_aborted();
- void test_unit_start( test_unit const& ) {}
- void test_unit_finish( test_unit const&, unsigned long );
- void test_unit_skipped( test_unit const& );
- void test_unit_aborted( test_unit const& ) {}
+ virtual void test_unit_finish( test_unit const&, unsigned long );
+ virtual void test_unit_skipped( test_unit const&, const_string );
- void assertion_result( bool ) {}
- void exception_caught( execution_exception const& ) {}
+ virtual int priority() { return 3; }
+ /// @}
- // configuration
- void set_stream( std::ostream& );
+ /// @name Configuration
+ /// @{
+ void set_stream( std::ostream& );
+ /// @}
private:
- BOOST_TEST_SINGLETON_CONS( progress_monitor_t );
+ BOOST_TEST_SINGLETON_CONS( progress_monitor_t )
}; // progress_monitor_t
BOOST_TEST_SINGLETON_INST( progress_monitor )
} // namespace unit_test
-
} // namespace boost
//____________________________________________________________________________//
diff --git a/boost/test/results_collector.hpp b/boost/test/results_collector.hpp
index e4200b025d..f34bf38345 100644
--- a/boost/test/results_collector.hpp
+++ b/boost/test/results_collector.hpp
@@ -1,23 +1,21 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines class unit_test_result that is responsible for
-// gathering test results and presenting this information to end-user
+/// @file results_collector.hpp @brief defines testing result collector components
+///
+/// Defines class results_collector_t that is responsible for
+/// gathering test results and class test_results for presenting this information to end-user
// ***************************************************************************
#ifndef BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
#define BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
// Boost.Test
-#include <boost/test/test_observer.hpp>
+#include <boost/test/tree/observer.hpp>
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/detail/fwd_decl.hpp>
@@ -30,41 +28,60 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
+namespace {
+
// ************************************************************************** //
-// ************** first failed assertion debugger hook ************** //
+/// First failed assertion debugger hook
+///
+/// This function is a placeholder where user can set a breakpoint in debugger to catch the
+/// very first assertion failure in each test case
// ************************************************************************** //
-
-namespace {
inline void first_failed_assertion() {}
}
// ************************************************************************** //
-// ************** test_results ************** //
+/// @brief Collection of attributes constituting test unit results
+///
+/// This class is a collection of attributes describing testing results. The atributes presented as public properties on
+/// an instance of the class. In addition summary conclusion methods are presented to generate simple answer to pass/fail question
// ************************************************************************** //
class BOOST_TEST_DECL test_results {
public:
test_results();
+ /// Type representing counter like public property
typedef BOOST_READONLY_PROPERTY( counter_t, (results_collector_t)(test_results)(results_collect_helper) ) counter_prop;
+ /// Type representing boolean like public property
typedef BOOST_READONLY_PROPERTY( bool, (results_collector_t)(test_results)(results_collect_helper) ) bool_prop;
+ /// @name Public properties
counter_prop p_assertions_passed;
counter_prop p_assertions_failed;
+ counter_prop p_warnings_failed;
counter_prop p_expected_failures;
counter_prop p_test_cases_passed;
+ counter_prop p_test_cases_warned;
counter_prop p_test_cases_failed;
counter_prop p_test_cases_skipped;
counter_prop p_test_cases_aborted;
bool_prop p_aborted;
bool_prop p_skipped;
+ /// @}
+
+ /// @name Summary conclusion
- // "conclusion" methods
+ /// Returns true if test unit passed
bool passed() const;
+ /// Produces result code for the test unit execution
+
+ /// This methhod return one of the result codes defined in boost/cstdlib.hpp
+ /// @returns boost::exit_success on success, boost::exit_exception_failure in case test unit was aborted for any reason
+ /// (incuding uncausght exception) and boost::exit_test_failure otherwise
int result_code() const;
+ /// @}
// collection helper
void operator+=( test_results const& );
@@ -73,39 +90,38 @@ public:
};
// ************************************************************************** //
-// ************** results_collector ************** //
+/// This class implements test observer interface to collect the result of test unit execution
// ************************************************************************** //
class BOOST_TEST_DECL results_collector_t : public test_observer, public singleton<results_collector_t> {
public:
- // test_observer interface implementation
- void test_start( counter_t test_cases_amount );
- void test_finish();
- void test_aborted();
- void test_unit_start( test_unit const& );
- void test_unit_finish( test_unit const&, unsigned long elapsed );
- void test_unit_skipped( test_unit const& );
- void test_unit_aborted( test_unit const& );
+ virtual void test_start( counter_t test_cases_amount );
+
+ virtual void test_unit_start( test_unit const& );
+ virtual void test_unit_finish( test_unit const&, unsigned long );
+ virtual void test_unit_skipped( test_unit const&, const_string );
+ virtual void test_unit_aborted( test_unit const& );
+
+ virtual void assertion_result( unit_test::assertion_result );
+ virtual void exception_caught( execution_exception const& );
+
+ virtual int priority() { return 2; }
- void assertion_result( bool passed );
- void exception_caught( execution_exception const& );
+ /// Results access per test unit
- // results access
- test_results const& results( test_unit_id ) const;
+ /// @param[in] tu_id id of a test unit
+ test_results const& results( test_unit_id tu_id ) const;
private:
- BOOST_TEST_SINGLETON_CONS( results_collector_t );
+ BOOST_TEST_SINGLETON_CONS( results_collector_t )
};
BOOST_TEST_SINGLETON_INST( results_collector )
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
diff --git a/boost/test/results_reporter.hpp b/boost/test/results_reporter.hpp
index 862c622a68..4c8627e458 100644
--- a/boost/test/results_reporter.hpp
+++ b/boost/test/results_reporter.hpp
@@ -1,16 +1,15 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines class unit_test_result that is responsible for
-// gathering test results and presenting this information to end-user
+/// @file
+/// @brief defines testing result reporter interfaces
+///
+/// This file defines interfaces that are responsible for results reporting. Interface is presented in a form of
+/// free standing function implemented in namespace result_reporter
// ***************************************************************************
#ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER
@@ -28,13 +27,17 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
+/// Namespace for results reporter interfaces
namespace results_reporter {
// ************************************************************************** //
-// ************** formatter interface ************** //
+/// @brief Results report formatter interface
+///
+/// This is abstract interface for the report formatter used by results reporter routines.
+/// You can define a custom formatter by implementing this interface and setting the formatter using set_format function.
+/// This is usually done during test module initialization
// ************************************************************************** //
class BOOST_TEST_DECL format {
@@ -52,22 +55,57 @@ public:
};
// ************************************************************************** //
-// ************** report configuration ************** //
+/// @name report configuration
// ************************************************************************** //
-BOOST_TEST_DECL void set_level( report_level );
+/// Sets reporting level
+
+/// There are only four possible levels for results report:
+/// - confirmation report (boost::unit_test::CONFIRMATION_REPORT). This report level only produces short confirmation
+/// message about test module pass/fail status
+/// - short report (boost::unit_test::SHORT_REPORT). This report level produces short summary report for failed/passed
+/// assertions and test units.
+/// - detailed report (boost::unit_test::DETAILED_REPORT). This report level produces detailed report per test unit for
+/// passed/failed assertions and uncaught exceptions
+/// - no report (boost::unit_test::NO_REPORT). This report level produces no results report. This is used for test modules
+/// running as part of some kind of continues integration framework
+/// @param[in] l report level
+BOOST_TEST_DECL void set_level( report_level l );
+
+/// Sets output stream for results reporting
+
+/// By default std::cerr is used. Use this function to set a different stream. The framework
+/// refers to the stream by reference, so you need to make sure the stream object lifetime exceeds the testing main scope.
BOOST_TEST_DECL void set_stream( std::ostream& );
-BOOST_TEST_DECL void set_format( output_format );
-BOOST_TEST_DECL void set_format( results_reporter::format* );
+/// Sets one of the predefined formats
+
+/// The framework implements two results report formats:
+/// - plain human readable format (boost::unit_test::OF_CLF)
+/// - XML format (boost::unit_test::OF_XML)
+/// @param[in] of one of the presefined enumeration values for output formats
+BOOST_TEST_DECL void set_format( output_format of );
+
+/// Sets custom report formatter
+
+/// The framework takes ownership of the pointer passed as an argument. So this should be a pointer to
+/// a heap allocated object
+/// @param[in] f pointer to heap allocated instance of custom report formatter class
+BOOST_TEST_DECL void set_format( results_reporter::format* f );
+
+/// @brief Access to configured results reporter stream
+///
+/// Use this stream to report additional information abut test module execution
BOOST_TEST_DECL std::ostream& get_stream();
+/// @}
+
// ************************************************************************** //
// ************** report initiation ************** //
// ************************************************************************** //
BOOST_TEST_DECL void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID );
-inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID )
+inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID )
{ make_report( CONFIRMATION_REPORT, id ); }
inline void short_report( test_unit_id id = INV_TEST_UNIT_ID )
{ make_report( SHORT_REPORT, id ); }
@@ -75,13 +113,9 @@ inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID )
{ make_report( DETAILED_REPORT, id ); }
} // namespace results_reporter
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER
diff --git a/boost/test/test_case_template.hpp b/boost/test/test_case_template.hpp
index 8c64f1ce00..77adf6cc8c 100644
--- a/boost/test/test_case_template.hpp
+++ b/boost/test/test_case_template.hpp
@@ -1,15 +1,13 @@
-// (C) Copyright Gennadiy Rozental 2003-2008.
+// (C) Copyright Gennadiy Rozental 2003-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : deprecated
+/// @file
+/// @brief Deprecated header.
+/// @deprecated Use @c boost/test/unit_test.hpp instead
// ***************************************************************************
#include <boost/test/unit_test.hpp>
diff --git a/boost/test/test_exec_monitor.hpp b/boost/test/test_exec_monitor.hpp
index 13802ed1d5..af81aa0296 100644
--- a/boost/test/test_exec_monitor.hpp
+++ b/boost/test/test_exec_monitor.hpp
@@ -1,15 +1,32 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Entry point for the end user into the Test Execution Monitor.
+/// @file
+/// @brief Deprecated implementation of Test Execution Monitor
+///
+/// To convert to Unit Test Framework simply rewrite:
+/// @code
+/// #include <boost/test/test_exec_monitor.hpp>
+///
+/// int test_main( int, char *[] )
+/// {
+/// ...
+/// }
+/// @endcode
+/// as
+/// @code
+/// #include <boost/test/unit_test.hpp>
+///
+/// BOOST_AUTO_TEST_CASE(test_main)
+/// {
+/// ...
+/// }
+/// @endcode
+/// and link with boost_unit_test_framework library *instead of* boost_test_exec_monitor
// ***************************************************************************
#ifndef BOOST_TEST_EXEC_MONITOR_HPP_071894GER
@@ -24,7 +41,7 @@
// ************** Auto Linking ************** //
// ************************************************************************** //
-// Automatically link to the correct build variant where possible.
+// Automatically link to the correct build variant where possible.
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \
!defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED)
diff --git a/boost/test/test_tools.hpp b/boost/test/test_tools.hpp
index 2800ac0616..dea2b20fa2 100644
--- a/boost/test/test_tools.hpp
+++ b/boost/test/test_tools.hpp
@@ -1,719 +1,61 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : contains definition for all test tools in test toolbox
+/// @file
+/// @brief test tools compatibility header
+///
+/// This file is used to select the test tools implementation and includes all the necessary headers
// ***************************************************************************
-#ifndef BOOST_TEST_TEST_TOOLS_HPP_012705GER
-#define BOOST_TEST_TEST_TOOLS_HPP_012705GER
-
-// Boost.Test
-#include <boost/test/predicate_result.hpp>
-#include <boost/test/unit_test_log.hpp>
-#include <boost/test/floating_point_comparison.hpp>
-
-#include <boost/test/detail/config.hpp>
-#include <boost/test/detail/global_typedef.hpp>
-#include <boost/test/detail/workaround.hpp>
-
-#include <boost/test/utils/wrap_stringstream.hpp>
-#include <boost/test/utils/basic_cstring/io.hpp>
-#include <boost/test/utils/lazy_ostream.hpp>
-
-// Boost
-#include <boost/preprocessor/seq/for_each.hpp>
-#include <boost/preprocessor/seq/size.hpp>
-#include <boost/preprocessor/seq/enum.hpp>
-#include <boost/preprocessor/repetition/repeat.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/arithmetic/add.hpp>
-
-#include <boost/limits.hpp>
-
-#include <boost/type_traits/is_array.hpp>
-#include <boost/type_traits/is_function.hpp>
-#include <boost/type_traits/is_abstract.hpp>
-
-#include <boost/mpl/or.hpp>
-
-// STL
-#include <cstddef> // for std::size_t
-#include <iosfwd>
-#include <ios> // for std::boolalpha
-#include <climits> // for CHAR_BIT
-
-#ifdef BOOST_MSVC
-# pragma warning(disable: 4127) // conditional expression is constant
-#endif
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** TOOL BOX ************** //
-// ************************************************************************** //
-
-// In macros below following argument abbreviations are used:
-// P - predicate
-// M - message
-// S - statement
-// E - exception
-// L - left argument
-// R - right argument
-// TL - tool level
-// CT - check type
-// ARGS - arguments list
-
-#define BOOST_TEST_TOOL_IMPL( func, P, check_descr, TL, CT ) \
- ::boost::test_tools::tt_detail::func( \
- P, \
- ::boost::unit_test::lazy_ostream::instance() << check_descr, \
- BOOST_TEST_L(__FILE__), \
- static_cast<std::size_t>(__LINE__), \
- ::boost::test_tools::tt_detail::TL, \
- ::boost::test_tools::tt_detail::CT \
-/**/
-
-//____________________________________________________________________________//
-
-#define BOOST_CHECK_IMPL( P, check_descr, TL, CT ) \
-do { \
- BOOST_TEST_PASSPOINT(); \
- BOOST_TEST_TOOL_IMPL( check_impl, P, check_descr, TL, CT ), 0 );\
-} while( ::boost::test_tools::dummy_cond ) \
-/**/
-
-//____________________________________________________________________________//
-
-#define BOOST_TEST_PASS_ARG_INFO( r, data, arg ) , arg, BOOST_STRINGIZE( arg )
-
-#define BOOST_CHECK_WITH_ARGS_IMPL( P, check_descr, TL, CT, ARGS ) \
-do { \
- BOOST_TEST_PASSPOINT(); \
- BOOST_TEST_TOOL_IMPL( check_frwd, P, check_descr, TL, CT ) \
- BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_PASS_ARG_INFO, '_', ARGS ) ); \
-} while( ::boost::test_tools::dummy_cond ) \
-/**/
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN( P ) BOOST_CHECK_IMPL( (P), BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED )
-#define BOOST_CHECK( P ) BOOST_CHECK_IMPL( (P), BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED )
-#define BOOST_REQUIRE( P ) BOOST_CHECK_IMPL( (P), BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_MESSAGE( P, M ) BOOST_CHECK_IMPL( (P), M, WARN, CHECK_MSG )
-#define BOOST_CHECK_MESSAGE( P, M ) BOOST_CHECK_IMPL( (P), M, CHECK, CHECK_MSG )
-#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_CHECK_IMPL( (P), M, REQUIRE, CHECK_MSG )
-
-//____________________________________________________________________________//
-
-#define BOOST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M )
-#define BOOST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M )
-
-//____________________________________________________________________________//
-
-#define BOOST_CHECK_THROW_IMPL( S, E, P, prefix, TL ) \
- try { \
- BOOST_TEST_PASSPOINT(); \
- S; \
- BOOST_CHECK_IMPL( false, "exception " BOOST_STRINGIZE( E ) " is expected", TL, CHECK_MSG ); } \
- catch( E const& ex ) { \
- ::boost::unit_test::ut_detail::ignore_unused_variable_warning( ex ); \
- BOOST_CHECK_IMPL( P, prefix BOOST_STRINGIZE( E ) " is caught", TL, CHECK_MSG ); \
- } \
-/**/
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "exception ", WARN )
-#define BOOST_CHECK_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "exception ", CHECK )
-#define BOOST_REQUIRE_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "exception ", REQUIRE )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), "incorrect exception ", WARN )
-#define BOOST_CHECK_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), "incorrect exception ", CHECK )
-#define BOOST_REQUIRE_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), "incorrect exception ", REQUIRE )
-
-//____________________________________________________________________________//
-
-#define BOOST_CHECK_NO_THROW_IMPL( S, TL ) \
- try { \
- S; \
- BOOST_CHECK_IMPL( true, "no exceptions thrown by " BOOST_STRINGIZE( S ), TL, CHECK_MSG ); } \
- catch( ... ) { \
- BOOST_CHECK_IMPL( false, "exception thrown by " BOOST_STRINGIZE( S ), TL, CHECK_MSG ); \
- } \
-/**/
-
-#define BOOST_WARN_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, WARN )
-#define BOOST_CHECK_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, CHECK )
-#define BOOST_REQUIRE_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, REQUIRE )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_EQUAL( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::equal_impl_frwd(), "", WARN, CHECK_EQUAL, (L)(R) )
-#define BOOST_CHECK_EQUAL( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK, CHECK_EQUAL, (L)(R) )
-#define BOOST_REQUIRE_EQUAL( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::equal_impl_frwd(), "", REQUIRE, CHECK_EQUAL, (L)(R) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_NE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ne_impl(), "", WARN, CHECK_NE, (L)(R) )
-#define BOOST_CHECK_NE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ne_impl(), "", CHECK, CHECK_NE, (L)(R) )
-#define BOOST_REQUIRE_NE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ne_impl(), "", REQUIRE, CHECK_NE, (L)(R) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_LT( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::lt_impl(), "", WARN, CHECK_LT, (L)(R) )
-#define BOOST_CHECK_LT( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::lt_impl(), "", CHECK, CHECK_LT, (L)(R) )
-#define BOOST_REQUIRE_LT( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::lt_impl(), "", REQUIRE, CHECK_LT, (L)(R) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_LE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::le_impl(), "", WARN, CHECK_LE, (L)(R) )
-#define BOOST_CHECK_LE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::le_impl(), "", CHECK, CHECK_LE, (L)(R) )
-#define BOOST_REQUIRE_LE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::le_impl(), "", REQUIRE, CHECK_LE, (L)(R) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_GT( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::gt_impl(), "", WARN, CHECK_GT, (L)(R) )
-#define BOOST_CHECK_GT( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::gt_impl(), "", CHECK, CHECK_GT, (L)(R) )
-#define BOOST_REQUIRE_GT( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::gt_impl(), "", REQUIRE, CHECK_GT, (L)(R) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_GE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ge_impl(), "", WARN, CHECK_GE, (L)(R) )
-#define BOOST_CHECK_GE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ge_impl(), "", CHECK, CHECK_GE, (L)(R) )
-#define BOOST_REQUIRE_GE( L, R ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::tt_detail::ge_impl(), "", REQUIRE, CHECK_GE, (L)(R) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_CLOSE( L, R, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", WARN, CHECK_CLOSE, \
- (L)(R)(::boost::test_tools::percent_tolerance(T)) )
-#define BOOST_CHECK_CLOSE( L, R, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", CHECK, CHECK_CLOSE, \
- (L)(R)(::boost::test_tools::percent_tolerance(T)) )
-#define BOOST_REQUIRE_CLOSE( L, R, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", REQUIRE, CHECK_CLOSE, \
- (L)(R)(::boost::test_tools::percent_tolerance(T)) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_CLOSE_FRACTION( L, R, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", WARN, CHECK_CLOSE_FRACTION, \
- (L)(R)(::boost::test_tools::fraction_tolerance(T)) )
-#define BOOST_CHECK_CLOSE_FRACTION( L, R, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", CHECK, CHECK_CLOSE_FRACTION, \
- (L)(R)(::boost::test_tools::fraction_tolerance(T)) )
-#define BOOST_REQUIRE_CLOSE_FRACTION( L, R, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_close, "", REQUIRE, CHECK_CLOSE_FRACTION, \
- (L)(R)(::boost::test_tools::fraction_tolerance(T)) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_SMALL( FPV, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_small, "", WARN, CHECK_SMALL, (FPV)(T) )
-#define BOOST_CHECK_SMALL( FPV, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_small, "", CHECK, CHECK_SMALL, (FPV)(T) )
-#define BOOST_REQUIRE_SMALL( FPV, T ) \
- BOOST_CHECK_WITH_ARGS_IMPL( ::boost::test_tools::check_is_small, "", REQUIRE, CHECK_SMALL, (FPV)(T) )
-
-//____________________________________________________________________________//
-
-#define BOOST_WARN_PREDICATE( P, ARGS ) \
- BOOST_CHECK_WITH_ARGS_IMPL( P, BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED_WITH_ARGS, ARGS )
-#define BOOST_CHECK_PREDICATE( P, ARGS ) \
- BOOST_CHECK_WITH_ARGS_IMPL( P, BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED_WITH_ARGS, ARGS )
-#define BOOST_REQUIRE_PREDICATE( P, ARGS ) \
- BOOST_CHECK_WITH_ARGS_IMPL( P, BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED_WITH_ARGS, ARGS )
-
-//____________________________________________________________________________//
-
-#define BOOST_EQUAL_COLLECTIONS_IMPL( L_begin, L_end, R_begin, R_end, TL ) \
- BOOST_TEST_TOOL_IMPL( check_impl, ::boost::test_tools::tt_detail::equal_coll_impl( \
- (L_begin), (L_end), (R_begin), (R_end) ), "", TL, CHECK_EQUAL_COLL ), \
- 4, \
- BOOST_STRINGIZE( L_begin ), BOOST_STRINGIZE( L_end ), \
- BOOST_STRINGIZE( R_begin ), BOOST_STRINGIZE( R_end ) ) \
-/**/
-
-#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
- BOOST_EQUAL_COLLECTIONS_IMPL( L_begin, L_end, R_begin, R_end, WARN )
-#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
- BOOST_EQUAL_COLLECTIONS_IMPL( L_begin, L_end, R_begin, R_end, CHECK )
-#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
- BOOST_EQUAL_COLLECTIONS_IMPL( L_begin, L_end, R_begin, R_end, REQUIRE )
-
-//____________________________________________________________________________//
-
-#define BOOST_BITWISE_EQUAL_IMPL( L, R, TL ) \
- BOOST_TEST_TOOL_IMPL( check_impl, \
- ::boost::test_tools::tt_detail::bitwise_equal_impl( (L), (R) ), \
- "", TL, CHECK_BITWISE_EQUAL ), \
- 2, BOOST_STRINGIZE( L ), BOOST_STRINGIZE( R ) ) \
-/**/
-
-#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_BITWISE_EQUAL_IMPL( L, R, WARN )
-#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_BITWISE_EQUAL_IMPL( L, R, CHECK )
-#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_BITWISE_EQUAL_IMPL( L, R, REQUIRE )
-
-//____________________________________________________________________________//
-
-#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) )
-
-//____________________________________________________________________________//
-
-// ***************************** //
-// deprecated interface
-
-#define BOOST_BITWISE_EQUAL( L, R ) BOOST_CHECK_BITWISE_EQUAL( L, R )
-#define BOOST_MESSAGE( M ) BOOST_TEST_MESSAGE( M )
-#define BOOST_CHECKPOINT( M ) BOOST_TEST_CHECKPOINT( M )
-
-namespace boost {
-
-namespace test_tools {
-
-typedef unit_test::const_string const_string;
-
-namespace { bool dummy_cond = false; }
-
-// ************************************************************************** //
-// ************** print_log_value ************** //
-// ************************************************************************** //
-
-template<typename T>
-struct print_log_value {
- void operator()( std::ostream& ostr, T const& t )
- {
- // 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 cant_use_nl;
-
- set_precision( ostr, cant_use_nl() );
-
- ostr << t; // by default print the value
- }
+#ifndef BOOST_TEST_TOOLS_HPP_111812GER
+#define BOOST_TEST_TOOLS_HPP_111812GER
- void set_precision( std::ostream& ostr, mpl::false_ )
- {
- if( std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 2 )
- ostr.precision( 2 + std::numeric_limits<T>::digits * 301/1000 );
- }
+#include <boost/config.hpp>
+#include <boost/preprocessor/config/config.hpp>
- void set_precision( std::ostream&, mpl::true_ ) {}
-};
-
-//____________________________________________________________________________//
-
-#define BOOST_TEST_DONT_PRINT_LOG_VALUE( the_type ) \
-namespace boost { namespace test_tools { \
-template<> \
-struct print_log_value<the_type > { \
- void operator()( std::ostream&, the_type const& ) {} \
-}; \
-}} \
-/**/
-
-//____________________________________________________________________________//
-
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-template<typename T, std::size_t N >
-struct print_log_value< T[N] > {
- void operator()( std::ostream& ostr, T const* t )
- {
- ostr << t;
- }
-};
+#if !BOOST_PP_VARIADICS || ((__cplusplus >= 201103L) && defined(BOOST_NO_CXX11_VARIADIC_MACROS))
+#define BOOST_TEST_NO_VARIADIC
#endif
-//____________________________________________________________________________//
-
-template<>
-struct BOOST_TEST_DECL print_log_value<bool> {
- void operator()( std::ostream& ostr, bool t )
- {
- ostr << std::boolalpha << t;
- }
-};
-
-//____________________________________________________________________________//
-
-template<>
-struct BOOST_TEST_DECL print_log_value<char> {
- void operator()( std::ostream& ostr, char t );
-};
-
-//____________________________________________________________________________//
-
-template<>
-struct BOOST_TEST_DECL print_log_value<unsigned char> {
- void operator()( std::ostream& ostr, unsigned char t );
-};
-
-//____________________________________________________________________________//
-
-template<>
-struct BOOST_TEST_DECL print_log_value<char const*> {
- void operator()( std::ostream& ostr, char const* t );
-};
-
-//____________________________________________________________________________//
-
-template<>
-struct BOOST_TEST_DECL print_log_value<wchar_t const*> {
- void operator()( std::ostream& ostr, wchar_t const* t );
-};
-
-//____________________________________________________________________________//
-
-namespace tt_detail {
-
-// ************************************************************************** //
-// ************** tools classification ************** //
-// ************************************************************************** //
-
-enum check_type {
- CHECK_PRED,
- CHECK_MSG,
- CHECK_EQUAL,
- CHECK_NE,
- CHECK_LT,
- CHECK_LE,
- CHECK_GT,
- CHECK_GE,
- CHECK_CLOSE,
- CHECK_CLOSE_FRACTION,
- CHECK_SMALL,
- CHECK_BITWISE_EQUAL,
- CHECK_PRED_WITH_ARGS,
- CHECK_EQUAL_COLL
-};
-
-enum tool_level {
- WARN, CHECK, REQUIRE, PASS
-};
-
-// ************************************************************************** //
-// ************** print_helper ************** //
-// ************************************************************************** //
-// Adds level of indirection to the output operation, allowing us to customize
-// it for types that do not support operator << directly or for any other reason
-
-template<typename T>
-struct print_helper_t {
- explicit print_helper_t( T const& t ) : m_t( t ) {}
-
- T const& m_t;
-};
-
-//____________________________________________________________________________//
-
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-// Borland suffers premature pointer decay passing arrays by reference
-template<typename T, std::size_t N >
-struct print_helper_t< T[N] > {
- explicit print_helper_t( T const * t ) : m_t( t ) {}
+// Boost.Test
+// #define BOOST_TEST_NO_OLD_TOOLS
- T const * m_t;
-};
+#if defined(BOOST_TEST_NO_VARIADIC)
+# define BOOST_TEST_NO_NEW_TOOLS
#endif
-//____________________________________________________________________________//
-
-template<typename T>
-inline print_helper_t<T> print_helper( T const& t )
-{
- return print_helper_t<T>( t );
-}
-
-//____________________________________________________________________________//
-
-template<typename T>
-inline std::ostream&
-operator<<( std::ostream& ostr, print_helper_t<T> const& ph )
-{
- print_log_value<T>()( ostr, ph.m_t );
-
- return ostr;
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** TOOL BOX Implementation ************** //
-// ************************************************************************** //
+// #define BOOST_TEST_TOOLS_UNDER_DEBUGGER
+// #define BOOST_TEST_TOOLS_DEBUGGABLE
-BOOST_TEST_DECL
-bool check_impl( predicate_result const& pr, ::boost::unit_test::lazy_ostream const& check_descr,
- const_string file_name, std::size_t line_num,
- tool_level tl, check_type ct,
- std::size_t num_args, ... );
+#include <boost/test/tools/context.hpp>
-//____________________________________________________________________________//
+#ifndef BOOST_TEST_NO_OLD_TOOLS
+# include <boost/test/tools/old/interface.hpp>
+# include <boost/test/tools/old/impl.hpp>
-#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 ) \
-/**/
-
-#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 ) \
- , &static_cast<const unit_test::lazy_ostream&>(unit_test::lazy_ostream::instance() \
- << ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \
-/**/
-
-#define IMPL_FRWD( z, n, dummy ) \
-template<typename Pred \
- BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), TEMPL_PARAMS, _ )> \
-inline bool \
-check_frwd( Pred P, unit_test::lazy_ostream const& check_descr, \
- const_string file_name, std::size_t line_num, \
- tool_level tl, check_type ct \
- BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), FUNC_PARAMS, _ ) \
-) \
-{ \
- return \
- check_impl( P( BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), PRED_PARAMS, _ ) ), \
- check_descr, file_name, line_num, tl, ct, \
- BOOST_PP_ADD( n, 1 ) \
- BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), ARG_INFO, _ ) \
- ); \
-} \
-/**/
-
-#ifndef BOOST_TEST_MAX_PREDICATE_ARITY
-#define BOOST_TEST_MAX_PREDICATE_ARITY 5
+# include <boost/test/tools/detail/print_helper.hpp>
#endif
-BOOST_PP_REPEAT( BOOST_TEST_MAX_PREDICATE_ARITY, IMPL_FRWD, _ )
-
-#undef TEMPL_PARAMS
-#undef FUNC_PARAMS
-#undef PRED_INFO
-#undef ARG_INFO
-#undef IMPL_FRWD
-
-//____________________________________________________________________________//
-
-template <class Left, class Right>
-predicate_result equal_impl( Left const& left, Right const& right )
-{
- return left == right;
-}
-
-//____________________________________________________________________________//
-
-predicate_result BOOST_TEST_DECL equal_impl( char const* left, char const* right );
-inline predicate_result equal_impl( char* left, char const* right ) { return equal_impl( 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( 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) ); }
+#ifndef BOOST_TEST_NO_NEW_TOOLS
+# include <boost/test/tools/interface.hpp>
+# include <boost/test/tools/assertion.hpp>
+# include <boost/test/tools/fpc_op.hpp>
+# include <boost/test/tools/collection_comparison_op.hpp>
+# include <boost/test/tools/cstring_comparison_op.hpp>
+
+# include <boost/test/tools/detail/fwd.hpp>
+# include <boost/test/tools/detail/print_helper.hpp>
+# include <boost/test/tools/detail/it_pair.hpp>
+
+# include <boost/test/tools/detail/bitwise_manip.hpp>
+# include <boost/test/tools/detail/tolerance_manip.hpp>
+# include <boost/test/tools/detail/per_element_manip.hpp>
+# include <boost/test/tools/detail/lexicographic_manip.hpp>
#endif
-//____________________________________________________________________________//
-
-struct equal_impl_frwd {
- template <typename Left, typename Right>
- inline predicate_result
- call_impl( Left const& left, Right const& right, mpl::false_ ) const
- {
- return equal_impl( left, right );
- }
-
- template <typename Left, typename Right>
- inline predicate_result
- call_impl( Left const& left, Right const& right, mpl::true_ ) const
- {
- return (*this)( right, &left[0] );
- }
-
- template <typename Left, typename Right>
- inline predicate_result
- operator()( Left const& left, Right const& right ) const
- {
- typedef typename is_array<Left>::type left_is_array;
- return call_impl( left, right, left_is_array() );
- }
-};
-
-//____________________________________________________________________________//
-
-struct ne_impl {
- template <class Left, class Right>
- predicate_result operator()( Left const& left, Right const& right )
- {
- return !equal_impl_frwd()( left, right );
- }
-};
-
-//____________________________________________________________________________//
-
-struct lt_impl {
- template <class Left, class Right>
- predicate_result operator()( Left const& left, Right const& right )
- {
- return left < right;
- }
-};
-
-//____________________________________________________________________________//
-
-struct le_impl {
- template <class Left, class Right>
- predicate_result operator()( Left const& left, Right const& right )
- {
- return left <= right;
- }
-};
-
-//____________________________________________________________________________//
-
-struct gt_impl {
- template <class Left, class Right>
- predicate_result operator()( Left const& left, Right const& right )
- {
- return left > right;
- }
-};
-
-//____________________________________________________________________________//
-
-struct ge_impl {
- template <class Left, class Right>
- predicate_result operator()( Left const& left, Right const& right )
- {
- return left >= right;
- }
-};
-
-//____________________________________________________________________________//
-
-template <typename Left, typename Right>
-inline predicate_result
-equal_coll_impl( Left left_begin, Left left_end, Right right_begin, Right right_end )
-{
- predicate_result res( true );
- std::size_t pos = 0;
-
- for( ; left_begin != left_end && right_begin != right_end; ++left_begin, ++right_begin, ++pos ) {
- if( *left_begin != *right_begin ) {
- res = false;
- res.message() << "\nMismatch in a position " << pos << ": " << *left_begin << " != " << *right_begin;
- }
- }
-
- if( left_begin != left_end ) {
- std::size_t r_size = pos;
- while( left_begin != left_end ) {
- ++pos;
- ++left_begin;
- }
-
- res = false;
- res.message() << "\nCollections size mismatch: " << pos << " != " << r_size;
- }
-
- if( right_begin != right_end ) {
- std::size_t l_size = pos;
- while( right_begin != right_end ) {
- ++pos;
- ++right_begin;
- }
-
- res = false;
- res.message() << "\nCollections size mismatch: " << l_size << " != " << pos;
- }
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-template <class Left, class Right>
-inline predicate_result
-bitwise_equal_impl( Left const& left, Right const& right )
-{
- predicate_result res( true );
-
- std::size_t left_bit_size = sizeof(Left)*CHAR_BIT;
- std::size_t right_bit_size = sizeof(Right)*CHAR_BIT;
-
- static Left const leftOne( 1 );
- static Right const rightOne( 1 );
-
- std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size;
-
- for( std::size_t counter = 0; counter < total_bits; ++counter ) {
- if( ( left & ( leftOne << counter ) ) != ( right & ( rightOne << counter ) ) ) {
- res = false;
- res.message() << "\nMismatch in a position " << counter;
- }
- }
-
- if( left_bit_size != right_bit_size ) {
- res = false;
- res.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size;
- }
-
- return res;
-}
-
-//____________________________________________________________________________//
-
-bool BOOST_TEST_DECL is_defined_impl( const_string symbol_name, const_string symbol_value );
-
-//____________________________________________________________________________//
-
-} // namespace tt_detail
-
-} // namespace test_tools
-
-namespace test_toolbox = test_tools;
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_TEST_TOOLS_HPP_012705GER
+#endif // BOOST_TEST_TOOLS_HPP_111812GER
diff --git a/boost/test/tools/assertion.hpp b/boost/test/tools/assertion.hpp
new file mode 100644
index 0000000000..b46b6760e7
--- /dev/null
+++ b/boost/test/tools/assertion.hpp
@@ -0,0 +1,407 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief Defines framework for automated assertion construction
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER
+#define BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER
+
+// Boost.Test
+#include <boost/test/tools/assertion_result.hpp>
+#include <boost/test/tools/detail/print_helper.hpp>
+#include <boost/test/tools/detail/fwd.hpp>
+
+// Boost
+#include <boost/type.hpp>
+#include <boost/type_traits/decay.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/utility/declval.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+// STL
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+#include <utility>
+#endif
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace assertion {
+
+// ************************************************************************** //
+// ************** assertion::operators ************** //
+// ************************************************************************** //
+// precedence 4: ->*, .*
+// precedence 5: *, /, %
+// precedence 6: +, -
+// precedence 7: << , >>
+// precedence 8: <, <=, > and >=
+// precedence 9: == and !=
+// precedence 10: bitwise AND
+// precedence 11: bitwise XOR
+// precedence 12: bitwise OR
+// precedence 13: logical AND
+// disabled
+// precedence 14: logical OR
+// disabled
+// precedence 15: ternary conditional
+// disabled
+// precedence 16: = and OP= operators
+// precedence 17: throw operator
+// not supported
+// precedence 18: comma
+// not supported
+
+namespace op {
+
+#define BOOST_TEST_FOR_EACH_COMP_OP(action) \
+ action( < , LT, >= ) \
+ action( <=, LE, > ) \
+ action( > , GT, <= ) \
+ action( >=, GE, < ) \
+ action( ==, EQ, != ) \
+ action( !=, NE, == ) \
+/**/
+
+//____________________________________________________________________________//
+
+#ifndef BOOST_NO_CXX11_DECLTYPE
+
+#define BOOST_TEST_FOR_EACH_CONST_OP(action)\
+ action(->*, MEMP, ->* ) \
+ \
+ action( * , MUL, * ) \
+ action( / , DIV, / ) \
+ action( % , MOD, % ) \
+ \
+ action( + , ADD, + ) \
+ action( - , SUB, - ) \
+ \
+ action( <<, LSH, << ) \
+ action( >>, RSH, >> ) \
+ \
+ BOOST_TEST_FOR_EACH_COMP_OP(action) \
+ \
+ action( & , BAND, & ) \
+ action( ^ , XOR, ^ ) \
+ action( | , BOR, | ) \
+/**/
+
+#else
+
+#define BOOST_TEST_FOR_EACH_CONST_OP(action)\
+ BOOST_TEST_FOR_EACH_COMP_OP(action) \
+/**/
+
+#endif
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_FOR_EACH_MUT_OP(action) \
+ action( = , SET , = ) \
+ action( +=, IADD, += ) \
+ action( -=, ISUB, -= ) \
+ action( *=, IMUL, *= ) \
+ action( /=, IDIV, /= ) \
+ action( %=, IMOD, %= ) \
+ action(<<=, ILSH, <<=) \
+ action(>>=, IRSH, >>=) \
+ action( &=, IAND, &= ) \
+ action( ^=, IXOR, ^= ) \
+ action( |=, IOR , |= ) \
+/**/
+
+//____________________________________________________________________________//
+
+#ifndef BOOST_NO_CXX11_DECLTYPE
+# define DEDUCE_RESULT_TYPE( oper ) \
+ decltype(boost::declval<Lhs>() oper boost::declval<Rhs>() ) optype; \
+ typedef typename boost::remove_reference<optype>::type \
+/**/
+#else
+# define DEDUCE_RESULT_TYPE( oper ) bool
+#endif
+
+#define DEFINE_CONST_OPER( oper, name, rev ) \
+template<typename Lhs, typename Rhs, \
+ typename Enabler=void> \
+struct name { \
+ typedef DEDUCE_RESULT_TYPE( oper ) result_type; \
+ \
+ static result_type \
+ eval( Lhs const& lhs, Rhs const& rhs ) \
+ { \
+ return lhs oper rhs; \
+ } \
+ \
+ template<typename PrevExprType> \
+ static void \
+ report( std::ostream& ostr, \
+ PrevExprType const& lhs, \
+ Rhs const& rhs) \
+ { \
+ lhs.report( ostr ); \
+ ostr << revert() \
+ << tt_detail::print_helper( rhs ); \
+ } \
+ \
+ static char const* revert() \
+ { return " " #rev " "; } \
+}; \
+/**/
+
+BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER )
+
+#undef DEDUCE_RESULT_TYPE
+#undef DEFINE_CONST_OPER
+
+//____________________________________________________________________________//
+
+} // namespace op
+
+// ************************************************************************** //
+// ************** assertion::expression_base ************** //
+// ************************************************************************** //
+// Defines expression operators
+
+template<typename Lhs, typename Rhs, typename OP> class binary_expr;
+
+template<typename ExprType,typename ValType>
+class expression_base {
+public:
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+
+#define ADD_OP_SUPPORT( oper, name, _ ) \
+ template<typename T> \
+ binary_expr<ExprType,T, \
+ op::name<ValType,typename remove_reference<T>::type> > \
+ operator oper( T&& rhs ) \
+ { \
+ return binary_expr<ExprType,T, \
+ op::name<ValType,typename remove_reference<T>::type> > \
+ ( std::forward<ExprType>( \
+ *static_cast<ExprType*>(this) ), \
+ std::forward<T>(rhs) ); \
+ } \
+/**/
+#else
+
+#define ADD_OP_SUPPORT( oper, name, _ ) \
+ template<typename T> \
+ binary_expr<ExprType,typename boost::decay<T const>::type, \
+ op::name<ValType,typename boost::decay<T const>::type> > \
+ operator oper( T const& rhs ) const \
+ { \
+ typedef typename boost::decay<T const>::type Rhs; \
+ return binary_expr<ExprType,Rhs,op::name<ValType,Rhs> > \
+ ( *static_cast<ExprType const*>(this), \
+ rhs ); \
+ } \
+/**/
+#endif
+
+ BOOST_TEST_FOR_EACH_CONST_OP( ADD_OP_SUPPORT )
+ #undef ADD_OP_SUPPORT
+
+#ifndef BOOST_NO_CXX11_AUTO_DECLARATIONS
+ // Disabled operators
+ template<typename T>
+ ExprType&
+ operator ||( T const& /*rhs*/ )
+ {
+ BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_OR_WITHIN_THIS_TESTING_TOOL, () );
+
+ return *static_cast<ExprType*>(this);
+ }
+
+ template<typename T>
+ ExprType&
+ operator &&( T const& /*rhs*/ )
+ {
+ BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_AND_WITHIN_THIS_TESTING_TOOL, () );
+
+ return *static_cast<ExprType*>(this);
+ }
+
+ operator bool()
+ {
+ BOOST_MPL_ASSERT_MSG(false, CANT_USE_TERNARY_OPERATOR_WITHIN_THIS_TESTING_TOOL, () );
+
+ return false;
+ }
+#endif
+};
+
+// ************************************************************************** //
+// ************** assertion::value_expr ************** //
+// ************************************************************************** //
+// simple value expression
+
+template<typename T>
+class value_expr : public expression_base<value_expr<T>,typename remove_reference<T>::type> {
+public:
+ // Public types
+ typedef T result_type;
+
+ // Constructor
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ value_expr( value_expr&& ve )
+ : m_value( std::forward<T>(ve.m_value) )
+ {}
+ explicit value_expr( T&& val )
+ : m_value( std::forward<T>(val) )
+ {}
+#else
+ explicit value_expr( T const& val )
+ : m_value( val )
+ {}
+#endif
+
+ // Specific expression interface
+ T const& value() const
+ {
+ return m_value;
+ }
+ void report( std::ostream& ostr ) const
+ {
+ ostr << tt_detail::print_helper( m_value );
+ }
+
+ // Mutating operators
+#define ADD_OP_SUPPORT( OPER, ID, _ ) \
+ template<typename U> \
+ value_expr<T>& \
+ operator OPER( U const& rhs ) \
+ { \
+ m_value OPER rhs; \
+ \
+ return *this; \
+ } \
+/**/
+
+ BOOST_TEST_FOR_EACH_MUT_OP( ADD_OP_SUPPORT )
+#undef ADD_OP_SUPPORT
+
+ // expression interface
+ assertion_result evaluate( bool no_message = false ) const
+ {
+ assertion_result res( value() );
+ if( no_message || res )
+ return res;
+
+ format_message( res.message(), value() );
+
+ return tt_detail::format_assertion_result( "", res.message().str() );
+ }
+
+private:
+ template<typename U>
+ static void format_message( wrap_stringstream& ostr, U const& v ) { ostr << "[(bool)" << v << " is false]"; }
+ static void format_message( wrap_stringstream& /*ostr*/, bool /*v*/ ) {}
+ static void format_message( wrap_stringstream& /*ostr*/, assertion_result const& /*v*/ ) {}
+
+ // Data members
+ T m_value;
+};
+
+// ************************************************************************** //
+// ************** assertion::binary_expr ************** //
+// ************************************************************************** //
+// binary expression
+
+template<typename LExpr, typename Rhs, typename OP>
+class binary_expr : public expression_base<binary_expr<LExpr,Rhs,OP>,typename OP::result_type> {
+public:
+ // Public types
+ typedef typename OP::result_type result_type;
+
+ // Constructor
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ binary_expr( binary_expr&& be )
+ : m_lhs( std::forward<LExpr>(be.m_lhs) )
+ , m_rhs( std::forward<Rhs>(be.m_rhs) )
+ {}
+ binary_expr( LExpr&& lhs, Rhs&& rhs )
+ : m_lhs( std::forward<LExpr>(lhs) )
+ , m_rhs( std::forward<Rhs>(rhs) )
+ {}
+#else
+ binary_expr( LExpr const& lhs, Rhs const& rhs )
+ : m_lhs( lhs )
+ , m_rhs( rhs )
+ {}
+#endif
+
+ // Specific expression interface
+ result_type value() const
+ {
+ return OP::eval( m_lhs.value(), m_rhs );
+ }
+ void report( std::ostream& ostr ) const
+ {
+ return OP::report( ostr, m_lhs, m_rhs );
+ }
+
+ assertion_result evaluate( bool no_message = false ) const
+ {
+ assertion_result const expr_res( value() );
+ if( no_message || expr_res )
+ return expr_res;
+
+ wrap_stringstream buff;
+ report( buff.stream() );
+
+ return tt_detail::format_assertion_result( buff.stream().str(), expr_res.message() );
+ }
+
+ // To support custom manipulators
+ LExpr const& lhs() const { return m_lhs; }
+ Rhs const& rhs() const { return m_rhs; }
+private:
+ // Data members
+ LExpr m_lhs;
+ Rhs m_rhs;
+};
+
+// ************************************************************************** //
+// ************** assertion::seed ************** //
+// ************************************************************************** //
+// seed added ot the input expression to form an assertion expression
+
+class seed {
+public:
+ // ->* is highest precedence left to right operator
+ template<typename T>
+ value_expr<T>
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ operator->*( T&& v ) const
+ {
+ return value_expr<T>( std::forward<T>( v ) );
+ }
+#else
+ operator->*( T const& v ) const
+ {
+ return value_expr<T>( v );
+ }
+#endif
+};
+
+#undef BOOST_TEST_FOR_EACH_CONST_OP
+
+} // namespace assertion
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER
diff --git a/boost/test/tools/assertion_result.hpp b/boost/test/tools/assertion_result.hpp
new file mode 100644
index 0000000000..85cd18c0eb
--- /dev/null
+++ b/boost/test/tools/assertion_result.hpp
@@ -0,0 +1,90 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Enhanced result for test predicate that include message explaining failure
+// ***************************************************************************
+
+#ifndef BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
+#define BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
+
+// Boost.Test
+#include <boost/test/utils/class_properties.hpp>
+#include <boost/test/utils/wrap_stringstream.hpp>
+#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
+
+// Boost
+#include <boost/shared_ptr.hpp>
+#include <boost/detail/workaround.hpp>
+
+// STL
+#include <cstddef> // for std::size_t
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+
+// ************************************************************************** //
+// ************** assertion_result ************** //
+// ************************************************************************** //
+
+//!@brief Type used for storing the result of an assertion.
+class BOOST_TEST_DECL assertion_result {
+
+ //!@internal
+ typedef unit_test::const_string const_string;
+
+ //!@internal
+ struct dummy { void nonnull() {} };
+
+ //!@internal
+ typedef void (dummy::*safe_bool)();
+
+public:
+ // Constructor
+ assertion_result( bool pv_ )
+ : p_predicate_value( pv_ )
+ {}
+
+ template<typename BoolConvertable>
+ assertion_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, (assertion_result) ) p_predicate_value;
+
+ // Access methods
+ bool has_empty_message() const { return !m_message; }
+ wrap_stringstream& message()
+ {
+ if( !m_message )
+ m_message.reset( new wrap_stringstream );
+
+ return *m_message;
+ }
+ const_string message() const { return !m_message ? const_string() : const_string( m_message->str() ); }
+
+private:
+ // Data members
+ shared_ptr<wrap_stringstream> m_message;
+};
+
+typedef assertion_result predicate_result;
+
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
diff --git a/boost/test/tools/collection_comparison_op.hpp b/boost/test/tools/collection_comparison_op.hpp
new file mode 100644
index 0000000000..81a7046725
--- /dev/null
+++ b/boost/test/tools/collection_comparison_op.hpp
@@ -0,0 +1,375 @@
+// (C) Copyright Gennadiy Rozental 2014-2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief Collection comparison with enhanced reporting
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER
+#define BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER
+
+// Boost.Test
+#include <boost/test/tools/assertion.hpp>
+
+#include <boost/test/utils/is_forward_iterable.hpp>
+
+// Boost
+#include <boost/mpl/bool.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/decay.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace assertion {
+
+// ************************************************************************** //
+// ************* selectors for specialized comparizon routines ************** //
+// ************************************************************************** //
+
+template<typename T>
+struct specialized_compare : public mpl::false_ {};
+
+#define BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(Col) \
+namespace boost { namespace test_tools { namespace assertion { \
+template<> \
+struct specialized_compare<Col> : public mpl::true_ {}; \
+}}} \
+/**/
+
+// ************************************************************************** //
+// ************** lexicographic_compare ************** //
+// ************************************************************************** //
+
+namespace op {
+
+template <typename OP, bool can_be_equal, bool prefer_shorter,
+ typename Lhs, typename Rhs>
+inline assertion_result
+lexicographic_compare( Lhs const& lhs, Rhs const& rhs )
+{
+ assertion_result ar( true );
+
+ typename Lhs::const_iterator first1 = lhs.begin();
+ typename Rhs::const_iterator first2 = rhs.begin();
+ typename Lhs::const_iterator last1 = lhs.end();
+ typename Rhs::const_iterator last2 = rhs.end();
+ std::size_t pos = 0;
+
+ for( ; (first1 != last1) && (first2 != last2); ++first1, ++first2, ++pos ) {
+ assertion_result const& element_ar = OP::eval(*first1, *first2);
+ if( !can_be_equal && element_ar )
+ return ar; // a < b
+
+ assertion_result const& reverse_ar = OP::eval(*first2, *first1);
+ if( element_ar && !reverse_ar )
+ return ar; // a<=b and !(b<=a) => a < b => return true
+
+ if( element_ar || !reverse_ar )
+ continue; // (a<=b and b<=a) or (!(a<b) and !(b<a)) => a == b => keep looking
+
+ // !(a<=b) and b<=a => b < a => return false
+ ar = false;
+ ar.message() << "\nFailure at position " << pos << ": "
+ << tt_detail::print_helper(*first1)
+ << OP::revert()
+ << tt_detail::print_helper(*first2)
+ << ". " << element_ar.message();
+ return ar;
+ }
+
+
+ if( first1 != last1 ) {
+ if( prefer_shorter ) {
+ ar = false;
+ ar.message() << "\nFirst collection has extra trailing elements.";
+ }
+ }
+ else if( first2 != last2 ) {
+ if( !prefer_shorter ) {
+ ar = false;
+ ar.message() << "\nSecond collection has extra trailing elements.";
+ }
+ }
+ else if( !can_be_equal ) {
+ ar = false;
+ ar.message() << "\nCollections appear to be equal.";
+ }
+
+ return ar;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** equality_compare ************** //
+// ************************************************************************** //
+
+template <typename OP, typename Lhs, typename Rhs>
+inline assertion_result
+element_compare( Lhs const& lhs, Rhs const& rhs )
+{
+ assertion_result ar( true );
+
+ if( lhs.size() != rhs.size() ) {
+ ar = false;
+ ar.message() << "\nCollections size mismatch: " << lhs.size() << " != " << rhs.size();
+ return ar;
+ }
+
+ typename Lhs::const_iterator left = lhs.begin();
+ typename Rhs::const_iterator right = rhs.begin();
+ std::size_t pos = 0;
+
+ for( ; pos < lhs.size(); ++left, ++right, ++pos ) {
+ assertion_result const element_ar = OP::eval( *left, *right );
+ if( element_ar )
+ continue;
+
+ ar = false;
+ ar.message() << "\nMismatch at position " << pos << ": "
+ << tt_detail::print_helper(*left)
+ << OP::revert()
+ << tt_detail::print_helper(*right)
+ << ". " << element_ar.message();
+ }
+
+ return ar;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** non_equality_compare ************** //
+// ************************************************************************** //
+
+template <typename OP, typename Lhs, typename Rhs>
+inline assertion_result
+non_equality_compare( Lhs const& lhs, Rhs const& rhs )
+{
+ assertion_result ar( true );
+
+ if( lhs.size() != rhs.size() )
+ return ar;
+
+ typename Lhs::const_iterator left = lhs.begin();
+ typename Rhs::const_iterator right = rhs.begin();
+ typename Lhs::const_iterator end = lhs.end();
+
+ for( ; left != end; ++left, ++right ) {
+ if( OP::eval( *left, *right ) )
+ return ar;
+ }
+
+ ar = false;
+ ar.message() << "\nCollections appear to be equal";
+
+ return ar;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** cctraits ************** //
+// ************************************************************************** //
+// set of collection comparison traits per comparison OP
+
+template<typename OP>
+struct cctraits;
+
+template<typename Lhs, typename Rhs>
+struct cctraits<op::EQ<Lhs, Rhs> > {
+ typedef specialized_compare<Lhs> is_specialized;
+};
+
+template<typename Lhs, typename Rhs>
+struct cctraits<op::NE<Lhs, Rhs> > {
+ typedef specialized_compare<Lhs> is_specialized;
+};
+
+template<typename Lhs, typename Rhs>
+struct cctraits<op::LT<Lhs, Rhs> > {
+ static const bool can_be_equal = false;
+ static const bool prefer_short = true;
+
+ typedef specialized_compare<Lhs> is_specialized;
+};
+
+template<typename Lhs, typename Rhs>
+struct cctraits<op::LE<Lhs, Rhs> > {
+ static const bool can_be_equal = true;
+ static const bool prefer_short = true;
+
+ typedef specialized_compare<Lhs> is_specialized;
+};
+
+template<typename Lhs, typename Rhs>
+struct cctraits<op::GT<Lhs, Rhs> > {
+ static const bool can_be_equal = false;
+ static const bool prefer_short = false;
+
+ typedef specialized_compare<Lhs> is_specialized;
+};
+
+template<typename Lhs, typename Rhs>
+struct cctraits<op::GE<Lhs, Rhs> > {
+ static const bool can_be_equal = true;
+ static const bool prefer_short = false;
+
+ typedef specialized_compare<Lhs> is_specialized;
+};
+
+// ************************************************************************** //
+// ************** compare_collections ************** //
+// ************************************************************************** //
+// Overloaded set of functions dispatching to specific implementation of comparison
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::EQ<L, R> >*, mpl::true_ )
+{
+ return assertion::op::element_compare<op::EQ<L, R> >( lhs, rhs );
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::EQ<L, R> >*, mpl::false_ )
+{
+ return lhs == rhs;
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::NE<L, R> >*, mpl::true_ )
+{
+ return assertion::op::non_equality_compare<op::NE<L, R> >( lhs, rhs );
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::NE<L, R> >*, mpl::false_ )
+{
+ return lhs != rhs;
+}
+
+//____________________________________________________________________________//
+
+template <typename OP, typename Lhs, typename Rhs>
+inline assertion_result
+lexicographic_compare( Lhs const& lhs, Rhs const& rhs )
+{
+ return assertion::op::lexicographic_compare<OP, cctraits<OP>::can_be_equal, cctraits<OP>::prefer_short>( lhs, rhs );
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename OP>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<OP>* tp, mpl::true_ )
+{
+ return lexicographic_compare<OP>( lhs, rhs );
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::LT<L, R> >* tp, mpl::false_ )
+{
+ return lhs < rhs;
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::LE<L, R> >* tp, mpl::false_ )
+{
+ return lhs <= rhs;
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::GT<L, R> >* tp, mpl::false_ )
+{
+ return lhs > rhs;
+}
+
+//____________________________________________________________________________//
+
+template <typename Lhs, typename Rhs, typename L, typename R>
+inline assertion_result
+compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::GE<L, R> >* tp, mpl::false_ )
+{
+ return lhs >= rhs;
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ********* specialization of comparison operators for collections ********* //
+// ************************************************************************** //
+
+#define DEFINE_COLLECTION_COMPARISON( oper, name, _ ) \
+template<typename Lhs,typename Rhs> \
+struct name<Lhs,Rhs,typename boost::enable_if_c< \
+ unit_test::is_forward_iterable<Lhs>::value && \
+ unit_test::is_forward_iterable<Rhs>::value>::type> { \
+public: \
+ typedef assertion_result result_type; \
+ \
+ typedef name<Lhs, Rhs> OP; \
+ typedef typename \
+ mpl::if_c<is_same<typename decay<Lhs>::type, \
+ typename decay<Rhs>::type>::value, \
+ typename cctraits<OP>::is_specialized, \
+ mpl::false_>::type is_specialized; \
+ \
+ typedef name<typename Lhs::value_type, \
+ typename Rhs::value_type> elem_op; \
+ \
+ static assertion_result \
+ eval( Lhs const& lhs, Rhs const& rhs) \
+ { \
+ return assertion::op::compare_collections( lhs, rhs, \
+ (boost::type<elem_op>*)0, \
+ is_specialized() ); \
+ } \
+ \
+ template<typename PrevExprType> \
+ static void \
+ report( std::ostream&, \
+ PrevExprType const&, \
+ Rhs const& ) {} \
+}; \
+/**/
+
+BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_COLLECTION_COMPARISON )
+#undef DEFINE_COLLECTION_COMPARISON
+
+//____________________________________________________________________________//
+
+} // namespace op
+} // namespace assertion
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER
+
diff --git a/boost/test/tools/context.hpp b/boost/test/tools/context.hpp
new file mode 100644
index 0000000000..38018b84b8
--- /dev/null
+++ b/boost/test/tools/context.hpp
@@ -0,0 +1,65 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : test tools context interfaces
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
+#define BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
+
+// Boost.Test
+#include <boost/test/utils/lazy_ostream.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace tt_detail {
+
+// ************************************************************************** //
+// ************** context_frame ************** //
+// ************************************************************************** //
+
+struct BOOST_TEST_DECL context_frame {
+ explicit context_frame( ::boost::unit_test::lazy_ostream const& context_descr );
+ ~context_frame();
+
+ operator bool();
+
+private:
+ // Data members
+ int m_frame_id;
+};
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_INFO( context_descr ) \
+ ::boost::unit_test::framework::add_context( BOOST_TEST_LAZY_MSG( context_descr ) , false ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_CONTEXT( context_descr ) \
+ if( ::boost::test_tools::tt_detail::context_frame BOOST_JOIN( context_frame_, __LINE__ ) = \
+ ::boost::test_tools::tt_detail::context_frame( BOOST_TEST_LAZY_MSG( context_descr ) ) ) \
+/**/
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
diff --git a/boost/test/tools/cstring_comparison_op.hpp b/boost/test/tools/cstring_comparison_op.hpp
new file mode 100644
index 0000000000..3b114e5977
--- /dev/null
+++ b/boost/test/tools/cstring_comparison_op.hpp
@@ -0,0 +1,91 @@
+// (C) Copyright Gennadiy Rozental 2014-2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief C string comparison with enhanced reporting
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
+#define BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
+
+// Boost.Test
+#include <boost/test/tools/assertion.hpp>
+
+#include <boost/test/utils/is_cstring.hpp>
+#include <boost/test/utils/basic_cstring/compare.hpp>
+
+// Boost
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace assertion {
+namespace op {
+
+
+
+// ************************************************************************** //
+// ************** string_compare ************** //
+// ************************************************************************** //
+
+#define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \
+template<typename Lhs,typename Rhs> \
+struct name<Lhs,Rhs,typename boost::enable_if_c< \
+ unit_test::is_cstring<Lhs>::value && \
+ unit_test::is_cstring<Rhs>::value>::type> { \
+ typedef typename boost::add_const< \
+ typename remove_pointer< \
+ typename decay<Lhs>::type>::type>::type \
+ lhs_char_type; \
+ typedef typename boost::add_const< \
+ typename remove_pointer< \
+ typename decay<Rhs>::type>::type>::type \
+ rhs_char_type; \
+public: \
+ typedef assertion_result result_type; \
+ \
+ static bool \
+ eval( Lhs const& lhs, Rhs const& rhs) \
+ { \
+ return unit_test::basic_cstring<lhs_char_type>(lhs) oper \
+ unit_test::basic_cstring<rhs_char_type>(rhs); \
+ } \
+ \
+ template<typename PrevExprType> \
+ static void \
+ report( std::ostream& ostr, \
+ PrevExprType const& lhs, \
+ Rhs const& rhs) \
+ { \
+ lhs.report( ostr ); \
+ ostr << revert() \
+ << tt_detail::print_helper( rhs ); \
+ } \
+ \
+ static char const* revert() \
+ { return " " #rev " "; } \
+}; \
+/**/
+
+BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON )
+#undef DEFINE_CSTRING_COMPARISON
+
+//____________________________________________________________________________//
+
+} // namespace op
+} // namespace assertion
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
+
diff --git a/boost/test/tools/detail/bitwise_manip.hpp b/boost/test/tools/detail/bitwise_manip.hpp
new file mode 100644
index 0000000000..e0fd36acd4
--- /dev/null
+++ b/boost/test/tools/detail/bitwise_manip.hpp
@@ -0,0 +1,123 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//! @file
+//! Bitwise comparison manipulator implementation
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER
+#define BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER
+
+// Boost Test
+#include <boost/test/tools/detail/fwd.hpp>
+#include <boost/test/tools/detail/indirections.hpp>
+
+#include <boost/test/tools/assertion_result.hpp>
+#include <boost/test/tools/assertion.hpp>
+
+// STL
+#include <climits> // for CHAR_BIT
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+
+// ************************************************************************** //
+// ************** bitwise comparison manipulator ************** //
+// ************************************************************************** //
+
+//! Bitwise comparison manipulator
+struct bitwise {};
+
+//____________________________________________________________________________//
+
+inline int
+operator<<( unit_test::lazy_ostream const&, bitwise ) { return 0; }
+
+//____________________________________________________________________________//
+
+namespace tt_detail {
+
+/*!@brief Bitwise comparison of two operands
+ *
+ * This class constructs an @ref assertion_result that contains precise bit comparison information.
+ * In particular the location of the mismatches (if any) are printed in the assertion result.
+ */
+template<typename Lhs, typename Rhs, typename E>
+inline assertion_result
+bitwise_compare(Lhs const& lhs, Rhs const& rhs, E const& expr )
+{
+ assertion_result pr( true );
+
+ std::size_t left_bit_size = sizeof(Lhs)*CHAR_BIT;
+ std::size_t right_bit_size = sizeof(Rhs)*CHAR_BIT;
+
+ static Lhs const leftOne( 1 );
+ static Rhs const rightOne( 1 );
+
+ std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size;
+
+ for( std::size_t counter = 0; counter < total_bits; ++counter ) {
+ if( (lhs & ( leftOne << counter )) != (rhs & (rightOne << counter)) ) {
+ if( pr ) {
+ pr.message() << " [";
+ expr.report( pr.message().stream() );
+ pr.message() << "]. Bitwise comparison failed";
+ pr = false;
+ }
+ pr.message() << "\nMismatch at position " << counter;
+ }
+ }
+
+ if( left_bit_size != right_bit_size ) {
+ if( pr ) {
+ pr.message() << " [";
+ expr.report( pr.message().stream() );
+ pr.message() << "]. Bitwise comparison failed";
+ pr = false;
+ }
+ pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size;
+ }
+
+ return pr;
+}
+
+//____________________________________________________________________________//
+
+//! Returns an assertion_result using the bitwise comparison out of an expression
+//!
+//! This is used as a modifer of the normal operator<< on expressions to use the
+//! bitwise comparison.
+//!
+//! @note Available only for compilers supporting the @c auto declaration.
+template<typename T1, typename T2, typename T3, typename T4>
+inline assertion_result
+operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,assertion::op::EQ<T3,T4> > > const& ae, bitwise )
+{
+ return bitwise_compare( ae.m_e.lhs().value(), ae.m_e.rhs(), ae.m_e );
+}
+
+//____________________________________________________________________________//
+
+inline check_type
+operator<<( assertion_type const& , bitwise )
+{
+ return CHECK_BUILT_ASSERTION;
+}
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER
diff --git a/boost/test/tools/detail/expression_holder.hpp b/boost/test/tools/detail/expression_holder.hpp
new file mode 100644
index 0000000000..7d7efd04e6
--- /dev/null
+++ b/boost/test/tools/detail/expression_holder.hpp
@@ -0,0 +1,70 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : toolbox implementation details
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER
+#define BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER
+
+#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace tt_detail {
+
+// ************************************************************************** //
+// ************** tt_detail::expression_holder ************** //
+// ************************************************************************** //
+
+class expression_holder {
+public:
+ virtual ~expression_holder() {}
+ virtual assertion_result evaluate( bool no_message = false ) const = 0;
+};
+
+//____________________________________________________________________________//
+
+template<typename E>
+class expression_holder_t: public expression_holder {
+public:
+ explicit expression_holder_t( E const& e ) : m_expr( e ) {}
+
+private:
+ virtual assertion_result evaluate( bool no_message = false ) const { return m_expr.evaluate( no_message ); }
+
+ E m_expr;
+};
+
+//____________________________________________________________________________//
+
+template<typename E>
+expression_holder_t<E>
+hold_expression( E const& e )
+{
+ return expression_holder_t<E>( e );
+}
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif
+
+#endif // BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER
diff --git a/boost/test/tools/detail/fwd.hpp b/boost/test/tools/detail/fwd.hpp
new file mode 100644
index 0000000000..d5915a1656
--- /dev/null
+++ b/boost/test/tools/detail/fwd.hpp
@@ -0,0 +1,121 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : toolbox implementation types and forward declarations
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER
+#define BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/utils/basic_cstring/io.hpp>
+
+// STL
+#include <cstddef> // for std::size_t
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+class lazy_ostream;
+
+} // namespace unit_test
+
+namespace test_tools {
+
+using unit_test::const_string;
+class assertion_result;
+
+//____________________________________________________________________________//
+
+namespace tt_detail {
+
+inline bool dummy_cond() { return false; }
+
+// ************************************************************************** //
+// ************** types of supported assertions ************** //
+// ************************************************************************** //
+
+//____________________________________________________________________________//
+
+enum check_type {
+ CHECK_PRED,
+ CHECK_MSG,
+ CHECK_EQUAL,
+ CHECK_NE,
+ CHECK_LT,
+ CHECK_LE,
+ CHECK_GT,
+ CHECK_GE,
+ CHECK_CLOSE,
+ CHECK_CLOSE_FRACTION,
+ CHECK_SMALL,
+ CHECK_BITWISE_EQUAL,
+ CHECK_PRED_WITH_ARGS,
+ CHECK_EQUAL_COLL,
+ CHECK_BUILT_ASSERTION
+};
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** levels of supported assertions ************** //
+// ************************************************************************** //
+
+enum tool_level {
+ WARN, CHECK, REQUIRE, PASS
+};
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** Tools offline implementation ************** //
+// ************************************************************************** //
+
+BOOST_TEST_DECL bool
+report_assertion( assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr,
+ const_string file_name, std::size_t line_num,
+ tool_level tl, check_type ct,
+ std::size_t num_args, ... );
+
+//____________________________________________________________________________//
+
+BOOST_TEST_DECL assertion_result
+format_assertion_result( const_string expr_val, const_string details );
+
+//____________________________________________________________________________//
+
+BOOST_TEST_DECL assertion_result
+format_fpc_report( const_string expr_val, const_string details );
+
+//____________________________________________________________________________//
+
+BOOST_TEST_DECL bool
+is_defined_impl( const_string symbol_name, const_string symbol_value );
+
+//____________________________________________________________________________//
+
+BOOST_TEST_DECL assertion_result
+equal_impl( char const* left, char const* right );
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER
diff --git a/boost/test/tools/detail/indirections.hpp b/boost/test/tools/detail/indirections.hpp
new file mode 100644
index 0000000000..429420f55a
--- /dev/null
+++ b/boost/test/tools/detail/indirections.hpp
@@ -0,0 +1,94 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : inidiration interfaces to support manipulators and message output
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
+#define BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
+
+// Boost.Test
+#include <boost/test/tools/detail/fwd.hpp>
+
+#include <boost/test/tools/assertion_result.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace tt_detail {
+
+// ************************************************************************** //
+// ************** assertion_evaluate indirection ************** //
+// ************************************************************************** //
+
+template<typename E>
+struct assertion_evaluate_t {
+ assertion_evaluate_t( E const& e ) : m_e( e ) {}
+ operator assertion_result() { return m_e.evaluate( true ); }
+
+ E const& m_e;
+};
+
+//____________________________________________________________________________//
+
+template<typename E>
+inline assertion_evaluate_t<E>
+assertion_evaluate( E const& e ) { return assertion_evaluate_t<E>( e ); }
+
+//____________________________________________________________________________//
+
+template<typename E, typename T>
+inline assertion_evaluate_t<E>
+operator<<( assertion_evaluate_t<E> const& ae, T const& ) { return ae; }
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** assertion_text indirection ************** //
+// ************************************************************************** //
+
+template<typename T>
+inline unit_test::lazy_ostream const&
+assertion_text( unit_test::lazy_ostream const& /*et*/, T const& m ) { return m; }
+
+//____________________________________________________________________________//
+
+inline unit_test::lazy_ostream const&
+assertion_text( unit_test::lazy_ostream const& et, int ) { return et; }
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** assertion_evaluate indirection ************** //
+// ************************************************************************** //
+
+struct assertion_type {
+ operator check_type() { return CHECK_MSG; }
+};
+
+//____________________________________________________________________________//
+
+template<typename T>
+inline assertion_type
+operator<<( assertion_type const& at, T const& ) { return at; }
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
diff --git a/boost/test/tools/detail/it_pair.hpp b/boost/test/tools/detail/it_pair.hpp
new file mode 100644
index 0000000000..929bbae96d
--- /dev/null
+++ b/boost/test/tools/detail/it_pair.hpp
@@ -0,0 +1,74 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : support for backward compatible collection comparison interface
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
+#define BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
+
+#ifdef BOOST_TEST_NO_OLD_TOOLS
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace tt_detail {
+
+// ************************************************************************** //
+// ************** backward compatibility support ************** //
+// ************************************************************************** //
+
+template<typename It>
+struct it_pair {
+ typedef It const_iterator;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+
+ it_pair( It const& b, It const& e ) : m_begin( b ), m_size( 0 )
+ {
+ It tmp = b;
+ while( tmp != e ) { ++m_size; ++tmp; }
+ }
+
+ It begin() const { return m_begin; }
+ It end() const { return m_begin + m_size; }
+ size_t size() const { return m_size; }
+
+private:
+ It m_begin;
+ size_t m_size;
+};
+
+//____________________________________________________________________________//
+
+template<typename It>
+it_pair<It>
+make_it_pair( It const& b, It const& e ) { return it_pair<It>( b, e ); }
+
+//____________________________________________________________________________//
+
+template<typename T>
+it_pair<T const*>
+make_it_pair( T const* b, T const* e ) { return it_pair<T const*>( b, e ); }
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_NO_OLD_TOOLS
+
+#endif // BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
diff --git a/boost/test/tools/detail/lexicographic_manip.hpp b/boost/test/tools/detail/lexicographic_manip.hpp
new file mode 100644
index 0000000000..01d63a9e91
--- /dev/null
+++ b/boost/test/tools/detail/lexicographic_manip.hpp
@@ -0,0 +1,69 @@
+// (C) Copyright Gennadiy Rozental 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//! @file
+//! Lexicographic comparison manipulator implementation
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER
+#define BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER
+
+// Boost Test
+#include <boost/test/tools/detail/fwd.hpp>
+#include <boost/test/tools/detail/indirections.hpp>
+
+#include <boost/test/tools/assertion.hpp>
+#include <boost/test/tools/collection_comparison_op.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+
+// ************************************************************************** //
+// ************** per element comparison manipulator ************** //
+// ************************************************************************** //
+
+//! Lexicographic comparison manipulator, for containers
+struct lexicographic {};
+
+//____________________________________________________________________________//
+
+inline int
+operator<<( unit_test::lazy_ostream const&, lexicographic ) { return 0; }
+
+//____________________________________________________________________________//
+
+namespace tt_detail {
+
+template<typename T1, typename T2, typename OP>
+inline assertion_result
+operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, lexicographic )
+{
+ typedef typename OP::elem_op elem_op;
+ return assertion::op::lexicographic_compare<elem_op>( ae.m_e.lhs().value(), ae.m_e.rhs() );
+}
+
+//____________________________________________________________________________//
+
+inline check_type
+operator<<( assertion_type const&, lexicographic )
+{
+ return CHECK_BUILT_ASSERTION;
+}
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER
diff --git a/boost/test/tools/detail/per_element_manip.hpp b/boost/test/tools/detail/per_element_manip.hpp
new file mode 100644
index 0000000000..efcd45e9b8
--- /dev/null
+++ b/boost/test/tools/detail/per_element_manip.hpp
@@ -0,0 +1,69 @@
+// (C) Copyright Gennadiy Rozental 2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//! @file
+//! Per element comparison manipulator implementation
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER
+#define BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER
+
+// Boost Test
+#include <boost/test/tools/detail/fwd.hpp>
+#include <boost/test/tools/detail/indirections.hpp>
+
+#include <boost/test/tools/assertion.hpp>
+#include <boost/test/tools/collection_comparison_op.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+
+// ************************************************************************** //
+// ************** per element comparison manipulator ************** //
+// ************************************************************************** //
+
+//! Per element comparison manipulator, for containers
+struct per_element {};
+
+//____________________________________________________________________________//
+
+inline int
+operator<<( unit_test::lazy_ostream const&, per_element ) { return 0; }
+
+//____________________________________________________________________________//
+
+namespace tt_detail {
+
+template<typename T1, typename T2, typename OP>
+inline assertion_result
+operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, per_element )
+{
+ typedef typename OP::elem_op elem_op;
+ return assertion::op::element_compare<elem_op>( ae.m_e.lhs().value(), ae.m_e.rhs() );
+}
+
+//____________________________________________________________________________//
+
+inline check_type
+operator<<( assertion_type const&, per_element )
+{
+ return CHECK_BUILT_ASSERTION;
+}
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER
diff --git a/boost/test/tools/detail/print_helper.hpp b/boost/test/tools/detail/print_helper.hpp
new file mode 100644
index 0000000000..ab15146aa2
--- /dev/null
+++ b/boost/test/tools/detail/print_helper.hpp
@@ -0,0 +1,199 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : defines level of indiration facilitating workarounds for non printable types
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER
+#define BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/detail/workaround.hpp>
+
+// Boost
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_array.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/type_traits/is_abstract.hpp>
+#include <limits>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace tt_detail {
+
+// ************************************************************************** //
+// ************** print_log_value ************** //
+// ************************************************************************** //
+
+template<typename T>
+struct print_log_value {
+ void operator()( std::ostream& ostr, T const& t )
+ {
+ typedef typename mpl::or_<is_array<T>,is_function<T>,is_abstract<T> >::type cant_use_nl;
+
+ std::streamsize old_precision = set_precision( ostr, cant_use_nl() );
+
+ ostr << t;
+
+ if( old_precision != (std::streamsize)-1 )
+ ostr.precision( old_precision );
+ }
+
+ std::streamsize set_precision( std::ostream& ostr, mpl::false_ )
+ {
+ if( std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 2 )
+ return ostr.precision( 2 + std::numeric_limits<T>::digits * 301/1000 );
+ else if ( std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 10 ) {
+#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS
+ // (was BOOST_NO_NUMERIC_LIMITS_LOWEST but now deprecated).
+ // No support for std::numeric_limits<double>::max_digits10,
+ // so guess that a couple of guard digits more than digits10 will display any difference.
+ return ostr.precision( 2 + std::numeric_limits<T>::digits10 );
+#else
+ // std::numeric_limits<double>::max_digits10; IS supported.
+ // Any noisy or guard digits needed to display any difference are included in max_digits10.
+ return ostr.precision( std::numeric_limits<T>::max_digits10 );
+#endif
+ }
+ // else if T is not specialized for std::numeric_limits<>,
+ // then will just get the default precision of 6 digits.
+ return (std::streamsize)-1;
+ }
+
+ std::streamsize set_precision( std::ostream&, mpl::true_ ) { return (std::streamsize)-1; }
+};
+
+//____________________________________________________________________________//
+
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+template<typename T, std::size_t N >
+struct print_log_value< T[N] > {
+ void operator()( std::ostream& ostr, T const* t )
+ {
+ ostr << t;
+ }
+};
+#endif
+
+//____________________________________________________________________________//
+
+template<>
+struct BOOST_TEST_DECL print_log_value<bool> {
+ void operator()( std::ostream& ostr, bool t )
+ {
+ ostr << std::boolalpha << t;
+ }
+};
+
+//____________________________________________________________________________//
+
+template<>
+struct BOOST_TEST_DECL print_log_value<char> {
+ void operator()( std::ostream& ostr, char t );
+};
+
+//____________________________________________________________________________//
+
+template<>
+struct BOOST_TEST_DECL print_log_value<unsigned char> {
+ void operator()( std::ostream& ostr, unsigned char t );
+};
+
+//____________________________________________________________________________//
+
+template<>
+struct BOOST_TEST_DECL print_log_value<char const*> {
+ void operator()( std::ostream& ostr, char const* t );
+};
+
+//____________________________________________________________________________//
+
+template<>
+struct BOOST_TEST_DECL print_log_value<wchar_t const*> {
+ void operator()( std::ostream& ostr, wchar_t const* t );
+};
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** print_helper ************** //
+// ************************************************************************** //
+// Adds level of indirection to the output operation, allowing us to customize
+// it for types that do not support operator << directly or for any other reason
+
+template<typename T>
+struct print_helper_t {
+ explicit print_helper_t( T const& t ) : m_t( t ) {}
+
+ T const& m_t;
+};
+
+//____________________________________________________________________________//
+
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+// Borland suffers premature pointer decay passing arrays by reference
+template<typename T, std::size_t N >
+struct print_helper_t< T[N] > {
+ explicit print_helper_t( T const * t ) : m_t( t ) {}
+
+ T const * m_t;
+};
+#endif
+
+//____________________________________________________________________________//
+
+template<typename T>
+inline print_helper_t<T>
+print_helper( T const& t )
+{
+ return print_helper_t<T>( t );
+}
+
+//____________________________________________________________________________//
+
+template<typename T>
+inline std::ostream&
+operator<<( std::ostream& ostr, print_helper_t<T> const& ph )
+{
+ print_log_value<T>()( ostr, ph.m_t );
+
+ return ostr;
+}
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+
+// ************************************************************************** //
+// ************** BOOST_TEST_DONT_PRINT_LOG_VALUE ************** //
+// ************************************************************************** //
+
+#define BOOST_TEST_DONT_PRINT_LOG_VALUE( the_type ) \
+namespace boost{ namespace test_tools{ namespace tt_detail{ \
+template<> \
+struct print_log_value<the_type > { \
+ void operator()( std::ostream&, the_type const& ) {} \
+}; \
+}}} \
+/**/
+
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER
diff --git a/boost/test/tools/detail/tolerance_manip.hpp b/boost/test/tools/detail/tolerance_manip.hpp
new file mode 100644
index 0000000000..adb58f98d0
--- /dev/null
+++ b/boost/test/tools/detail/tolerance_manip.hpp
@@ -0,0 +1,130 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//! @file
+//! @brief Floating point comparison tolerance manipulators
+//!
+//! This file defines several manipulators for floating point comparison. These
+//! manipulators are intended to be used with BOOST_TEST.
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER
+#define BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER
+
+// Boost Test
+#include <boost/test/tools/detail/fwd.hpp>
+#include <boost/test/tools/detail/indirections.hpp>
+
+#include <boost/test/tools/fpc_tolerance.hpp>
+#include <boost/test/tools/floating_point_comparison.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace tt_detail {
+
+// ************************************************************************** //
+// ************** fpc tolerance manipulator ************** //
+// ************************************************************************** //
+
+template<typename FPT>
+struct tolerance_manip {
+ explicit tolerance_manip( FPT const & tol ) : m_value( tol ) {}
+
+ FPT m_value;
+};
+
+//____________________________________________________________________________//
+
+struct tolerance_manip_delay {};
+
+template<typename FPT>
+inline tolerance_manip<FPT>
+operator%( FPT v, tolerance_manip_delay const& )
+{
+ BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based<FPT>::value),
+ "tolerance only for floating points" );
+
+ return tolerance_manip<FPT>( FPT(v / 100) );
+}
+
+//____________________________________________________________________________//
+
+template<typename E, typename FPT>
+inline assertion_result
+operator<<(assertion_evaluate_t<E> const& ae, tolerance_manip<FPT> const& tol)
+{
+ local_fpc_tolerance<FPT> lt( tol.m_value );
+
+ return ae.m_e.evaluate();
+}
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+inline int
+operator<<( unit_test::lazy_ostream const&, tolerance_manip<FPT> const& ) { return 0; }
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+inline check_type
+operator<<( assertion_type const& /*at*/, tolerance_manip<FPT> const& ) { return CHECK_BUILT_ASSERTION; }
+
+//____________________________________________________________________________//
+
+} // namespace tt_detail
+
+
+/*! Tolerance manipulator
+ *
+ * These functions return a manipulator that can be used in conjunction with BOOST_TEST
+ * in order to specify the tolerance with which floating point comparisons are made.
+ */
+template<typename FPT>
+inline tt_detail::tolerance_manip<FPT>
+tolerance( FPT v )
+{
+ BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based<FPT>::value),
+ "tolerance only for floating points" );
+
+ return tt_detail::tolerance_manip<FPT>( v );
+}
+
+//____________________________________________________________________________//
+
+//! @overload tolerance( FPT v )
+template<typename FPT>
+inline tt_detail::tolerance_manip<FPT>
+tolerance( fpc::percent_tolerance_t<FPT> v )
+{
+ BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based<FPT>::value),
+ "tolerance only for floating points" );
+
+ return tt_detail::tolerance_manip<FPT>( static_cast<FPT>(v.m_value / 100) );
+}
+
+//____________________________________________________________________________//
+
+//! @overload tolerance( FPT v )
+inline tt_detail::tolerance_manip_delay
+tolerance()
+{
+ return tt_detail::tolerance_manip_delay();
+}
+
+//____________________________________________________________________________//
+
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER
diff --git a/boost/test/tools/floating_point_comparison.hpp b/boost/test/tools/floating_point_comparison.hpp
new file mode 100644
index 0000000000..fac914c91d
--- /dev/null
+++ b/boost/test/tools/floating_point_comparison.hpp
@@ -0,0 +1,315 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief algorithms for comparing floating point values
+// ***************************************************************************
+
+#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
+#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
+
+// Boost.Test
+#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/tools/assertion_result.hpp>
+
+// Boost
+#include <boost/limits.hpp> // for std::numeric_limits
+#include <boost/static_assert.hpp>
+#include <boost/assert.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
+#include <boost/type_traits/is_array.hpp>
+#include <boost/type_traits/conditional.hpp>
+#include <boost/utility/enable_if.hpp>
+
+// STL
+#include <iosfwd>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace math {
+namespace fpc {
+
+// ************************************************************************** //
+// ************** fpc::tolerance_based ************** //
+// ************************************************************************** //
+
+
+//! @internal
+//! Protects the instanciation of std::numeric_limits from non-supported types (eg. T=array)
+template <typename T, bool enabled>
+struct tolerance_based_delegate;
+
+template <typename T>
+struct tolerance_based_delegate<T, false> : mpl::false_ {};
+
+template <typename T>
+struct tolerance_based_delegate<T, true>
+: mpl::bool_<
+ is_floating_point<T>::value ||
+ (!std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_specialized && !std::numeric_limits<T>::is_exact)>
+{};
+
+
+/*!@brief Indicates if a type can be compared using a tolerance scheme
+ *
+ * This is a metafunction that should evaluate to @c mpl::true_ if the type
+ * @c T can be compared using a tolerance based method, typically for floating point
+ * types.
+ *
+ * This metafunction can be specialized further to declare user types that are
+ * floating point (eg. boost.multiprecision).
+ */
+template <typename T>
+struct tolerance_based : tolerance_based_delegate<T, !is_array<T>::value >::type {};
+
+// ************************************************************************** //
+// ************** fpc::strength ************** //
+// ************************************************************************** //
+
+//! Method for comparing floating point numbers
+enum strength {
+ FPC_STRONG, //!< "Very close" - equation 2' in docs, the default
+ FPC_WEAK //!< "Close enough" - equation 3' in docs.
+};
+
+
+// ************************************************************************** //
+// ************** tolerance presentation types ************** //
+// ************************************************************************** //
+
+template<typename FPT>
+struct percent_tolerance_t {
+ explicit percent_tolerance_t( FPT v ) : m_value( v ) {}
+
+ FPT m_value;
+};
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+inline std::ostream& operator<<( std::ostream& out, percent_tolerance_t<FPT> t )
+{
+ return out << t.m_value;
+}
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+inline percent_tolerance_t<FPT>
+percent_tolerance( FPT v )
+{
+ return percent_tolerance_t<FPT>( v );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** details ************** //
+// ************************************************************************** //
+
+namespace fpc_detail {
+
+// FPT is Floating-Point Type: float, double, long double or User-Defined.
+template<typename FPT>
+inline FPT
+fpt_abs( FPT fpv )
+{
+ return fpv < static_cast<FPT>(0) ? -fpv : fpv;
+}
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+struct fpt_specialized_limits
+{
+ static FPT min_value() { return (std::numeric_limits<FPT>::min)(); }
+ static FPT max_value() { return (std::numeric_limits<FPT>::max)(); }
+};
+
+template<typename FPT>
+struct fpt_non_specialized_limits
+{
+ static FPT min_value() { return static_cast<FPT>(0); }
+ static FPT max_value() { return static_cast<FPT>(1000000); } // for our purposes it doesn't really matter what value is returned here
+};
+
+template<typename FPT>
+struct fpt_limits : boost::conditional<std::numeric_limits<FPT>::is_specialized,
+ fpt_specialized_limits<FPT>,
+ fpt_non_specialized_limits<FPT>
+ >::type
+{};
+
+//____________________________________________________________________________//
+
+// both f1 and f2 are unsigned here
+template<typename FPT>
+inline FPT
+safe_fpt_division( FPT f1, FPT f2 )
+{
+ // Avoid overflow.
+ 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())) )
+ return static_cast<FPT>(0);
+
+ return f1/f2;
+}
+
+//____________________________________________________________________________//
+
+template<typename FPT, typename ToleranceType>
+inline FPT
+fraction_tolerance( ToleranceType tolerance )
+{
+ return static_cast<FPT>(tolerance);
+}
+
+//____________________________________________________________________________//
+
+template<typename FPT2, typename FPT>
+inline FPT2
+fraction_tolerance( percent_tolerance_t<FPT> tolerance )
+{
+ return FPT2(tolerance.m_value)*FPT2(0.01);
+}
+
+//____________________________________________________________________________//
+
+} // namespace fpc_detail
+
+// ************************************************************************** //
+// ************** close_at_tolerance ************** //
+// ************************************************************************** //
+
+
+/*!@brief Predicate for comparing floating point numbers
+ *
+ * This predicate is used to compare floating point numbers. In addition the comparison produces maximum
+ * related differnce, which can be used to generate detailed error message
+ * The methods for comparing floating points are detailed in the documentation. The method is chosen
+ * by the @ref boost::math::fpc::strength given at construction.
+ */
+template<typename FPT>
+class close_at_tolerance {
+public:
+ // Public typedefs
+ typedef bool result_type;
+
+ // Constructor
+ template<typename ToleranceType>
+ explicit close_at_tolerance( ToleranceType tolerance, fpc::strength fpc_strength = FPC_STRONG )
+ : m_fraction_tolerance( fpc_detail::fraction_tolerance<FPT>( tolerance ) )
+ , m_strength( fpc_strength )
+ , m_tested_rel_diff( 0 )
+ {
+ BOOST_ASSERT_MSG( m_fraction_tolerance >= FPT(0), "tolerance must not be negative!" ); // no reason for tolerance to be negative
+ }
+
+ // Access methods
+ //! Returns the tolerance
+ FPT fraction_tolerance() const { return m_fraction_tolerance; }
+
+ //! Returns the comparison method
+ fpc::strength strength() const { return m_strength; }
+
+ //! Returns the failing fraction
+ FPT tested_rel_diff() const { return m_tested_rel_diff; }
+
+ /*! Compares two floating point numbers a and b such that their "left" relative difference |a-b|/a and/or
+ * "right" relative difference |a-b|/b does not exceed specified relative (fraction) tolerance.
+ *
+ * @param[in] left first floating point number to be compared
+ * @param[in] right second floating point number to be compared
+ *
+ * What is reported by @c tested_rel_diff in case of failure depends on the comparison method:
+ * - for @c FPC_STRONG: the max of the two fractions
+ * - for @c FPC_WEAK: the min of the two fractions
+ * The rationale behind is to report the tolerance to set in order to make a test pass.
+ */
+ bool operator()( FPT left, FPT right ) const
+ {
+ FPT diff = fpc_detail::fpt_abs<FPT>( left - right );
+ FPT fraction_of_right = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( right ) );
+ FPT fraction_of_left = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( left ) );
+
+ FPT max_rel_diff = (std::max)( fraction_of_left, fraction_of_right );
+ FPT min_rel_diff = (std::min)( fraction_of_left, fraction_of_right );
+
+ m_tested_rel_diff = m_strength == FPC_STRONG ? max_rel_diff : min_rel_diff;
+
+ return m_tested_rel_diff <= m_fraction_tolerance;
+ }
+
+private:
+ // Data members
+ FPT m_fraction_tolerance;
+ fpc::strength m_strength;
+ mutable FPT m_tested_rel_diff;
+};
+
+// ************************************************************************** //
+// ************** small_with_tolerance ************** //
+// ************************************************************************** //
+
+
+/*!@brief Predicate for comparing floating point numbers against 0
+ *
+ * Serves the same purpose as boost::math::fpc::close_at_tolerance, but used when one
+ * of the operand is null.
+ */
+template<typename FPT>
+class small_with_tolerance {
+public:
+ // Public typedefs
+ typedef bool result_type;
+
+ // Constructor
+ explicit small_with_tolerance( FPT tolerance ) // <= absolute tolerance
+ : m_tolerance( tolerance )
+ {
+ BOOST_ASSERT( m_tolerance >= FPT(0) ); // no reason for the tolerance to be negative
+ }
+
+ // Action method
+ bool operator()( FPT fpv ) const
+ {
+ return fpc::fpc_detail::fpt_abs( fpv ) < m_tolerance;
+ }
+
+private:
+ // Data members
+ FPT m_tolerance;
+};
+
+// ************************************************************************** //
+// ************** is_small ************** //
+// ************************************************************************** //
+
+template<typename FPT>
+inline bool
+is_small( FPT fpv, FPT tolerance )
+{
+ return small_with_tolerance<FPT>( tolerance )( fpv );
+}
+
+//____________________________________________________________________________//
+
+} // namespace fpc
+} // namespace math
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER
diff --git a/boost/test/tools/fpc_op.hpp b/boost/test/tools/fpc_op.hpp
new file mode 100644
index 0000000000..a2513ccfa3
--- /dev/null
+++ b/boost/test/tools/fpc_op.hpp
@@ -0,0 +1,224 @@
+// (C) Copyright Gennadiy Rozental 2014-2015.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//!@file
+//!@brief Floating point comparison with enhanced reporting
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER
+#define BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER
+
+// Boost.Test
+#include <boost/test/tools/assertion.hpp>
+
+#include <boost/test/tools/floating_point_comparison.hpp>
+#include <boost/test/tools/fpc_tolerance.hpp>
+
+// Boost
+#include <boost/type_traits/common_type.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace assertion {
+namespace op {
+
+// ************************************************************************** //
+// ************** fpctraits ************** //
+// ************************************************************************** //
+// set of floating point comparison traits per comparison OP
+
+template<typename OP>
+struct fpctraits {
+ static const bool cmp_direct = true;
+};
+
+template <typename Lhs, typename Rhs>
+struct fpctraits<op::NE<Lhs,Rhs> > {
+ static const bool cmp_direct = false;
+};
+
+template <typename Lhs, typename Rhs>
+struct fpctraits<op::LT<Lhs,Rhs> > {
+ static const bool cmp_direct = false;
+};
+
+template <typename Lhs, typename Rhs>
+struct fpctraits<op::GT<Lhs,Rhs> > {
+ static const bool cmp_direct = false;
+};
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** set of overloads to select correct fpc algo ************** //
+// ************************************************************************** //
+// we really only care about EQ vs NE. All other comparisons use direct first
+// and then need EQ. For example a < b (tolerance t) IFF a < b OR a == b (tolerance t)
+
+template <typename FPT, typename Lhs, typename Rhs, typename OP>
+inline assertion_result
+compare_fpv( Lhs const& lhs, Rhs const& rhs, OP* )
+{
+ fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_STRONG );
+
+ assertion_result ar( P( lhs, rhs ) );
+ if( !ar )
+ ar.message() << "Relative difference exceeds tolerance ["
+ << P.tested_rel_diff() << " > " << P.fraction_tolerance() << ']';
+ return ar;
+}
+
+//____________________________________________________________________________//
+
+template <typename FPT, typename OP>
+inline assertion_result
+compare_fpv_near_zero( FPT const& fpv, OP* )
+{
+ fpc::small_with_tolerance<FPT> P( fpc_tolerance<FPT>() );
+
+ assertion_result ar( P( fpv ) );
+ if( !ar )
+ ar.message() << "Absolute value exceeds tolerance [|" << fpv << "| > "<< fpc_tolerance<FPT>() << ']';
+
+ return ar;
+}
+
+//____________________________________________________________________________//
+
+template <typename FPT, typename Lhs, typename Rhs>
+inline assertion_result
+compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE<Lhs,Rhs>* )
+{
+ fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_WEAK );
+
+ assertion_result ar( !P( lhs, rhs ) );
+ if( !ar )
+ ar.message() << "Relative difference is within tolerance ["
+ << P.tested_rel_diff() << " < " << fpc_tolerance<FPT>() << ']';
+
+ return ar;
+}
+
+//____________________________________________________________________________//
+
+template <typename FPT, typename Lhs, typename Rhs>
+inline assertion_result
+compare_fpv_near_zero( FPT const& fpv, op::NE<Lhs,Rhs>* )
+{
+ fpc::small_with_tolerance<FPT> P( fpc_tolerance<FPT>() );
+
+ assertion_result ar( !P( fpv ) );
+ if( !ar )
+ ar.message() << "Absolute value is within tolerance [|" << fpv << "| < "<< fpc_tolerance<FPT>() << ']';
+ return ar;
+}
+
+//____________________________________________________________________________//
+
+template <typename FPT, typename Lhs, typename Rhs>
+inline assertion_result
+compare_fpv( Lhs const& lhs, Rhs const& rhs, op::LT<Lhs,Rhs>* )
+{
+ return lhs >= rhs ? assertion_result( false ) : compare_fpv<FPT>( lhs, rhs, (op::NE<Lhs,Rhs>*)0 );
+}
+
+template <typename FPT, typename Lhs, typename Rhs>
+inline assertion_result
+compare_fpv_near_zero( FPT const& fpv, op::LT<Lhs,Rhs>* )
+{
+ return fpv >= 0 ? assertion_result( false ) : compare_fpv_near_zero( fpv, (op::NE<Lhs,Rhs>*)0 );
+}
+
+//____________________________________________________________________________//
+
+template <typename FPT, typename Lhs, typename Rhs>
+inline assertion_result
+compare_fpv( Lhs const& lhs, Rhs const& rhs, op::GT<Lhs,Rhs>* )
+{
+ return lhs <= rhs ? assertion_result( false ) : compare_fpv<FPT>( lhs, rhs, (op::NE<Lhs,Rhs>*)0 );
+}
+
+template <typename FPT, typename Lhs, typename Rhs>
+inline assertion_result
+compare_fpv_near_zero( FPT const& fpv, op::GT<Lhs,Rhs>* )
+{
+ return fpv <= 0 ? assertion_result( false ) : compare_fpv_near_zero( fpv, (op::NE<Lhs,Rhs>*)0 );
+}
+
+
+//____________________________________________________________________________//
+
+#define DEFINE_FPV_COMPARISON( oper, name, rev ) \
+template<typename Lhs,typename Rhs> \
+struct name<Lhs,Rhs,typename boost::enable_if_c< \
+ (fpc::tolerance_based<Lhs>::value && \
+ fpc::tolerance_based<Rhs>::value)>::type> { \
+public: \
+ typedef typename common_type<Lhs,Rhs>::type FPT; \
+ typedef name<Lhs,Rhs> OP; \
+ \
+ typedef assertion_result result_type; \
+ \
+ static bool \
+ eval_direct( Lhs const& lhs, Rhs const& rhs) \
+ { \
+ return lhs oper rhs; \
+ } \
+ \
+ static assertion_result \
+ eval( Lhs const& lhs, Rhs const& rhs) \
+ { \
+ if( lhs == 0 ) \
+ return compare_fpv_near_zero(rhs, (OP*)0); \
+ \
+ if( rhs == 0 ) \
+ return compare_fpv_near_zero(lhs, (OP*)0); \
+ \
+ bool direct_res = eval_direct( lhs, rhs ); \
+ \
+ if((direct_res && fpctraits<OP>::cmp_direct) \
+ || fpc_tolerance<FPT>() == FPT(0)) \
+ return direct_res; \
+ \
+ return compare_fpv<FPT>(lhs, rhs, (OP*)0); \
+ } \
+ \
+ template<typename PrevExprType> \
+ static void \
+ report( std::ostream& ostr, \
+ PrevExprType const& lhs, \
+ Rhs const& rhs ) \
+ { \
+ lhs.report( ostr ); \
+ ostr << revert() \
+ << tt_detail::print_helper( rhs ); \
+ } \
+ \
+ static char const* revert() \
+ { return " " #rev " "; } \
+}; \
+/**/
+
+BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_FPV_COMPARISON )
+#undef DEFINE_FPV_COMPARISON
+
+//____________________________________________________________________________//
+
+} // namespace op
+} // namespace assertion
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER
+
diff --git a/boost/test/tools/fpc_tolerance.hpp b/boost/test/tools/fpc_tolerance.hpp
new file mode 100644
index 0000000000..013b571ded
--- /dev/null
+++ b/boost/test/tools/fpc_tolerance.hpp
@@ -0,0 +1,103 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : FPC tools tolerance holder
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER
+#define BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER
+
+// Boost Test
+#include <boost/test/tree/decorator.hpp>
+#include <boost/test/tools/floating_point_comparison.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+
+namespace fpc = math::fpc;
+
+// ************************************************************************** //
+// ************** floating point comparison tolerance ************** //
+// ************************************************************************** //
+
+template<typename FPT>
+inline FPT&
+fpc_tolerance()
+{
+ static FPT s_value = 0;
+ return s_value;
+}
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+struct local_fpc_tolerance {
+ local_fpc_tolerance( FPT fraction_tolerance ) : m_old_tolerance( fpc_tolerance<FPT>() )
+ {
+ fpc_tolerance<FPT>() = fraction_tolerance;
+ }
+
+ ~local_fpc_tolerance()
+ {
+ if( m_old_tolerance != (FPT)-1 )
+ fpc_tolerance<FPT>() = m_old_tolerance;
+ }
+
+private:
+ // Data members
+ FPT m_old_tolerance;
+};
+
+//____________________________________________________________________________//
+
+} // namespace test_tools
+
+// ************************************************************************** //
+// ************** decorator::tolerance ************** //
+// ************************************************************************** //
+
+namespace unit_test {
+namespace decorator {
+
+template<typename FPT>
+inline fixture_t
+tolerance( FPT v )
+{
+ return fixture_t( test_unit_fixture_ptr(
+ new unit_test::class_based_fixture<test_tools::local_fpc_tolerance<FPT>,FPT>( v ) ) );
+}
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+inline fixture_t
+tolerance( test_tools::fpc::percent_tolerance_t<FPT> v )
+{
+ return fixture_t( test_unit_fixture_ptr(
+ new unit_test::class_based_fixture<test_tools::local_fpc_tolerance<FPT>,FPT>( boost::math::fpc::fpc_detail::fraction_tolerance<FPT>( v ) ) ) );
+}
+
+//____________________________________________________________________________//
+
+} // namespace decorator
+
+using decorator::tolerance;
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER
diff --git a/boost/test/tools/interface.hpp b/boost/test/tools/interface.hpp
new file mode 100644
index 0000000000..fe51021303
--- /dev/null
+++ b/boost/test/tools/interface.hpp
@@ -0,0 +1,376 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 81247 $
+//
+// Description : contains definition for all test tools in test toolbox
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER
+#define BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER
+
+// Boost.Test
+#include <boost/test/unit_test_log.hpp>
+#ifdef BOOST_TEST_TOOLS_DEBUGGABLE
+#include <boost/test/debug.hpp>
+#endif
+#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS
+#include <boost/test/tools/detail/expression_holder.hpp>
+#endif
+
+#include <boost/test/detail/pp_variadic.hpp>
+
+#ifdef BOOST_TEST_NO_OLD_TOOLS
+#include <boost/preprocessor/seq/to_tuple.hpp>
+
+#include <iterator>
+#endif // BOOST_TEST_NO_OLD_TOOLS
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** BOOST_TEST_<level> ************** //
+// ************************************************************************** //
+
+#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS
+#define BOOST_TEST_BUILD_ASSERTION( P ) \
+ ::boost::test_tools::tt_detail::expression_holder const& E= \
+ ::boost::test_tools::tt_detail::hold_expression( \
+ ::boost::test_tools::assertion::seed() ->* P ) \
+/**/
+#else
+#define BOOST_TEST_BUILD_ASSERTION( P ) \
+ auto const& E = ::boost::test_tools::assertion::seed()->*P \
+/**/
+#endif
+
+//____________________________________________________________________________//
+
+// Implementation based on direct predicate evaluation
+#define BOOST_TEST_TOOL_DIRECT_IMPL( P, level, M ) \
+do { \
+ ::boost::test_tools::assertion_result res = (P); \
+ report_assertion( \
+ res, \
+ BOOST_TEST_LAZY_MSG( M ), \
+ BOOST_TEST_L(__FILE__), \
+ static_cast<std::size_t>(__LINE__), \
+ ::boost::test_tools::tt_detail::level, \
+ ::boost::test_tools::tt_detail::CHECK_MSG, \
+ 0 ); \
+} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+//____________________________________________________________________________//
+
+// Implementation based on expression template construction
+#define BOOST_TEST_TOOL_ET_IMPL( P, level ) \
+do { \
+ BOOST_TEST_PASSPOINT(); \
+ BOOST_TEST_BUILD_ASSERTION( P ); \
+ ::boost::test_tools::tt_detail:: \
+ report_assertion( \
+ E.evaluate(), \
+ BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE( P ) ), \
+ BOOST_TEST_L(__FILE__), \
+ static_cast<std::size_t>(__LINE__), \
+ ::boost::test_tools::tt_detail::level, \
+ ::boost::test_tools::tt_detail::CHECK_BUILT_ASSERTION, \
+ 0 ); \
+} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+//____________________________________________________________________________//
+
+// Implementation based on expression template construction with extra tool arguments
+#define BOOST_TEST_TOOL_ET_IMPL_EX( P, level, arg ) \
+do { \
+ BOOST_TEST_PASSPOINT(); \
+ BOOST_TEST_BUILD_ASSERTION( P ); \
+ ::boost::test_tools::tt_detail:: \
+ report_assertion( \
+ ::boost::test_tools::tt_detail::assertion_evaluate(E) \
+ << arg, \
+ ::boost::test_tools::tt_detail::assertion_text( \
+ BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE(P) ), \
+ BOOST_TEST_LAZY_MSG( arg ) ), \
+ BOOST_TEST_L(__FILE__), \
+ static_cast<std::size_t>(__LINE__), \
+ ::boost::test_tools::tt_detail::level, \
+ ::boost::test_tools::tt_detail::assertion_type() \
+ << arg, \
+ 0 ); \
+} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+//____________________________________________________________________________//
+
+#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER
+
+#define BOOST_TEST_TOOL_UNIV( level, P ) \
+ BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ) \
+/**/
+
+#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \
+ BOOST_TEST_TOOL_UNIV( level, P ) \
+/**/
+
+#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE)
+
+#define BOOST_TEST_TOOL_UNIV( level, P ) \
+do { \
+ if( ::boost::debug::under_debugger() ) \
+ BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ); \
+ else \
+ BOOST_TEST_TOOL_ET_IMPL( P, level ); \
+} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \
+ BOOST_TEST_TOOL_UNIV( level, P ) \
+/**/
+
+#else
+
+#define BOOST_TEST_TOOL_UNIV( level, P ) \
+ BOOST_TEST_TOOL_ET_IMPL( P, level ) \
+/**/
+
+#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \
+ BOOST_TEST_TOOL_ET_IMPL_EX( P, level, __VA_ARGS__ ) \
+/**/
+
+#endif
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_WARN( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \
+ 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, WARN, __VA_ARGS__ ) \
+/**/
+#define BOOST_TEST_CHECK( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \
+ 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \
+/**/
+#define BOOST_TEST_REQUIRE( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \
+ 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, REQUIRE, __VA_ARGS__ )\
+/**/
+
+#define BOOST_TEST( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \
+ 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M )
+#define BOOST_TEST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M )
+
+//____________________________________________________________________________//
+
+#define BOOST_TEST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( symb, BOOST_STRINGIZE(= symb) )
+
+//____________________________________________________________________________//
+
+#ifdef BOOST_TEST_NO_OLD_TOOLS
+
+#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER
+
+#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\
+do { try { \
+ S; \
+ BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \
+} catch( E ) { \
+ BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \
+}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE)
+
+#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\
+do { try { \
+ if( ::boost::debug::under_debugger() ) \
+ BOOST_TEST_PASSPOINT(); \
+ S; \
+ BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \
+} catch( E ) { \
+ BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \
+}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+#else
+
+#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\
+do { try { \
+ BOOST_TEST_PASSPOINT(); \
+ S; \
+ BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \
+} catch( E ) { \
+ BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \
+}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+#endif
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_THROW( S, E ) \
+ BOOST_CHECK_THROW_IMPL(S, E const&, WARN, \
+ false, "exception " BOOST_STRINGIZE(E) " is expected", \
+ true , "exception " BOOST_STRINGIZE(E) " is caught" ) \
+/**/
+#define BOOST_CHECK_THROW( S, E ) \
+ BOOST_CHECK_THROW_IMPL(S, E const&, CHECK, \
+ false, "exception " BOOST_STRINGIZE(E) " is expected", \
+ true , "exception " BOOST_STRINGIZE(E) " is caught" ) \
+/**/
+#define BOOST_REQUIRE_THROW( S, E ) \
+ BOOST_CHECK_THROW_IMPL(S, E const&, REQUIRE, \
+ false, "exception " BOOST_STRINGIZE(E) " is expected", \
+ true , "exception " BOOST_STRINGIZE(E) " is caught" ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_EXCEPTION( S, E, P ) \
+ BOOST_CHECK_THROW_IMPL(S, E const& ex, WARN, \
+ false, "exception " BOOST_STRINGIZE(E) " is expected", \
+ P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \
+/**/
+#define BOOST_CHECK_EXCEPTION( S, E, P ) \
+ BOOST_CHECK_THROW_IMPL(S, E const& ex, CHECK, \
+ false, "exception " BOOST_STRINGIZE(E) " is expected", \
+ P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \
+/**/
+#define BOOST_REQUIRE_EXCEPTION( S, E, P ) \
+ BOOST_CHECK_THROW_IMPL(S, E const& ex, REQUIRE, \
+ false, "exception " BOOST_STRINGIZE(E) " is expected", \
+ P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_NO_THROW( S ) \
+ BOOST_CHECK_THROW_IMPL(S, ..., WARN, \
+ true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \
+ false, "exception thrown by " BOOST_STRINGIZE( S ) ) \
+/**/
+#define BOOST_CHECK_NO_THROW( S ) \
+ BOOST_CHECK_THROW_IMPL(S, ..., CHECK, \
+ true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \
+ false, "exception thrown by " BOOST_STRINGIZE( S ) ) \
+/**/
+#define BOOST_REQUIRE_NO_THROW( S ) \
+ BOOST_CHECK_THROW_IMPL(S, ..., REQUIRE, \
+ true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \
+ false, "exception thrown by " BOOST_STRINGIZE( S ) ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, WARN, M )
+#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, CHECK, M )
+#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, REQUIRE, M )
+
+//____________________________________________________________________________//
+
+////////////////////////////////////////////////////////////////////////////////
+///////////////////////////// DEPRECATED TOOLS /////////////////////////////
+
+#define BOOST_WARN( P ) BOOST_TEST_WARN( P )
+#define BOOST_CHECK( P ) BOOST_TEST_CHECK( P )
+#define BOOST_REQUIRE( P ) BOOST_TEST_REQUIRE( P )
+
+//____________________________________________________________________________//
+
+#define BOOST_ERROR( M ) BOOST_TEST_ERROR( M )
+#define BOOST_FAIL( M ) BOOST_TEST_FAIL( M )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_WARN( L == R )
+#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_CHECK( L == R )
+#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R )
+
+#define BOOST_WARN_NE( L, R ) BOOST_TEST_WARN( L != R )
+#define BOOST_CHECK_NE( L, R ) BOOST_TEST_CHECK( L != R )
+#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_REQUIRE( L != R )
+
+#define BOOST_WARN_LT( L, R ) BOOST_TEST_WARN( L < R )
+#define BOOST_CHECK_LT( L, R ) BOOST_TEST_CHECK( L < R )
+#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_REQUIRE( L < R )
+
+#define BOOST_WARN_LE( L, R ) BOOST_TEST_WARN( L <= R )
+#define BOOST_CHECK_LE( L, R ) BOOST_TEST_CHECK( L <= R )
+#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_REQUIRE( L <= R )
+
+#define BOOST_WARN_GT( L, R ) BOOST_TEST_WARN( L > R )
+#define BOOST_CHECK_GT( L, R ) BOOST_TEST_CHECK( L > R )
+#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_REQUIRE( L > R )
+
+#define BOOST_WARN_GE( L, R ) BOOST_TEST_WARN( L >= R )
+#define BOOST_CHECK_GE( L, R ) BOOST_TEST_CHECK( L >= R )
+#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_REQUIRE( L >= R )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_WARN( L == R, T % ::boost::test_tools::tolerance() )
+#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_CHECK( L == R, T % ::boost::test_tools::tolerance() )
+#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_REQUIRE( L == R, T % ::boost::test_tools::tolerance() )
+
+#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_WARN( L == R, ::boost::test_tools::tolerance( T ) )
+#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_CHECK( L == R, ::boost::test_tools::tolerance( T ) )
+#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::tolerance( T ) )
+
+#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_WARN( FPV == 0., ::boost::test_tools::tolerance( T ) )
+#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_CHECK( FPV == 0., ::boost::test_tools::tolerance( T ) )
+#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_REQUIRE( FPV == 0., ::boost::test_tools::tolerance( T ) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
+ BOOST_TEST_WARN( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\
+ ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \
+ ::boost::test_tools::per_element() ) \
+/**/
+
+#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
+ BOOST_TEST_CHECK( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\
+ ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \
+ ::boost::test_tools::per_element() ) \
+/**/
+
+#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
+ BOOST_TEST_REQUIRE( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\
+ ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \
+ ::boost::test_tools::per_element() ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_WARN( L == R, ::boost::test_tools::bitwise() )
+#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_CHECK( L == R, ::boost::test_tools::bitwise() )
+#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::bitwise() )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_WARN( P BOOST_PP_SEQ_TO_TUPLE(ARGS) )
+#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_CHECK( P BOOST_PP_SEQ_TO_TUPLE(ARGS) )
+#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_REQUIRE( P BOOST_PP_SEQ_TO_TUPLE(ARGS) )
+
+//____________________________________________________________________________//
+
+#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) )
+
+//____________________________________________________________________________//
+
+#endif // BOOST_TEST_NO_OLD_TOOLS
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER
diff --git a/boost/test/tools/old/impl.hpp b/boost/test/tools/old/impl.hpp
new file mode 100644
index 0000000000..e5414f566e
--- /dev/null
+++ b/boost/test/tools/old/impl.hpp
@@ -0,0 +1,358 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74248 $
+//
+// Description : implementation details for old toolbox
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER
+#define BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER
+
+// Boost.Test
+#include <boost/test/unit_test_log.hpp>
+#include <boost/test/tools/assertion_result.hpp>
+#include <boost/test/tools/floating_point_comparison.hpp>
+
+#include <boost/test/tools/detail/fwd.hpp>
+#include <boost/test/tools/detail/print_helper.hpp>
+
+// Boost
+#include <boost/limits.hpp>
+#include <boost/numeric/conversion/conversion_traits.hpp> // for numeric::conversion_traits
+#include <boost/type_traits/is_array.hpp>
+
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/arithmetic/add.hpp>
+
+// STL
+#include <cstddef> // for std::size_t
+#include <climits> // for CHAR_BIT
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace test_tools {
+namespace tt_detail {
+
+// ************************************************************************** //
+// ************** old TOOLBOX Implementation ************** //
+// ************************************************************************** //
+
+// This function adds level of indirection, but it makes sure we evaluate predicate
+// arguments only once
+
+#ifndef BOOST_TEST_PROD
+#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 ) \
+/**/
+
+#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 ) \
+ , &static_cast<const unit_test::lazy_ostream&>(unit_test::lazy_ostream::instance() \
+ << ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \
+/**/
+
+#define IMPL_FRWD( z, n, dummy ) \
+template<typename Pred \
+ BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), TEMPL_PARAMS, _ )> \
+inline bool \
+check_frwd( Pred P, unit_test::lazy_ostream const& assertion_descr, \
+ const_string file_name, std::size_t line_num, \
+ tool_level tl, check_type ct \
+ BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), FUNC_PARAMS, _ ) \
+) \
+{ \
+ return \
+ report_assertion( P( BOOST_PP_REPEAT_ ## z(BOOST_PP_ADD(n, 1), PRED_PARAMS,_) ),\
+ assertion_descr, file_name, line_num, tl, ct, \
+ BOOST_PP_ADD( n, 1 ) \
+ BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), ARG_INFO, _ ) \
+ ); \
+} \
+/**/
+
+#ifndef BOOST_TEST_MAX_PREDICATE_ARITY
+#define BOOST_TEST_MAX_PREDICATE_ARITY 5
+#endif
+
+BOOST_PP_REPEAT( BOOST_TEST_MAX_PREDICATE_ARITY, IMPL_FRWD, _ )
+
+#undef TEMPL_PARAMS
+#undef FUNC_PARAMS
+#undef PRED_INFO
+#undef ARG_INFO
+#undef IMPL_FRWD
+
+#endif
+
+//____________________________________________________________________________//
+
+template <class Left, class Right>
+inline assertion_result equal_impl( Left const& left, Right const& right )
+{
+ return left == right;
+}
+
+//____________________________________________________________________________//
+
+inline assertion_result equal_impl( char* left, char const* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
+inline assertion_result equal_impl( char const* left, char* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); }
+inline assertion_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 )
+assertion_result BOOST_TEST_DECL equal_impl( wchar_t const* left, wchar_t const* right );
+inline assertion_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 assertion_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 assertion_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
+
+//____________________________________________________________________________//
+
+struct equal_impl_frwd {
+ template <typename Left, typename Right>
+ inline assertion_result
+ call_impl( Left const& left, Right const& right, mpl::false_ ) const
+ {
+ return equal_impl( left, right );
+ }
+
+ template <typename Left, typename Right>
+ inline assertion_result
+ call_impl( Left const& left, Right const& right, mpl::true_ ) const
+ {
+ return (*this)( right, &left[0] );
+ }
+
+ template <typename Left, typename Right>
+ inline assertion_result
+ operator()( Left const& left, Right const& right ) const
+ {
+ typedef typename is_array<Left>::type left_is_array;
+ return call_impl( left, right, left_is_array() );
+ }
+};
+
+//____________________________________________________________________________//
+
+struct ne_impl {
+ template <class Left, class Right>
+ assertion_result operator()( Left const& left, Right const& right )
+ {
+ return !equal_impl_frwd()( left, right );
+ }
+};
+
+//____________________________________________________________________________//
+
+struct lt_impl {
+ template <class Left, class Right>
+ assertion_result operator()( Left const& left, Right const& right )
+ {
+ return left < right;
+ }
+};
+
+//____________________________________________________________________________//
+
+struct le_impl {
+ template <class Left, class Right>
+ assertion_result operator()( Left const& left, Right const& right )
+ {
+ return left <= right;
+ }
+};
+
+//____________________________________________________________________________//
+
+struct gt_impl {
+ template <class Left, class Right>
+ assertion_result operator()( Left const& left, Right const& right )
+ {
+ return left > right;
+ }
+};
+
+//____________________________________________________________________________//
+
+struct ge_impl {
+ template <class Left, class Right>
+ assertion_result operator()( Left const& left, Right const& right )
+ {
+ return left >= right;
+ }
+};
+
+//____________________________________________________________________________//
+
+struct equal_coll_impl {
+ template <typename Left, typename Right>
+ assertion_result operator()( Left left_begin, Left left_end, Right right_begin, Right right_end )
+ {
+ assertion_result pr( true );
+ std::size_t pos = 0;
+
+ for( ; left_begin != left_end && right_begin != right_end; ++left_begin, ++right_begin, ++pos ) {
+ if( *left_begin != *right_begin ) {
+ pr = false;
+ pr.message() << "\nMismatch at position " << pos << ": "
+ << ::boost::test_tools::tt_detail::print_helper(*left_begin)
+ << " != "
+ << ::boost::test_tools::tt_detail::print_helper(*right_begin);
+ }
+ }
+
+ if( left_begin != left_end ) {
+ std::size_t r_size = pos;
+ while( left_begin != left_end ) {
+ ++pos;
+ ++left_begin;
+ }
+
+ pr = false;
+ pr.message() << "\nCollections size mismatch: " << pos << " != " << r_size;
+ }
+
+ if( right_begin != right_end ) {
+ std::size_t l_size = pos;
+ while( right_begin != right_end ) {
+ ++pos;
+ ++right_begin;
+ }
+
+ pr = false;
+ pr.message() << "\nCollections size mismatch: " << l_size << " != " << pos;
+ }
+
+ return pr;
+ }
+};
+
+//____________________________________________________________________________//
+
+struct bitwise_equal_impl {
+ template <class Left, class Right>
+ assertion_result operator()( Left const& left, Right const& right )
+ {
+ assertion_result pr( true );
+
+ std::size_t left_bit_size = sizeof(Left)*CHAR_BIT;
+ std::size_t right_bit_size = sizeof(Right)*CHAR_BIT;
+
+ static Left const leftOne( 1 );
+ static Right const rightOne( 1 );
+
+ std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size;
+
+ for( std::size_t counter = 0; counter < total_bits; ++counter ) {
+ if( ( left & ( leftOne << counter ) ) != ( right & ( rightOne << counter ) ) ) {
+ pr = false;
+ pr.message() << "\nMismatch at position " << counter;
+ }
+ }
+
+ if( left_bit_size != right_bit_size ) {
+ pr = false;
+ pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size;
+ }
+
+ return pr;
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename FPT1, typename FPT2>
+struct comp_supertype {
+ // 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 type;
+ BOOST_STATIC_ASSERT_MSG( !is_integral<type>::value, "Only floating-point types can be compared!");
+};
+
+} // namespace tt_detail
+
+namespace fpc = math::fpc;
+
+// ************************************************************************** //
+// ************** check_is_close ************** //
+// ************************************************************************** //
+
+struct BOOST_TEST_DECL check_is_close_t {
+ // Public typedefs
+ typedef assertion_result result_type;
+
+ template<typename FPT1, typename FPT2, typename ToleranceType>
+ assertion_result
+ operator()( FPT1 left, FPT2 right, ToleranceType tolerance ) const
+ {
+ fpc::close_at_tolerance<typename tt_detail::comp_supertype<FPT1,FPT2>::type> pred( tolerance, fpc::FPC_STRONG );
+
+ assertion_result ar( pred( left, right ) );
+
+ if( !ar )
+ ar.message() << pred.tested_rel_diff();
+
+ return ar;
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename FPT1, typename FPT2, typename ToleranceType>
+inline assertion_result
+check_is_close( FPT1 left, FPT2 right, ToleranceType tolerance )
+{
+ return check_is_close_t()( left, right, tolerance );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** check_is_small ************** //
+// ************************************************************************** //
+
+struct BOOST_TEST_DECL check_is_small_t {
+ // Public typedefs
+ typedef bool result_type;
+
+ template<typename FPT>
+ bool
+ operator()( FPT fpv, FPT tolerance ) const
+ {
+ return fpc::is_small( fpv, tolerance );
+ }
+};
+
+//____________________________________________________________________________//
+
+template<typename FPT>
+inline bool
+check_is_small( FPT fpv, FPT tolerance )
+{
+ return fpc::is_small( fpv, tolerance );
+}
+
+//____________________________________________________________________________//
+
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER
diff --git a/boost/test/tools/old/interface.hpp b/boost/test/tools/old/interface.hpp
new file mode 100644
index 0000000000..0c35c82b87
--- /dev/null
+++ b/boost/test/tools/old/interface.hpp
@@ -0,0 +1,278 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 81247 $
+//
+// Description : contains definition for all test tools in old test toolbox
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER
+#define BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER
+
+// Boost
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/seq/to_tuple.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** TOOL BOX ************** //
+// ************************************************************************** //
+
+// In macros below following argument abbreviations are used:
+// P - predicate
+// M - message
+// S - statement
+// E - exception
+// L - left argument
+// R - right argument
+// TL - tool level
+// CT - check type
+// ARGS - arguments list (as PP sequence)
+
+// frwd_type:
+// 0 - args exists and need to be forwarded; call check_frwd
+// 1 - args exists, but do not need to be forwarded; call report_assertion directly
+// 2 - no arguments; call report_assertion directly
+
+#define BOOST_TEST_TOOL_PASS_PRED0( P, ARGS ) P
+#define BOOST_TEST_TOOL_PASS_PRED1( P, ARGS ) P BOOST_PP_SEQ_TO_TUPLE(ARGS)
+#define BOOST_TEST_TOOL_PASS_PRED2( P, ARGS ) P
+
+#define BOOST_TEST_TOOL_PASS_ARG( r, _, arg ) , arg, BOOST_STRINGIZE( arg )
+#define BOOST_TEST_TOOL_PASS_ARG_DSCR( r, _, arg ) , BOOST_STRINGIZE( arg )
+
+#define BOOST_TEST_TOOL_PASS_ARGS0( ARGS ) \
+ BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG, _, ARGS )
+#define BOOST_TEST_TOOL_PASS_ARGS1( ARGS ) \
+ , BOOST_PP_SEQ_SIZE(ARGS) BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG_DSCR, _, ARGS )
+#define BOOST_TEST_TOOL_PASS_ARGS2( ARGS ) \
+ , 0
+
+#define BOOST_TEST_TOOL_IMPL( frwd_type, P, assertion_descr, TL, CT, ARGS ) \
+do { \
+ BOOST_TEST_PASSPOINT(); \
+ ::boost::test_tools::tt_detail:: \
+ BOOST_PP_IF( frwd_type, report_assertion, check_frwd ) ( \
+ BOOST_JOIN( BOOST_TEST_TOOL_PASS_PRED, frwd_type )( P, ARGS ), \
+ BOOST_TEST_LAZY_MSG( assertion_descr ), \
+ BOOST_TEST_L(__FILE__), \
+ static_cast<std::size_t>(__LINE__), \
+ ::boost::test_tools::tt_detail::TL, \
+ ::boost::test_tools::tt_detail::CT \
+ BOOST_JOIN( BOOST_TEST_TOOL_PASS_ARGS, frwd_type )( ARGS ) ); \
+} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN( P ) BOOST_TEST_TOOL_IMPL( 2, \
+ (P), BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED, _ )
+#define BOOST_CHECK( P ) BOOST_TEST_TOOL_IMPL( 2, \
+ (P), BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED, _ )
+#define BOOST_REQUIRE( P ) BOOST_TEST_TOOL_IMPL( 2, \
+ (P), BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED, _ )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, WARN, CHECK_MSG, _ )
+#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, CHECK, CHECK_MSG, _ )
+#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, REQUIRE, CHECK_MSG, _ )
+
+//____________________________________________________________________________//
+
+#define BOOST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M )
+#define BOOST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M )
+
+//____________________________________________________________________________//
+
+#define BOOST_CHECK_THROW_IMPL( S, E, P, prefix, TL ) \
+do { \
+ try { \
+ BOOST_TEST_PASSPOINT(); \
+ S; \
+ BOOST_TEST_TOOL_IMPL( 2, false, "exception " BOOST_STRINGIZE(E) " is expected", \
+ TL, CHECK_MSG, _ ); \
+ } catch( E const& ex ) { \
+ ::boost::unit_test::ut_detail::ignore_unused_variable_warning( ex ); \
+ BOOST_TEST_TOOL_IMPL( 2, P, prefix BOOST_STRINGIZE( E ) " is caught", \
+ TL, CHECK_MSG, _ ); \
+ } \
+} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "exception ", WARN )
+#define BOOST_CHECK_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "exception ", CHECK )
+#define BOOST_REQUIRE_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "exception ", REQUIRE )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), "incorrect exception ", WARN )
+#define BOOST_CHECK_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), "incorrect exception ", CHECK )
+#define BOOST_REQUIRE_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), "incorrect exception ", REQUIRE )
+
+//____________________________________________________________________________//
+
+#define BOOST_CHECK_NO_THROW_IMPL( S, TL ) \
+do { \
+ try { \
+ S; \
+ BOOST_TEST_TOOL_IMPL( 2, true, "no exceptions thrown by " BOOST_STRINGIZE( S ), \
+ TL, CHECK_MSG, _ ); \
+ } catch( ... ) { \
+ BOOST_TEST_TOOL_IMPL( 2, false, "exception thrown by " BOOST_STRINGIZE( S ), \
+ TL, CHECK_MSG, _ ); \
+ } \
+} while( ::boost::test_tools::tt_detail::dummy_cond() ) \
+/**/
+
+#define BOOST_WARN_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, WARN )
+#define BOOST_CHECK_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, CHECK )
+#define BOOST_REQUIRE_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, REQUIRE )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::equal_impl_frwd(), "", WARN, CHECK_EQUAL, (L)(R) )
+#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK, CHECK_EQUAL, (L)(R) )
+#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::equal_impl_frwd(), "", REQUIRE, CHECK_EQUAL, (L)(R) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::ne_impl(), "", WARN, CHECK_NE, (L)(R) )
+#define BOOST_CHECK_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::ne_impl(), "", CHECK, CHECK_NE, (L)(R) )
+#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::ne_impl(), "", REQUIRE, CHECK_NE, (L)(R) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::lt_impl(), "", WARN, CHECK_LT, (L)(R) )
+#define BOOST_CHECK_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::lt_impl(), "", CHECK, CHECK_LT, (L)(R) )
+#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::lt_impl(), "", REQUIRE, CHECK_LT, (L)(R) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::le_impl(), "", WARN, CHECK_LE, (L)(R) )
+#define BOOST_CHECK_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::le_impl(), "", CHECK, CHECK_LE, (L)(R) )
+#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::le_impl(), "", REQUIRE, CHECK_LE, (L)(R) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::gt_impl(), "", WARN, CHECK_GT, (L)(R) )
+#define BOOST_CHECK_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::gt_impl(), "", CHECK, CHECK_GT, (L)(R) )
+#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::gt_impl(), "", REQUIRE, CHECK_GT, (L)(R) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::ge_impl(), "", WARN, CHECK_GE, (L)(R) )
+#define BOOST_CHECK_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::ge_impl(), "", CHECK, CHECK_GE, (L)(R) )
+#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::tt_detail::ge_impl(), "", REQUIRE, CHECK_GE, (L)(R) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) )
+#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) )
+#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE_FRACTION, (L)(R)(T) )
+#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE_FRACTION, (L)(R)(T) )
+#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE_FRACTION, (L)(R)(T) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_small_t(), "", WARN, CHECK_SMALL, (FPV)(T) )
+#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_small_t(), "", CHECK, CHECK_SMALL, (FPV)(T) )
+#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \
+ ::boost::test_tools::check_is_small_t(), "", REQUIRE, CHECK_SMALL, (FPV)(T) )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \
+ P, BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED_WITH_ARGS, ARGS )
+#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \
+ P, BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED_WITH_ARGS, ARGS )
+#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \
+ P, BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED_WITH_ARGS, ARGS )
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
+ BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \
+ "", WARN, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \
+/**/
+#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
+ BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \
+ "", CHECK, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \
+/**/
+#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \
+ BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \
+ "", REQUIRE, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \
+/**/
+
+//____________________________________________________________________________//
+
+#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \
+ ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", WARN, CHECK_BITWISE_EQUAL, (L)(R) )
+#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \
+ ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", CHECK, CHECK_BITWISE_EQUAL, (L)(R) )
+#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \
+ ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", REQUIRE, CHECK_BITWISE_EQUAL, (L)(R) )
+
+//____________________________________________________________________________//
+
+#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) )
+
+//____________________________________________________________________________//
+
+#ifdef BOOST_TEST_NO_NEW_TOOLS
+
+#define BOOST_TEST_WARN( P ) BOOST_WARN( P )
+#define BOOST_TEST_CHECK( P ) BOOST_CHECK( P )
+#define BOOST_TEST_REQUIRE( P ) BOOST_REQUIRE( P )
+
+#define BOOST_TEST( P ) BOOST_CHECK( P )
+
+#endif
+
+//____________________________________________________________________________//
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER
diff --git a/boost/test/tools/output_test_stream.hpp b/boost/test/tools/output_test_stream.hpp
new file mode 100644
index 0000000000..89c9ad1919
--- /dev/null
+++ b/boost/test/tools/output_test_stream.hpp
@@ -0,0 +1,96 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// @brief output_test_stream class definition
+// ***************************************************************************
+
+#ifndef BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
+#define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
+
+// Boost.Test
+#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/utils/wrap_stringstream.hpp>
+#include <boost/test/tools/assertion_result.hpp>
+
+// STL
+#include <cstddef> // for std::size_t
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** output_test_stream ************** //
+// ************************************************************************** //
+
+
+
+namespace boost {
+namespace test_tools {
+
+//! Class to be used to simplify testing of ostream-based output operations
+class BOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream {
+ typedef unit_test::const_string const_string;
+public:
+ //! Constructor
+ //!
+ //!@param[in] pattern_file_name indicates the name of the file for matching. If the
+ //! string is empty, the standard input or output streams are used instead
+ //! (depending on match_or_save)
+ //!@param[in] match_or_save if true, the pattern file will be read, otherwise it will be
+ //! written
+ //!@param[in] text_or_binary if false, opens the stream in binary mode. Otherwise the stream
+ //! is opened with default flags and the carriage returns are ignored.
+ explicit output_test_stream( const_string pattern_file_name = const_string(),
+ bool match_or_save = true,
+ bool text_or_binary = true );
+
+ // Destructor
+ ~output_test_stream();
+
+ //! Checks if the stream is empty
+ //!
+ //!@param[in] flush_stream if true, flushes the stream after the call
+ assertion_result is_empty( bool flush_stream = true );
+
+ //! Checks the length of the stream
+ //!
+ //!@param[in] length target length
+ //!@param[in] flush_stream if true, flushes the stream after the call. Set to false to call
+ //! additional checks on the same content.
+ assertion_result check_length( std::size_t length, bool flush_stream = true );
+
+ //! Checks the content of the stream against a string
+ //!
+ //!@param[in] arg_ the target stream
+ //!@param[in] flush_stream if true, flushes the stream after the call.
+ assertion_result is_equal( const_string arg_, bool flush_stream = true );
+
+ //! Checks the content of the stream against a pattern file
+ //!
+ //!@param[in] flush_stream if true, flushes the stream after the call.
+ assertion_result match_pattern( bool flush_stream = true );
+
+ //! Flushes the stream
+ void flush();
+
+private:
+ // helper functions
+ std::size_t length();
+ void sync();
+
+ struct Impl;
+ Impl* m_pimpl;
+};
+
+} // namespace test_tools
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER
diff --git a/boost/test/tree/auto_registration.hpp b/boost/test/tree/auto_registration.hpp
new file mode 100644
index 0000000000..a32e6b8ad1
--- /dev/null
+++ b/boost/test/tree/auto_registration.hpp
@@ -0,0 +1,53 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74640 $
+//
+// Description : defines auto_test_unit_registrar
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER
+#define BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/tree/decorator.hpp>
+#include <boost/test/tree/test_unit.hpp>
+
+// STL
+#include <list>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace ut_detail {
+
+// ************************************************************************** //
+// ************** auto_test_unit_registrar ************** //
+// ************************************************************************** //
+
+struct BOOST_TEST_DECL auto_test_unit_registrar {
+ // Constructors
+ auto_test_unit_registrar( test_case* tc, decorator::collector& decorators, counter_t exp_fail = 0 );
+ explicit auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector& decorators );
+ explicit auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector& decorators );
+ explicit auto_test_unit_registrar( int );
+};
+
+} // namespace ut_detail
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER
+
diff --git a/boost/test/tree/decorator.hpp b/boost/test/tree/decorator.hpp
new file mode 100644
index 0000000000..c24a0210ad
--- /dev/null
+++ b/boost/test/tree/decorator.hpp
@@ -0,0 +1,277 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 62016 $
+//
+// Description : defines decorators to be using with auto registered test units
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_DECORATOR_HPP_091911GER
+#define BOOST_TEST_TREE_DECORATOR_HPP_091911GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/detail/global_typedef.hpp>
+
+#include <boost/test/tree/fixture.hpp>
+
+#include <boost/test/tools/assertion_result.hpp>
+
+#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
+#include <boost/test/utils/trivial_singleton.hpp>
+
+// Boost
+#include <boost/shared_ptr.hpp>
+#include <boost/function/function0.hpp>
+#include <boost/function/function1.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+// STL
+#include <vector>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+class test_unit;
+
+namespace decorator {
+
+// ************************************************************************** //
+// ************** decorator::collector ************** //
+// ************************************************************************** //
+
+class base;
+typedef boost::shared_ptr<base> base_ptr;
+
+class BOOST_TEST_DECL collector : public singleton<collector> {
+public:
+ collector& operator*( base const& d );
+
+ void store_in( test_unit& tu );
+
+ void reset();
+
+private:
+ BOOST_TEST_SINGLETON_CONS( collector )
+
+ // Data members
+ std::vector<base_ptr> m_tu_decorators;
+};
+
+// ************************************************************************** //
+// ************** decorator::base ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL base {
+public:
+ // composition interface
+ collector& operator*() const;
+
+ // application interface
+ virtual void apply( test_unit& tu ) = 0;
+
+ // deep cloning interface
+ virtual base_ptr clone() const = 0;
+
+protected:
+ virtual ~base() {}
+};
+
+// ************************************************************************** //
+// ************** decorator::label ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL label : public decorator::base {
+public:
+ explicit label( const_string l ) : m_label( l ) {}
+
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu );
+ virtual base_ptr clone() const { return base_ptr(new label( m_label )); }
+
+ // Data members
+ const_string m_label;
+};
+
+// ************************************************************************** //
+// ************** decorator::expected_failures ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL expected_failures : public decorator::base {
+public:
+ explicit expected_failures( counter_t ef ) : m_exp_fail( ef ) {}
+
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu );
+ virtual base_ptr clone() const { return base_ptr(new expected_failures( m_exp_fail )); }
+
+ // Data members
+ counter_t m_exp_fail;
+};
+
+// ************************************************************************** //
+// ************** decorator::timeout ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL timeout : public decorator::base {
+public:
+ explicit timeout( unsigned t ) : m_timeout( t ) {}
+
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu );
+ virtual base_ptr clone() const { return base_ptr(new timeout( m_timeout )); }
+
+ // Data members
+ unsigned m_timeout;
+};
+
+// ************************************************************************** //
+// ************** decorator::description ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL description : public decorator::base {
+public:
+ explicit description( const_string descr ) : m_description( descr ) {}
+
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu );
+ virtual base_ptr clone() const { return base_ptr(new description( m_description )); }
+
+ // Data members
+ const_string m_description;
+};
+
+// ************************************************************************** //
+// ************** decorator::depends_on ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL depends_on : public decorator::base {
+public:
+ explicit depends_on( const_string dependency ) : m_dependency( dependency ) {}
+
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu );
+ virtual base_ptr clone() const { return base_ptr(new depends_on( m_dependency )); }
+
+ // Data members
+ const_string m_dependency;
+};
+
+// ************************************************************************** //
+// ************** decorator::enable_if/enabled/disabled ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL enable_if_impl : public decorator::base {
+protected:
+ void apply_impl( test_unit& tu, bool condition );
+};
+
+template<bool condition>
+class enable_if : public enable_if_impl {
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu ) { this->apply_impl( tu, condition ); }
+ virtual base_ptr clone() const { return base_ptr(new enable_if<condition>()); }
+};
+
+typedef enable_if<true> enabled;
+typedef enable_if<false> disabled;
+
+// ************************************************************************** //
+// ************** decorator::fixture ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL fixture_t : public decorator::base {
+public:
+ // Constructor
+ explicit fixture_t( test_unit_fixture_ptr impl ) : m_impl( impl ) {}
+
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu );
+ virtual base_ptr clone() const { return base_ptr(new fixture_t( m_impl )); }
+
+ // Data members
+ test_unit_fixture_ptr m_impl;
+};
+
+//____________________________________________________________________________//
+
+template<typename F>
+inline fixture_t
+fixture()
+{
+ return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture<F>() ) );
+}
+
+//____________________________________________________________________________//
+
+template<typename F, typename Arg>
+inline fixture_t
+fixture( Arg const& arg )
+{
+ return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture<F,Arg>( arg ) ) );
+}
+
+//____________________________________________________________________________//
+
+inline fixture_t
+fixture( boost::function<void()> const& setup, boost::function<void()> const& teardown = boost::function<void()>() )
+{
+ return fixture_t( test_unit_fixture_ptr( new unit_test::function_based_fixture( setup, teardown ) ) );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** decorator::depends_on ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL precondition : public decorator::base {
+public:
+ typedef boost::function<test_tools::assertion_result (test_unit_id)> predicate_t;
+
+ explicit precondition( predicate_t p ) : m_precondition( p ) {}
+
+private:
+ // decorator::base interface
+ virtual void apply( test_unit& tu );
+ virtual base_ptr clone() const { return base_ptr(new precondition( m_precondition )); }
+
+ // Data members
+ predicate_t m_precondition;
+};
+
+} // namespace decorator
+
+using decorator::label;
+using decorator::expected_failures;
+using decorator::timeout;
+using decorator::description;
+using decorator::depends_on;
+using decorator::enable_if;
+using decorator::enabled;
+using decorator::disabled;
+using decorator::fixture;
+using decorator::precondition;
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_DECORATOR_HPP_091911GER
diff --git a/boost/test/tree/fixture.hpp b/boost/test/tree/fixture.hpp
new file mode 100644
index 0000000000..da6befbae7
--- /dev/null
+++ b/boost/test/tree/fixture.hpp
@@ -0,0 +1,116 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74640 $
+//
+// Description : defines fixture interface and object makers
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_FIXTURE_HPP_100311GER
+#define BOOST_TEST_TREE_FIXTURE_HPP_100311GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+
+// Boost
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/function/function0.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** test_unit_fixture ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL test_unit_fixture {
+public:
+ virtual ~test_unit_fixture() {}
+
+ // Fixture interface
+ virtual void setup() = 0;
+ virtual void teardown() = 0;
+};
+
+typedef shared_ptr<test_unit_fixture> test_unit_fixture_ptr;
+
+// ************************************************************************** //
+// ************** class_based_fixture ************** //
+// ************************************************************************** //
+
+template<typename F, typename Arg=void>
+class class_based_fixture : public test_unit_fixture {
+public:
+ // Constructor
+ explicit class_based_fixture( Arg const& arg ) : m_inst(), m_arg( arg ) {}
+
+private:
+ // Fixture interface
+ virtual void setup() { m_inst.reset( new F( m_arg ) ); }
+ virtual void teardown() { m_inst.reset(); }
+
+ // Data members
+ scoped_ptr<F> m_inst;
+ Arg m_arg;
+};
+
+//____________________________________________________________________________//
+
+template<typename F>
+class class_based_fixture<F,void> : public test_unit_fixture {
+public:
+ // Constructor
+ class_based_fixture() : m_inst( 0 ) {}
+
+private:
+ // Fixture interface
+ virtual void setup() { m_inst.reset( new F ); }
+ virtual void teardown() { m_inst.reset(); }
+
+ // Data members
+ scoped_ptr<F> m_inst;
+};
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
+// ************** function_based_fixture ************** //
+// ************************************************************************** //
+
+class function_based_fixture : public test_unit_fixture {
+public:
+ // Constructor
+ function_based_fixture( boost::function<void ()> const& setup_, boost::function<void ()> const& teardown_ )
+ : m_setup( setup_ )
+ , m_teardown( teardown_ )
+ {
+ }
+
+private:
+ // Fixture interface
+ virtual void setup() { if( m_setup ) m_setup(); }
+ virtual void teardown() { if( m_teardown ) m_teardown(); }
+
+ // Data members
+ boost::function<void ()> m_setup;
+ boost::function<void ()> m_teardown;
+};
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_FIXTURE_HPP_100311GER
+
diff --git a/boost/test/tree/global_fixture.hpp b/boost/test/tree/global_fixture.hpp
new file mode 100644
index 0000000000..9ba4462a5c
--- /dev/null
+++ b/boost/test/tree/global_fixture.hpp
@@ -0,0 +1,68 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74640 $
+//
+// Description : defines global_fixture
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER
+#define BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/detail/global_typedef.hpp>
+
+#include <boost/test/tree/observer.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** global_fixture ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL global_fixture : public test_observer {
+public:
+ // Constructor
+ global_fixture();
+};
+
+//____________________________________________________________________________//
+
+namespace ut_detail {
+
+template<typename F>
+struct global_fixture_impl : public global_fixture {
+ // Constructor
+ global_fixture_impl() : m_fixture( 0 ) {}
+
+ // test observer interface
+ virtual void test_start( counter_t ) { m_fixture = new F; }
+ virtual void test_finish() { delete m_fixture; m_fixture = 0; }
+ virtual void test_aborted() { delete m_fixture; m_fixture = 0; }
+
+private:
+ // Data members
+ F* m_fixture;
+};
+
+} // namespace ut_detail
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER
+
diff --git a/boost/test/test_observer.hpp b/boost/test/tree/observer.hpp
index 4ae152c7b6..3ae96c488d 100644
--- a/boost/test/test_observer.hpp
+++ b/boost/test/tree/observer.hpp
@@ -1,15 +1,12 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines abstract interface for test observer
+//!@file
+//!@brief defines abstract interface for test observer
// ***************************************************************************
#ifndef BOOST_TEST_TEST_OBSERVER_HPP_021005GER
@@ -25,7 +22,6 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -41,24 +37,33 @@ public:
virtual void test_unit_start( test_unit const& ) {}
virtual void test_unit_finish( test_unit const&, unsigned long /* elapsed */ ) {}
- virtual void test_unit_skipped( test_unit const& ) {}
+ virtual void test_unit_skipped( test_unit const& tu, const_string ) { test_unit_skipped( tu ); }
+ virtual void test_unit_skipped( test_unit const& ) {} ///< backward compartibility
virtual void test_unit_aborted( test_unit const& ) {}
- virtual void assertion_result( bool /* passed */ ) {}
+ virtual void assertion_result( unit_test::assertion_result ar )
+ {
+ switch( ar ) {
+ case AR_PASSED: assertion_result( true ); break;
+ case AR_FAILED: assertion_result( false ); break;
+ case AR_TRIGGERED: break;
+ default: break;
+ }
+ }
virtual void exception_caught( execution_exception const& ) {}
virtual int priority() { return 0; }
protected:
+ // depracated now
+ virtual void assertion_result( bool /* passed */ ) {}
+
BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {}
};
-} // unit_test
-
+} // namespace unit_test
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_TEST_OBSERVER_HPP_021005GER
diff --git a/boost/test/tree/test_case_counter.hpp b/boost/test/tree/test_case_counter.hpp
new file mode 100644
index 0000000000..f9fa2d2bd2
--- /dev/null
+++ b/boost/test/tree/test_case_counter.hpp
@@ -0,0 +1,54 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: 74640 $
+//
+// Description : defines test_case_counter
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
+#define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/utils/class_properties.hpp>
+
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/visitor.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** test_case_counter ************** //
+// ************************************************************************** //
+
+class test_case_counter : public test_tree_visitor {
+public:
+ // Constructor
+ test_case_counter() : p_count( 0 ) {}
+
+ BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count;
+private:
+ // test tree visitor interface
+ virtual void visit( test_case const& tc ) { if( tc.is_enabled() ) ++p_count.value; }
+ virtual bool test_suite_start( test_suite const& ts ) { return ts.is_enabled(); }
+};
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER
+
diff --git a/boost/test/tree/test_case_template.hpp b/boost/test/tree/test_case_template.hpp
new file mode 100644
index 0000000000..ef2881588a
--- /dev/null
+++ b/boost/test/tree/test_case_template.hpp
@@ -0,0 +1,144 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: -1 $
+//
+// Description : defines template_test_case_gen
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER
+#define BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/detail/fwd_decl.hpp>
+#include <boost/test/detail/workaround.hpp>
+
+#include <boost/test/utils/class_properties.hpp>
+
+#include <boost/test/tree/observer.hpp>
+
+
+// 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>
+#include <boost/function/function0.hpp>
+
+#ifndef BOOST_NO_RTTI
+#include <typeinfo> // for typeid
+#else
+#include <boost/current_function.hpp>
+#endif
+
+// STL
+#include <string> // for std::string
+#include <list> // for std::list
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+
+//____________________________________________________________________________//
+
+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, const_string tc_file, std::size_t tc_line, Generator& G )
+ : m_test_case_name( tc_name )
+ , m_test_case_file( tc_file )
+ , m_test_case_line( tc_line )
+ , 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 += '<';
+#ifndef BOOST_NO_RTTI
+ full_name += typeid(TestType).name();
+#else
+ full_name += BOOST_CURRENT_FUNCTION;
+#endif
+ if( boost::is_const<TestType>::value )
+ full_name += "_const";
+ full_name += '>';
+
+ m_holder.m_test_cases.push_back( new test_case( ut_detail::normalize_test_case_name( full_name ),
+ m_test_case_file,
+ m_test_case_line,
+ test_case_template_invoker<TestCaseTemplate,TestType>() ) );
+ }
+
+private:
+ // Data members
+ const_string m_test_case_name;
+ const_string m_test_case_file;
+ std::size_t m_test_case_line;
+ 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, const_string tc_file, std::size_t tc_line )
+ {
+ 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, tc_file, tc_line, *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
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER
diff --git a/boost/test/tree/test_unit.hpp b/boost/test/tree/test_unit.hpp
new file mode 100644
index 0000000000..4791bd15ac
--- /dev/null
+++ b/boost/test/tree/test_unit.hpp
@@ -0,0 +1,275 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// Defines @ref boost::unit_test::test_unit "test_unit", @ref boost::unit_test::test_case "test_case",
+/// @ref boost::unit_test::test_suite "test_suite" and @ref boost::unit_test::master_test_suite_t "master_test_suite_t"
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER
+#define BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/detail/fwd_decl.hpp>
+
+#include <boost/test/tree/decorator.hpp>
+#include <boost/test/tree/fixture.hpp>
+
+#include <boost/test/tools/assertion_result.hpp>
+
+#include <boost/test/utils/class_properties.hpp>
+
+// Boost
+#include <boost/function/function0.hpp>
+#include <boost/function/function1.hpp>
+
+// STL
+#include <vector>
+#include <string>
+#include <map>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+namespace framework {
+class state;
+}
+
+// ************************************************************************** //
+// ************** test_unit ************** //
+// ************************************************************************** //
+
+typedef std::vector<test_unit_id> test_unit_id_list;
+
+class BOOST_TEST_DECL test_unit {
+public:
+ enum { type = TUT_ANY };
+ enum run_status { RS_DISABLED, RS_ENABLED, RS_INHERIT, RS_INVALID };
+
+ typedef std::vector<test_unit_id> id_list;
+ typedef std::vector<test_unit_fixture_ptr> fixture_list_t;
+ typedef BOOST_READONLY_PROPERTY(test_unit_id,(framework::state)) id_t;
+ typedef BOOST_READONLY_PROPERTY(test_unit_id,(test_suite)) parent_id_t;
+ typedef BOOST_READONLY_PROPERTY(id_list,(test_unit)) id_list_t;
+ typedef std::vector<decorator::base_ptr> decor_list_t;
+ typedef BOOST_READONLY_PROPERTY(std::vector<std::string>,(test_unit)) label_list_t;
+
+ typedef boost::function<test_tools::assertion_result (test_unit_id)> precondition_t;
+ typedef BOOST_READONLY_PROPERTY(std::vector<precondition_t>,(test_unit)) precond_list_t;
+
+ // preconditions management
+ void depends_on( test_unit* tu );
+ void add_precondition( precondition_t const& );
+ test_tools::assertion_result check_preconditions() const;
+
+ // labels management
+ void add_label( const_string l );
+ bool has_label( const_string l ) const;
+
+ // helper access methods
+ void increase_exp_fail( counter_t num );
+ bool is_enabled() const { return p_run_status == RS_ENABLED; }
+ std::string full_name() const;
+
+ // Public r/o properties
+ readonly_property<test_unit_type> p_type; ///< type for this test unit
+ readonly_property<const_string> p_type_name; ///< "case"/"suite"/"module"
+ readonly_property<const_string> p_file_name;
+ readonly_property<std::size_t> p_line_num;
+ id_t p_id; ///< unique id for this test unit
+ parent_id_t p_parent_id; ///< parent test suite id
+ label_list_t p_labels; ///< list of labels associated with this test unit
+
+ id_list_t p_dependencies; ///< list of test units this one depends on
+ precond_list_t p_preconditions; ///< user supplied preconditions for this test unit;
+
+ // Public r/w properties
+ readwrite_property<std::string> p_name; ///< name for this test unit
+ readwrite_property<std::string> p_description; ///< description for this test unit
+ readwrite_property<unsigned> p_timeout; ///< timeout for the test unit execution in seconds
+ readwrite_property<counter_t> p_expected_failures; ///< number of expected failures in this test unit
+
+ readwrite_property<run_status> p_default_status; ///< run status obtained by this unit during setup phase
+ readwrite_property<run_status> p_run_status; ///< run status assigned to this unit before execution phase after applying all filters
+
+ readwrite_property<counter_t> p_sibling_rank; ///< rank of this test unit amoung siblings of the same parent
+
+ readwrite_property<decor_list_t> p_decorators; ///< automatically assigned decorators; execution is delayed till framework::finalize_setup_phase function
+ readwrite_property<fixture_list_t> p_fixtures; ///< fixtures associated with this test unit
+
+protected:
+ ~test_unit();
+ // Constructor
+ test_unit( const_string tu_name, const_string tc_file, std::size_t tc_line, test_unit_type t );
+ // Master test suite constructor
+ explicit test_unit( const_string module_name );
+
+private:
+};
+
+// ************************************************************************** //
+// ************** test_unit_generator ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL test_unit_generator {
+public:
+ virtual test_unit* next() const = 0;
+
+protected:
+ BOOST_TEST_PROTECTED_VIRTUAL ~test_unit_generator() {}
+};
+
+// ************************************************************************** //
+// ************** test_case ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL test_case : public test_unit {
+public:
+ enum { type = TUT_CASE };
+
+ // Constructor
+ test_case( const_string tc_name, boost::function<void ()> const& test_func );
+ test_case( const_string tc_name, const_string tc_file, std::size_t tc_line, boost::function<void ()> const& test_func );
+
+ // Public property
+ typedef BOOST_READONLY_PROPERTY(boost::function<void ()>,(test_case)) test_func;
+
+ test_func p_test_func;
+
+private:
+ friend class framework::state;
+ ~test_case() {}
+};
+
+// ************************************************************************** //
+// ************** test_suite ************** //
+// ************************************************************************** //
+
+//! Class representing test suites
+class BOOST_TEST_DECL test_suite : public test_unit {
+public:
+ enum { type = TUT_SUITE };
+
+ // Constructor
+ explicit test_suite( const_string ts_name, const_string ts_file, std::size_t ts_line );
+
+ // test unit list management
+
+ /*!@brief Adds a test unit to a test suite.
+ *
+ * It is possible to specify the timeout and the expected failures.
+ */
+ void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 );
+
+ /// @overload
+ void add( test_unit_generator const& gen, unsigned timeout = 0 );
+
+ /// @overload
+ void add( test_unit_generator const& gen, decorator::collector& decorators );
+
+ //! Removes a test from the test suite.
+ void remove( test_unit_id id );
+
+
+ // access methods
+ test_unit_id get( const_string tu_name ) const;
+ std::size_t size() const { return m_children.size(); }
+
+protected:
+ // Master test suite constructor
+ explicit test_suite( const_string module_name );
+
+ friend BOOST_TEST_DECL
+ void traverse_test_tree( test_suite const&, test_tree_visitor&, bool );
+ friend class framework::state;
+ virtual ~test_suite() {}
+
+ typedef std::multimap<counter_t,test_unit_id> children_per_rank;
+ // Data members
+
+ test_unit_id_list m_children;
+ children_per_rank m_ranked_children; ///< maps child sibling rank to list of children with that rank
+};
+
+// ************************************************************************** //
+// ************** master_test_suite ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL master_test_suite_t : public test_suite {
+public:
+ master_test_suite_t();
+
+ // Data members
+ int argc;
+ char** argv;
+};
+
+// ************************************************************************** //
+// ************** user_tc_method_invoker ************** //
+// ************************************************************************** //
+
+namespace ut_detail {
+
+BOOST_TEST_DECL std::string normalize_test_case_name( const_string tu_name );
+
+//____________________________________________________________________________//
+
+template<typename InstanceType,typename UserTestCase>
+struct user_tc_method_invoker {
+ typedef void (UserTestCase::*TestMethod )();
+
+ user_tc_method_invoker( shared_ptr<InstanceType> inst, TestMethod test_method )
+ : m_inst( inst ), m_test_method( test_method ) {}
+
+ void operator()() { ((*m_inst).*m_test_method)(); }
+
+ shared_ptr<InstanceType> m_inst;
+ TestMethod m_test_method;
+};
+
+} // namespace ut_detail
+
+// ************************************************************************** //
+// ************** make_test_case ************** //
+// ************************************************************************** //
+
+inline test_case*
+make_test_case( boost::function<void ()> const& test_func, const_string tc_name, const_string tc_file, std::size_t tc_line )
+{
+ return new test_case( ut_detail::normalize_test_case_name( tc_name ), tc_file, tc_line, test_func );
+}
+
+//____________________________________________________________________________//
+
+template<typename UserTestCase, typename InstanceType>
+inline test_case*
+make_test_case( void (UserTestCase::* test_method )(),
+ const_string tc_name,
+ const_string tc_file,
+ std::size_t tc_line,
+ boost::shared_ptr<InstanceType> user_test_case )
+{
+ return new test_case( ut_detail::normalize_test_case_name( tc_name ),
+ tc_file,
+ tc_line,
+ ut_detail::user_tc_method_invoker<InstanceType,UserTestCase>( user_test_case, test_method ) );
+}
+
+//____________________________________________________________________________//
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER
diff --git a/boost/test/tree/traverse.hpp b/boost/test/tree/traverse.hpp
new file mode 100644
index 0000000000..461ff89ba4
--- /dev/null
+++ b/boost/test/tree/traverse.hpp
@@ -0,0 +1,58 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: -1 $
+//
+// Description : defines traverse_test_tree algorithm
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_TRAVERSE_HPP_100211GER
+#define BOOST_TEST_TREE_TRAVERSE_HPP_100211GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+
+#include <boost/test/tree/test_unit.hpp>
+#include <boost/test/tree/visitor.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** traverse_test_tree ************** //
+// ************************************************************************** //
+
+BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor&, bool ignore_status = false );
+BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor&, bool ignore_status = false );
+BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor&, bool ignore_status = false );
+
+//____________________________________________________________________________//
+
+inline void
+traverse_test_tree( test_unit const& tu, test_tree_visitor& V, bool ignore_status = false )
+{
+ if( tu.p_type == TUT_CASE )
+ traverse_test_tree( static_cast<test_case const&>( tu ), V, ignore_status );
+ else
+ traverse_test_tree( static_cast<test_suite const&>( tu ), V, ignore_status );
+}
+
+//____________________________________________________________________________//
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_TRAVERSE_HPP_100211GER
diff --git a/boost/test/tree/visitor.hpp b/boost/test/tree/visitor.hpp
new file mode 100644
index 0000000000..0dd864063b
--- /dev/null
+++ b/boost/test/tree/visitor.hpp
@@ -0,0 +1,52 @@
+// (C) Copyright Gennadiy Rozental 2011-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision: -1 $
+//
+// Description : defines test_tree_visitor
+// ***************************************************************************
+
+#ifndef BOOST_TEST_TREE_VISITOR_HPP_100211GER
+#define BOOST_TEST_TREE_VISITOR_HPP_100211GER
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+
+#include <boost/test/tree/test_unit.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** test_tree_visitor ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL test_tree_visitor {
+public:
+ // test tree visitor interface
+ virtual bool visit( test_unit const& ) { return true; }
+ virtual void visit( test_case const& tc ) { visit( (test_unit const&)tc ); }
+ virtual bool test_suite_start( test_suite const& ts ){ return visit( (test_unit const&)ts ); }
+ virtual void test_suite_finish( test_suite const& ) {}
+
+protected:
+ BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {}
+};
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_TREE_VISITOR_HPP_100211GER
+
diff --git a/boost/test/unit_test.hpp b/boost/test/unit_test.hpp
index c93e2b69ff..6181355316 100644
--- a/boost/test/unit_test.hpp
+++ b/boost/test/unit_test.hpp
@@ -1,15 +1,14 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Entry point for the end user into the Unit Test Framework.
+/// @file
+/// @brief Entry point into the Unit Test Framework
+///
+/// This header should be the only header necessary to include to start using the framework
// ***************************************************************************
#ifndef BOOST_TEST_UNIT_TEST_HPP_071894GER
@@ -45,7 +44,12 @@ namespace boost { namespace unit_test {
int BOOST_TEST_DECL unit_test_main( init_unit_test_func init_func, int argc, char* argv[] );
-}}
+}
+
+// !! ?? to remove
+namespace unit_test_framework=unit_test;
+
+}
#if defined(BOOST_TEST_DYN_LINK) && defined(BOOST_TEST_MAIN) && !defined(BOOST_TEST_NO_MAIN)
diff --git a/boost/test/unit_test_log.hpp b/boost/test/unit_test_log.hpp
index 8d9eac6a9e..76817ffcb8 100644
--- a/boost/test/unit_test_log.hpp
+++ b/boost/test/unit_test_log.hpp
@@ -1,24 +1,21 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines singleton class unit_test_log and all manipulators.
-// unit_test_log has output stream like interface. It's implementation is
-// completely hidden with pimple idiom
+/// @file
+/// @brief defines singleton class unit_test_log and all manipulators.
+/// unit_test_log has output stream like interface. It's implementation is
+/// completely hidden with pimple idiom
// ***************************************************************************
#ifndef BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER
#define BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER
// Boost.Test
-#include <boost/test/test_observer.hpp>
+#include <boost/test/tree/observer.hpp>
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/detail/log_level.hpp>
@@ -29,7 +26,6 @@
#include <boost/test/utils/lazy_ostream.hpp>
// Boost
-#include <boost/utility.hpp>
// STL
#include <iosfwd> // for std::ostream&
@@ -39,7 +35,6 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -93,17 +88,15 @@ private:
class BOOST_TEST_DECL unit_test_log_t : public test_observer, public singleton<unit_test_log_t> {
public:
// test_observer interface implementation
- void test_start( counter_t test_cases_amount );
- void test_finish();
- void test_aborted();
+ virtual void test_start( counter_t test_cases_amount );
+ virtual void test_finish();
+ virtual void test_aborted();
- void test_unit_start( test_unit const& );
- void test_unit_finish( test_unit const&, unsigned long elapsed );
- void test_unit_skipped( test_unit const& );
- void test_unit_aborted( test_unit const& );
+ virtual void test_unit_start( test_unit const& );
+ virtual void test_unit_finish( test_unit const&, unsigned long elapsed );
+ virtual void test_unit_skipped( test_unit const&, const_string );
- void assertion_result( bool passed );
- void exception_caught( execution_exception const& );
+ virtual void exception_caught( execution_exception const& ex );
virtual int priority() { return 1; }
@@ -117,7 +110,7 @@ public:
void set_checkpoint( const_string file, std::size_t line_num, const_string msg = const_string() );
// entry logging
- unit_test_log_t& operator<<( log::begin const& ); // begin entry
+ unit_test_log_t& operator<<( log::begin const& ); // begin entry
unit_test_log_t& operator<<( log::end const& ); // end entry
unit_test_log_t& operator<<( log_level ); // set entry level
unit_test_log_t& operator<<( const_string ); // log entry value
@@ -126,9 +119,12 @@ public:
ut_detail::entry_value_collector operator()( log_level ); // initiate entry collection
private:
- bool log_entry_start();
+ // Implementation helpers
+ bool log_entry_start();
+ void log_entry_context( log_level l );
+ void clear_entry_context();
- BOOST_TEST_SINGLETON_CONS( unit_test_log_t );
+ BOOST_TEST_SINGLETON_CONS( unit_test_log_t )
}; // unit_test_log_t
BOOST_TEST_SINGLETON_INST( unit_test_log )
@@ -140,7 +136,6 @@ BOOST_TEST_SINGLETON_INST( unit_test_log )
/**/
} // namespace unit_test
-
} // namespace boost
// ************************************************************************** //
@@ -149,7 +144,7 @@ BOOST_TEST_SINGLETON_INST( unit_test_log )
#define BOOST_TEST_MESSAGE( M ) \
BOOST_TEST_LOG_ENTRY( ::boost::unit_test::log_messages ) \
- << (::boost::unit_test::lazy_ostream::instance() << M) \
+ << BOOST_TEST_LAZY_MSG( M ) \
/**/
//____________________________________________________________________________//
diff --git a/boost/test/unit_test_log_formatter.hpp b/boost/test/unit_test_log_formatter.hpp
index 81f156b4b9..f89b74bd17 100644
--- a/boost/test/unit_test_log_formatter.hpp
+++ b/boost/test/unit_test_log_formatter.hpp
@@ -1,15 +1,15 @@
-// (C) Copyright Gennadiy Rozental 2003-2008.
+// (C) Copyright Gennadiy Rozental 2003-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description :
+/// @file
+/// @brief Defines unit test log formatter interface
+///
+/// You can define a class with implements this interface and use an instance of it
+/// as a Unit Test Framework log formatter
// ***************************************************************************
#ifndef BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER
@@ -20,8 +20,6 @@
#include <boost/test/detail/log_level.hpp>
#include <boost/test/detail/fwd_decl.hpp>
-#include <boost/test/execution_monitor.hpp>
-
// STL
#include <iosfwd>
#include <string> // for std::string
@@ -31,11 +29,10 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
-// ************** log_entry_data ************** //
+/// Collection of log entry attributes
// ************************************************************************** //
struct BOOST_TEST_DECL log_entry_data {
@@ -44,9 +41,9 @@ struct BOOST_TEST_DECL log_entry_data {
m_file_name.reserve( 200 );
}
- std::string m_file_name;
- std::size_t m_line_num;
- log_level m_level;
+ std::string m_file_name; ///< log entry file name
+ std::size_t m_line_num; ///< log entry line number
+ log_level m_level; ///< log entry level
void clear()
{
@@ -57,62 +54,190 @@ struct BOOST_TEST_DECL log_entry_data {
};
// ************************************************************************** //
-// ************** checkpoint_data ************** //
+/// Collection of log checkpoint attributes
// ************************************************************************** //
struct BOOST_TEST_DECL log_checkpoint_data
{
- const_string m_file_name;
- std::size_t m_line_num;
- std::string m_message;
+ const_string m_file_name; ///< log checkpoint file name
+ std::size_t m_line_num; ///< log checkpoint file name
+ std::string m_message; ///< log checkpoint message
void clear()
{
m_file_name.clear();
- m_line_num = 0;
- m_message = std::string();
+ m_line_num = 0;
+ m_message = std::string();
}
};
// ************************************************************************** //
-// ************** unit_test_log_formatter ************** //
-// ************************************************************************** //
-
+/// Abstract Unit Test Framework log formatter interface
+
+/// During the test module execution Unit Test Framework can report messages about success or failure of assertions,
+/// which test suites are being run and more (specifically which messages are reported depends on log level threshold selected by the user).
+/// All these messages constitute Unit Test Framework log. There are many ways (formats) to present these messages to the user. Boost.Test comes with
+/// two formats: "Compiler-like log format" and "XML based log format". Former is intended for human consumption and later is intended for processing
+/// by automated regression test systems. If you want to produce some other format you need to implement class with specific interface and use
+/// method unit_test_log_t::set_formatter during a test module initialization to set an active formatter. The class unit_test_log_formatter defines this
+/// interface.
+///
+/// This interface requires you to format all possible messages being produced in the log. These includes error messages about failed assertions, messages
+/// about caught exceptions and information messages about test units being started/ended. All the methods in this interface takes a reference to standard
+/// stream as a first argument. This is where final messages needs to be directed to. Also you are given all the information necessary to produce a message.
class BOOST_TEST_DECL unit_test_log_formatter {
public:
- enum log_entry_types { BOOST_UTL_ET_INFO,
- BOOST_UTL_ET_MESSAGE,
- BOOST_UTL_ET_WARNING,
- BOOST_UTL_ET_ERROR,
- BOOST_UTL_ET_FATAL_ERROR };
+ /// Types of log entries (messages written into a log)
+ enum log_entry_types { BOOST_UTL_ET_INFO, ///< Information message from the framework
+ BOOST_UTL_ET_MESSAGE, ///< Information message from the user
+ BOOST_UTL_ET_WARNING, ///< Warning (non error) condition notification message
+ BOOST_UTL_ET_ERROR, ///< Non fatal error notification message
+ BOOST_UTL_ET_FATAL_ERROR ///< Fatal error notification message
+ };
// Destructor
virtual ~unit_test_log_formatter() {}
- // Formatter interface
- virtual void log_start( std::ostream&, counter_t test_cases_amount ) = 0;
- virtual void log_finish( std::ostream& ) = 0;
- virtual void log_build_info( std::ostream& ) = 0;
+ // @name Test start/finish
+
+ /// Invoked at the beginning of test module execution
+
+ /// @param[in] os output stream to write a messages to
+ /// @param[in] test_cases_amount total test case amount to be run
+ /// @see log_finish
+ virtual void log_start( std::ostream& os, counter_t test_cases_amount ) = 0;
+
+ /// Invoked at the end of test module execution
+
+ /// @param[in] os output stream to write a messages into
+ /// @see log_start
+ virtual void log_finish( std::ostream& os ) = 0;
- virtual void test_unit_start( std::ostream&, test_unit const& tu ) = 0;
- virtual void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) = 0;
- virtual void test_unit_skipped( std::ostream&, test_unit const& ) = 0;
+ /// Invoked when Unit Test Framework build information is requested
- virtual void log_exception( std::ostream& os, log_checkpoint_data const& cd, execution_exception const& ex )
+ /// @param[in] os output stream to write a messages into
+ virtual void log_build_info( std::ostream& os ) = 0;
+ // @}
+
+ // @name Test unit start/finish
+
+ /// Invoked when test unit starts (either test suite or test case)
+
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] tu test unit being started
+ /// @see test_unit_finish
+ virtual void test_unit_start( std::ostream& os, test_unit const& tu ) = 0;
+
+ /// Invoked when test unit finishes
+
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] tu test unit being finished
+ /// @param[in] elapsed time in milliseconds spend executing this test unit
+ /// @see test_unit_start
+ virtual void test_unit_finish( std::ostream& os, test_unit const& tu, unsigned long elapsed ) = 0;
+
+ /// Invoked if test unit skipped for any reason
+
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] tu skipped test unit
+ /// @param[in] reason explanation why was it skipped
+ virtual void test_unit_skipped( std::ostream& os, test_unit const& tu, const_string reason )
{
- // for backward compatibility
- log_exception( os, cd, ex.what() );
+ test_unit_skipped( os, tu );
}
- virtual void log_exception( std::ostream&, log_checkpoint_data const&, const_string /* explanation */ ) {}
- virtual void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) = 0;
- virtual void log_entry_value( std::ostream&, const_string value ) = 0;
- virtual void log_entry_value( std::ostream&, lazy_ostream const& value ); // there is a default impl
- virtual void log_entry_finish( std::ostream& ) = 0;
+ /// Deprecated version of this interface
+ virtual void test_unit_skipped( std::ostream& os, test_unit const& tu ) {}
+
+ // @}
+
+ // @name Uncaught exception report
+
+ /// Invoked when Unit Test Framework detects uncaught exception
+
+ /// Call to this function starts uncaught exception report. It is going to followed by context information. Report is finalized by call to
+ /// log_exception_finish.
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] lcd information about the last checkpoint before the exception was triggered
+ /// @param[in] ex information about the caught exception
+ /// @see log_exception_finish
+ virtual void log_exception_start( std::ostream& os, log_checkpoint_data const& lcd, execution_exception const& ex ) = 0;
+
+ /// Invoked when Unit Test Framework detects uncaught exception
+
+ /// Call to this function finishes uncaught exception report.
+ /// @param[in] os output stream to write a messages into
+ /// @see log_exception_start
+ virtual void log_exception_finish( std::ostream& os ) = 0;
+ // @}
+
+ // @name Regular log entry
+
+ /// Invoked by Unit Test Framework to start new log entry
+
+ /// Call to this function starts new log entry. It is followed by series of log_entry_value calls and finally call to log_entry_finish.
+ /// A log entry may consist of one or more values being reported. Some of these values will be plain strings, while others can be complicated
+ /// expressions in a form of "lazy" expression template lazy_ostream.
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] led log entry attributes
+ /// @param[in] let log entry type log_entry_finish
+ /// @see log_entry_value, log_entry_finish
+ virtual void log_entry_start( std::ostream& os, log_entry_data const& led, log_entry_types let ) = 0;
+
+ /// Invoked by Unit Test Framework to report a log entry content
+
+ /// This is one of two overloaded methods to report log entry content. This one is used to report plain string value.
+ /// @param[in] os output stream to write a messages into.
+ /// @param[in] value log entry string value
+ /// @see log_entry_start, log_entry_finish
+ virtual void log_entry_value( std::ostream& os, const_string value ) = 0;
+
+ /// Invoked by Unit Test Framework to report a log entry content
+
+ /// This is one of two overloaded methods to report log entry content. This one is used to report some complicated expression passed as
+ /// an expression template lazy_ostream. In most cases default implementation provided by the framework should work as is (it just converts
+ /// the lazy expression into a string.
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] value log entry "lazy" value
+ /// @see log_entry_start, log_entry_finish
+ virtual void log_entry_value( std::ostream& os, lazy_ostream const& value ); // there is a default impl
+
+ /// Invoked by Unit Test Framework to finish a log entry report
+
+ /// @param[in] os output stream to write a messages into
+ /// @see log_entry_start, log_entry_start
+ virtual void log_entry_finish( std::ostream& os ) = 0;
+ // @}
+
+ // @name Log entry context report
+
+ /// Invoked by Unit Test Framework to start log entry context report
+
+ /// Unit Test Framework logs for failed assertions and uncaught exceptions context if one was defined by a test module.
+ /// Context consists of multiple "scopes" identified by description messages assigned by the test module using
+ /// BOOST_TEST_INFO/BOOST_TEST_CONTEXT statements.
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] l entry log_leveg, to be used to fine tune the message
+ /// @see log_entry_context, entry_context_finish
+ virtual void entry_context_start( std::ostream& os, log_level l ) = 0;
+
+ /// Invoked by Unit Test Framework to report log entry context "scope" description
+
+ /// Each "scope" description is reported by separate call to log_entry_context.
+ /// @param[in] os output stream to write a messages into
+ /// @param[in] value context "scope" description
+ /// @see log_entry_start, entry_context_finish
+ virtual void log_entry_context( std::ostream& os, const_string value ) = 0;
+
+ /// Invoked by Unit Test Framework to finish log entry context report
+
+ /// @param[in] os output stream to write a messages into
+ /// @see log_entry_start, entry_context_context
+ virtual void entry_context_finish( std::ostream& os ) = 0;
+ // @}
};
} // namespace unit_test
-
} // namespace boost
//____________________________________________________________________________//
diff --git a/boost/test/unit_test_monitor.hpp b/boost/test/unit_test_monitor.hpp
index 9ac1e139f3..b0358352e9 100644
--- a/boost/test/unit_test_monitor.hpp
+++ b/boost/test/unit_test_monitor.hpp
@@ -1,16 +1,14 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines specific version of execution monitor used to managed
-// run unit of test cases. Translates execution exception into error level
+/// @file
+/// @brief defines specific version of execution monitor used to managed run unit of test cases
+///
+/// Translates execution exception into error level
// ***************************************************************************
#ifndef BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER
@@ -20,14 +18,12 @@
#include <boost/test/execution_monitor.hpp>
#include <boost/test/detail/fwd_decl.hpp>
#include <boost/test/utils/trivial_singleton.hpp>
-#include <boost/test/utils/callback.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -36,34 +32,29 @@ namespace unit_test {
class BOOST_TEST_DECL unit_test_monitor_t : public singleton<unit_test_monitor_t>, public execution_monitor {
public:
- enum error_level {
- test_fail = 1,
+ enum error_level {
test_ok = 0,
- constructor_error = -1,
- unexpected_exception = -2,
- os_exception = -3,
- os_timeout = -4,
- fatal_error = -5, // includes both system and user
- destructor_error = -6
+ precondition_failure = -1,
+ unexpected_exception = -2,
+ os_exception = -3,
+ os_timeout = -4,
+ fatal_error = -5 // includes both system and user
};
static bool is_critical_error( error_level e ) { return e <= fatal_error; }
// monitor method
- error_level execute_and_translate( test_case const& );
+ error_level execute_and_translate( boost::function<void ()> const& func, unsigned timeout = 0 );
private:
- BOOST_TEST_SINGLETON_CONS( unit_test_monitor_t );
+ BOOST_TEST_SINGLETON_CONS( unit_test_monitor_t )
};
BOOST_TEST_SINGLETON_INST( unit_test_monitor )
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER
diff --git a/boost/test/unit_test_parameters.hpp b/boost/test/unit_test_parameters.hpp
new file mode 100644
index 0000000000..31f76d7b2f
--- /dev/null
+++ b/boost/test/unit_test_parameters.hpp
@@ -0,0 +1,92 @@
+// (C) Copyright Gennadiy Rozental 2001-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+/// @file
+/// @brief Provides access to various Unit Test Framework runtime parameters
+///
+/// Primarily for use by the framework itself
+// ***************************************************************************
+
+#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER
+#define BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER
+
+#include <boost/test/detail/global_typedef.hpp>
+#include <boost/test/detail/log_level.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+// STL
+#include <iosfwd>
+#include <list>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+namespace runtime_config {
+
+// ************************************************************************** //
+// ************** runtime_config ************** //
+// ************************************************************************** //
+
+BOOST_TEST_DECL void init( int& argc, char** argv );
+
+/// Automatically attach debugger in a location of fatal error
+BOOST_TEST_DECL bool auto_start_dbg();
+BOOST_TEST_DECL const_string break_exec_path();
+/// Should we catch system errors/sygnals?
+BOOST_TEST_DECL bool catch_sys_errors();
+/// Should we try to produce color output?
+BOOST_TEST_DECL bool color_output();
+/// Should we detect floating point exceptions?
+BOOST_TEST_DECL bool detect_fp_exceptions();
+/// Should we detect memory leaks (>0)? And if yes, which specific memory allocation should we break.
+BOOST_TEST_DECL long detect_memory_leaks();
+/// List content of test tree?
+BOOST_TEST_DECL output_format list_content();
+/// List available labels?
+BOOST_TEST_DECL bool list_labels();
+/// Which output format to use
+BOOST_TEST_DECL output_format log_format();
+/// Which log level to set
+BOOST_TEST_DECL unit_test::log_level log_level();
+/// Where to direct log stream into
+BOOST_TEST_DECL std::ostream* log_sink();
+/// If memory leak detection, where to direct the report
+BOOST_TEST_DECL const_string memory_leaks_report_file();
+/// Do not prodce result code
+BOOST_TEST_DECL bool no_result_code();
+/// Random seed to use to randomize order of test units being run
+BOOST_TEST_DECL unsigned random_seed();
+/// Which format to use to report results
+BOOST_TEST_DECL output_format report_format();
+/// Wht lever of report format to set
+BOOST_TEST_DECL unit_test::report_level report_level();
+/// Where to direct results report into
+BOOST_TEST_DECL std::ostream* report_sink();
+/// Should we save pattern (true) or match against existing pattern (used by output validation tool)
+BOOST_TEST_DECL bool save_pattern();
+/// Should Unit Test framework show the build information?
+BOOST_TEST_DECL bool show_build_info();
+/// Tells Unit Test Framework to show test progress (forces specific log level)
+BOOST_TEST_DECL bool show_progress();
+/// Specific test units to run/exclude
+BOOST_TEST_DECL std::list<std::string> const& test_to_run();
+/// Should execution monitor use alternative stack for signal handling
+BOOST_TEST_DECL bool use_alt_stack();
+/// Tells Unit Test Framework to wait for debugger to attach
+BOOST_TEST_DECL bool wait_for_debugger();
+
+} // namespace runtime_config
+} // namespace unit_test
+} // namespace boost
+
+//____________________________________________________________________________//
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER
diff --git a/boost/test/unit_test_suite.hpp b/boost/test/unit_test_suite.hpp
index 048a75f676..41d6151354 100644
--- a/boost/test/unit_test_suite.hpp
+++ b/boost/test/unit_test_suite.hpp
@@ -1,23 +1,24 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines Unit Test Framework public API
+/// @file
+/// @brief Defines Unit Test Framework public API
// ***************************************************************************
#ifndef BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
#define BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
// Boost.Test
-#include <boost/test/unit_test_suite_impl.hpp>
#include <boost/test/framework.hpp>
+#include <boost/test/tree/auto_registration.hpp>
+#include <boost/test/tree/test_case_template.hpp>
+#include <boost/test/tree/global_fixture.hpp>
+
+#include <boost/test/detail/pp_variadic.hpp>
//____________________________________________________________________________//
@@ -25,36 +26,90 @@
// ************** Non-auto (explicit) test case interface ************** //
// ************************************************************************** //
-#define BOOST_TEST_CASE( test_function ) \
-boost::unit_test::make_test_case( boost::unit_test::callback0<>(test_function), BOOST_TEST_STRINGIZE( test_function ) )
-#define BOOST_CLASS_TEST_CASE( test_function, tc_instance ) \
-boost::unit_test::make_test_case((test_function), BOOST_TEST_STRINGIZE( test_function ), tc_instance )
+#define BOOST_TEST_CASE( test_function ) \
+boost::unit_test::make_test_case( boost::function<void ()>(test_function), \
+ BOOST_TEST_STRINGIZE( test_function ), \
+ __FILE__, __LINE__ )
+#define BOOST_CLASS_TEST_CASE( test_function, tc_instance ) \
+boost::unit_test::make_test_case( (test_function), \
+ BOOST_TEST_STRINGIZE( test_function ), \
+ __FILE__, __LINE__, tc_instance )
// ************************************************************************** //
// ************** BOOST_TEST_SUITE ************** //
// ************************************************************************** //
#define BOOST_TEST_SUITE( testsuite_name ) \
-( new boost::unit_test::test_suite( testsuite_name ) )
+( new boost::unit_test::test_suite( testsuite_name, __FILE__, __LINE__ ) )
// ************************************************************************** //
// ************** BOOST_AUTO_TEST_SUITE ************** //
// ************************************************************************** //
-#define BOOST_AUTO_TEST_SUITE( suite_name ) \
+#define BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \
namespace suite_name { \
-BOOST_AUTO_TU_REGISTRAR( suite_name )( BOOST_STRINGIZE( suite_name ) ); \
+BOOST_AUTO_TU_REGISTRAR( suite_name )( \
+ BOOST_STRINGIZE( suite_name ), \
+ __FILE__, __LINE__, \
+ decorators ); \
/**/
+#define BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \
+ BOOST_AUTO_TEST_SUITE_WITH_DECOR( \
+ suite_name, \
+ boost::unit_test::decorator::collector::instance() ) \
+/**/
+
+#if BOOST_PP_VARIADICS
+#define BOOST_AUTO_TEST_SUITE( ... ) \
+ BOOST_TEST_INVOKE_IF_N_ARGS( 1, \
+ BOOST_AUTO_TEST_SUITE_NO_DECOR, \
+ BOOST_AUTO_TEST_SUITE_WITH_DECOR, \
+ __VA_ARGS__) \
+/**/
+
+#else /* BOOST_PP_VARIADICS */
+
+#define BOOST_AUTO_TEST_SUITE( suite_name ) \
+ BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \
+/**/
+
+
+#endif /* BOOST_PP_VARIADICS */
+
// ************************************************************************** //
// ************** BOOST_FIXTURE_TEST_SUITE ************** //
// ************************************************************************** //
-#define BOOST_FIXTURE_TEST_SUITE( suite_name, F ) \
-BOOST_AUTO_TEST_SUITE( suite_name ) \
+#define BOOST_FIXTURE_TEST_SUITE_WITH_DECOR(suite_name, F, decorators) \
+ BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \
+typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \
+/**/
+
+#define BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \
+ BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \
typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \
/**/
+#if BOOST_PP_VARIADICS
+
+#define BOOST_FIXTURE_TEST_SUITE( ... ) \
+ BOOST_TEST_INVOKE_IF_N_ARGS( 2, \
+ BOOST_FIXTURE_TEST_SUITE_NO_DECOR, \
+ BOOST_FIXTURE_TEST_SUITE_WITH_DECOR, \
+ __VA_ARGS__) \
+/**/
+
+#else /* BOOST_PP_VARIADICS */
+
+#define BOOST_FIXTURE_TEST_SUITE( suite_name, F ) \
+ BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \
+/**/
+
+
+#endif /* BOOST_PP_VARIADICS */
+
+
// ************************************************************************** //
// ************** BOOST_AUTO_TEST_SUITE_END ************** //
// ************************************************************************** //
@@ -68,53 +123,93 @@ BOOST_AUTO_TU_REGISTRAR( BOOST_JOIN( end_suite, __LINE__ ) )( 1 ); \
// ************** BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES ************** //
// ************************************************************************** //
+/// @deprecated use decorator instead
#define BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test_name, n ) \
-struct BOOST_AUTO_TC_UNIQUE_ID( test_name ); \
- \
-static struct BOOST_JOIN( test_name, _exp_fail_num_spec ) \
-: boost::unit_test::ut_detail:: \
- auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) > \
-{ \
- BOOST_JOIN( test_name, _exp_fail_num_spec )() \
- : boost::unit_test::ut_detail:: \
- auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) >( n ) \
- {} \
-} BOOST_JOIN( test_name, _exp_fail_num_spec_inst ); \
- \
+BOOST_TEST_DECORATOR( * boost::unit_test::expected_failures( n ) ) \
/**/
// ************************************************************************** //
// ************** BOOST_FIXTURE_TEST_CASE ************** //
// ************************************************************************** //
-#define BOOST_FIXTURE_TEST_CASE( test_name, F ) \
+#define BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, decorators ) \
struct test_name : public F { void test_method(); }; \
\
static void BOOST_AUTO_TC_INVOKER( test_name )() \
{ \
+ BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture entry."); \
test_name t; \
+ BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry."); \
t.test_method(); \
+ BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit."); \
} \
\
struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
\
BOOST_AUTO_TU_REGISTRAR( test_name )( \
boost::unit_test::make_test_case( \
- &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
- boost::unit_test::ut_detail::auto_tc_exp_fail< \
- BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
+ &BOOST_AUTO_TC_INVOKER( test_name ), \
+ #test_name, __FILE__, __LINE__ ), \
+ decorators ); \
\
void test_name::test_method() \
/**/
+#define BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, F ) \
+BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, \
+ boost::unit_test::decorator::collector::instance() ) \
+/**/
+
+#if BOOST_PP_VARIADICS
+
+#define BOOST_FIXTURE_TEST_CASE( ... ) \
+ BOOST_TEST_INVOKE_IF_N_ARGS( 2, \
+ BOOST_FIXTURE_TEST_CASE_NO_DECOR, \
+ BOOST_FIXTURE_TEST_CASE_WITH_DECOR, \
+ __VA_ARGS__) \
+/**/
+
+#else /* BOOST_PP_VARIADICS */
+
+#define BOOST_FIXTURE_TEST_CASE( test_name, F ) \
+ BOOST_FIXTURE_TEST_CASE_NO_DECOR(test_name, F) \
+/**/
+
+
+#endif /* BOOST_PP_VARIADICS */
+
// ************************************************************************** //
// ************** BOOST_AUTO_TEST_CASE ************** //
// ************************************************************************** //
+#define BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \
+ BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, \
+ BOOST_AUTO_TEST_CASE_FIXTURE ) \
+/**/
+
+#define BOOST_AUTO_TEST_CASE_WITH_DECOR( test_name, decorators ) \
+ BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, \
+ BOOST_AUTO_TEST_CASE_FIXTURE, decorators ) \
+/**/
+
+#if BOOST_PP_VARIADICS
+
+#define BOOST_AUTO_TEST_CASE( ... ) \
+ BOOST_TEST_INVOKE_IF_N_ARGS( 1, \
+ BOOST_AUTO_TEST_CASE_NO_DECOR, \
+ BOOST_AUTO_TEST_CASE_WITH_DECOR, \
+ __VA_ARGS__) \
+/**/
+
+#else /* BOOST_PP_VARIADICS */
+
#define BOOST_AUTO_TEST_CASE( test_name ) \
-BOOST_FIXTURE_TEST_CASE( test_name, BOOST_AUTO_TEST_CASE_FIXTURE )
+ BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \
/**/
+
+#endif /* BOOST_PP_VARIADICS */
+
// ************************************************************************** //
// ************** BOOST_FIXTURE_TEST_CASE_TEMPLATE ************** //
// ************************************************************************** //
@@ -128,15 +223,19 @@ struct BOOST_AUTO_TC_INVOKER( test_name ) { \
template<typename TestType> \
static void run( boost::type<TestType>* = 0 ) \
{ \
+ BOOST_TEST_CHECKPOINT('"' << #test_name <<"\" fixture entry."); \
test_name<TestType> t; \
+ BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry."); \
t.test_method(); \
+ BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit."); \
} \
}; \
\
BOOST_AUTO_TU_REGISTRAR( test_name )( \
boost::unit_test::ut_detail::template_test_case_gen< \
BOOST_AUTO_TC_INVOKER( test_name ),TL >( \
- BOOST_STRINGIZE( test_name ) ) ); \
+ BOOST_STRINGIZE( test_name ), __FILE__, __LINE__ ), \
+ boost::unit_test::decorator::collector::instance() ); \
\
template<typename type_name> \
void test_name<type_name>::test_method() \
@@ -147,43 +246,54 @@ void test_name<type_name>::test_method() \
// ************************************************************************** //
#define BOOST_AUTO_TEST_CASE_TEMPLATE( test_name, type_name, TL ) \
-BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, BOOST_AUTO_TEST_CASE_FIXTURE )
+BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, \
+ BOOST_AUTO_TEST_CASE_FIXTURE ) \
+/**/
// ************************************************************************** //
// ************** 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 ) ) \
+#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \
+ boost::unit_test::ut_detail::template_test_case_gen<name,typelist>( \
+ BOOST_TEST_STRINGIZE( name ), __FILE__, __LINE__ ) \
/**/
// ************************************************************************** //
// ************** 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>* ) \
+#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 ************** //
+// ************** BOOST_GLOBAL_FIXTURE ************** //
// ************************************************************************** //
#define BOOST_GLOBAL_FIXTURE( F ) \
-static boost::unit_test::ut_detail::global_fixture_impl<F> BOOST_JOIN( gf_, F ) ; \
+static boost::unit_test::ut_detail::global_fixture_impl<F> BOOST_JOIN( gf_, F ) \
+/**/
+
+// ************************************************************************** //
+// ************** BOOST_TEST_DECORATOR ************** //
+// ************************************************************************** //
+
+#define BOOST_TEST_DECORATOR( D ) \
+static boost::unit_test::decorator::collector const& \
+BOOST_JOIN(decorator_collector,__LINE__) = D; \
/**/
// ************************************************************************** //
@@ -198,15 +308,17 @@ struct nil_t {};
} // unit_test
} // namespace boost
-// Intentionally is in global namespace, so that FIXURE_TEST_SUITE can reset it in user code.
+// Intentionally is in global namespace, so that FIXTURE_TEST_SUITE can reset it in user code.
typedef ::boost::unit_test::ut_detail::nil_t BOOST_AUTO_TEST_CASE_FIXTURE;
// ************************************************************************** //
// ************** Auto registration facility helper macros ************** //
// ************************************************************************** //
-#define BOOST_AUTO_TU_REGISTRAR( test_name ) \
-static boost::unit_test::ut_detail::auto_test_unit_registrar BOOST_JOIN( BOOST_JOIN( test_name, _registrar ), __LINE__ )
+#define BOOST_AUTO_TU_REGISTRAR( test_name ) \
+static boost::unit_test::ut_detail::auto_test_unit_registrar \
+BOOST_JOIN( BOOST_JOIN( test_name, _registrar ), __LINE__ ) \
+/**/
#define BOOST_AUTO_TC_INVOKER( test_name ) BOOST_JOIN( test_name, _invoker )
#define BOOST_AUTO_TC_UNIQUE_ID( test_name ) BOOST_JOIN( test_name, _id )
@@ -226,7 +338,7 @@ init_unit_test_suite( int, char* [] ) {
#ifdef BOOST_TEST_MODULE
using namespace ::boost::unit_test;
assign_op( framework::master_test_suite().p_name.value, BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ), 0 );
-
+
#endif
#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
diff --git a/boost/test/unit_test_suite_impl.hpp b/boost/test/unit_test_suite_impl.hpp
deleted file mode 100644
index e3573dd9d7..0000000000
--- a/boost/test/unit_test_suite_impl.hpp
+++ /dev/null
@@ -1,434 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : defines test_unit, test_case, test_case_results, test_suite and test_tree_visitor
-// ***************************************************************************
-
-#ifndef BOOST_TEST_UNIT_TEST_SUITE_IMPL_HPP_071894GER
-#define BOOST_TEST_UNIT_TEST_SUITE_IMPL_HPP_071894GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/detail/global_typedef.hpp>
-#include <boost/test/utils/class_properties.hpp>
-#include <boost/test/utils/callback.hpp>
-#include <boost/test/detail/fwd_decl.hpp>
-#include <boost/test/detail/workaround.hpp>
-#include <boost/test/test_observer.hpp>
-
-// 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
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace unit_test {
-
-// ************************************************************************** //
-// ************** test_unit ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL test_unit {
-public:
- enum { type = tut_any };
-
- // Constructor
- test_unit( const_string tu_name, test_unit_type t );
-
- // dependencies management
- void depends_on( test_unit* tu );
- bool check_dependencies() const;
-
- // Public r/o properties
- typedef BOOST_READONLY_PROPERTY(test_unit_id,(framework_impl)) id_t;
- typedef BOOST_READONLY_PROPERTY(test_unit_id,(test_suite)) parent_id_t;
- readonly_property<test_unit_type> p_type; // type for this test unit
- readonly_property<const_string> p_type_name; // "case"/"suite"
- id_t p_id; // unique id for this test unit
- parent_id_t p_parent_id; // parent test suite id
-
- // Public r/w properties
- readwrite_property<std::string> p_name; // name for this test unit
- readwrite_property<unsigned> p_timeout; // timeout for the test unit execution
- readwrite_property<counter_t> p_expected_failures; // number of expected failures in this test unit
- mutable readwrite_property<bool> p_enabled; // enabled status for this unit
-
- void increase_exp_fail( unsigned num );
-
-protected:
- ~test_unit();
-
-private:
- // Data members
- std::list<test_unit_id> m_dependencies;
-};
-
-// ************************************************************************** //
-// ************** test_case_generator ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL test_unit_generator {
-public:
- virtual test_unit* next() const = 0;
-
-protected:
- BOOST_TEST_PROTECTED_VIRTUAL ~test_unit_generator() {}
-};
-
-// ************************************************************************** //
-// ************** test_case ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL test_case : public test_unit {
-public:
- enum { type = tut_case };
-
- // Constructor
- test_case( const_string tc_name, callback0<> const& test_func );
-
- // Access methods
- callback0<> const& test_func() const { return m_test_func; }
-
-private:
- friend class framework_impl;
- ~test_case() {}
-
- // BOOST_MSVC <= 1200 have problems with callback as property
- // Data members
- callback0<> m_test_func;
-};
-
-// ************************************************************************** //
-// ************** test_suite ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL test_suite : public test_unit {
-public:
- enum { type = tut_suite };
-
- // Constructor
- explicit test_suite( const_string ts_name );
-
- // test unit list management
- void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 );
- void add( test_unit_generator const& gen, unsigned timeout = 0 );
- void remove( test_unit_id id );
-
- // access methods
- test_unit_id get( const_string tu_name ) const;
- std::size_t size() const { return m_members.size(); }
-
-protected:
- friend BOOST_TEST_DECL
- void traverse_test_tree( test_suite const&, test_tree_visitor& );
- friend class framework_impl;
- virtual ~test_suite() {}
-
- // Data members
- std::vector<test_unit_id> m_members;
-};
-
-// ************************************************************************** //
-// ************** master_test_suite ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL master_test_suite_t : public test_suite {
-public:
- master_test_suite_t() : test_suite( "Master Test Suite" )
- , argc( 0 )
- , argv( 0 )
- {}
-
- // Data members
- int argc;
- char** argv;
-};
-
-
-// ************************************************************************** //
-// ************** test_tree_visitor ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL test_tree_visitor {
-public:
- // test tree visitor interface
- virtual void visit( test_case const& ) {}
- virtual bool test_suite_start( test_suite const& ) { return true; }
- virtual void test_suite_finish( test_suite const& ) {}
-
-protected:
- BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {}
-};
-
-// ************************************************************************** //
-// ************** traverse_test_tree ************** //
-// ************************************************************************** //
-
-BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor& );
-BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor& );
-BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor& );
-
-//____________________________________________________________________________//
-
-inline void
-traverse_test_tree( test_unit const& tu, test_tree_visitor& V )
-{
- if( tu.p_type == tut_case )
- traverse_test_tree( static_cast<test_case const&>( tu ), V );
- else
- traverse_test_tree( static_cast<test_suite const&>( tu ), V );
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** test_case_counter ************** //
-// ************************************************************************** //
-
-class test_case_counter : public test_tree_visitor {
-public:
- // Constructor
- test_case_counter() : p_count( 0 ) {}
-
- BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count;
-private:
- // test tree visitor interface
- virtual void visit( test_case const& );
- virtual bool test_suite_start( test_suite const& ts ) { return ts.p_enabled; }
-};
-
-// ************************************************************************** //
-// ************** test_being_aborted ************** //
-// ************************************************************************** //
-
-struct BOOST_TEST_DECL test_being_aborted {};
-
-// ************************************************************************** //
-// ************** object generators ************** //
-// ************************************************************************** //
-
-namespace ut_detail {
-
-BOOST_TEST_DECL std::string normalize_test_case_name( const_string tu_name );
-
-template<typename InstanceType,typename UserTestCase>
-struct user_tc_method_invoker {
- typedef void (UserTestCase::*TestMethod )();
-
- user_tc_method_invoker( shared_ptr<InstanceType> inst, TestMethod test_method )
- : m_inst( inst ), m_test_method( test_method ) {}
-
- void operator()() { ((*m_inst).*m_test_method)(); }
-
- shared_ptr<InstanceType> m_inst;
- TestMethod m_test_method;
-};
-
-} // namespace ut_detail
-
-//____________________________________________________________________________//
-
-inline test_case*
-make_test_case( callback0<> const& test_func, const_string tc_name )
-{
- return new test_case( ut_detail::normalize_test_case_name( tc_name ), test_func );
-}
-
-//____________________________________________________________________________//
-
-template<typename UserTestCase, typename InstanceType>
-inline test_case*
-make_test_case( void (UserTestCase::* test_method )(),
- const_string tc_name,
- boost::shared_ptr<InstanceType> user_test_case )
-{
- return new test_case( ut_detail::normalize_test_case_name( tc_name ),
- ut_detail::user_tc_method_invoker<InstanceType,UserTestCase>( user_test_case, test_method ) );
-}
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** auto_test_unit_registrar ************** //
-// ************************************************************************** //
-
-namespace ut_detail {
-
-struct BOOST_TEST_DECL auto_test_unit_registrar
-{
- // Constructors
- auto_test_unit_registrar( test_case* tc, counter_t exp_fail );
- explicit auto_test_unit_registrar( const_string ts_name );
- explicit auto_test_unit_registrar( test_unit_generator const& tc_gen );
- explicit auto_test_unit_registrar( int );
-
-private:
- static std::list<test_suite*>& curr_ts_store();
-};
-
-//____________________________________________________________________________//
-
-template<typename T>
-struct auto_tc_exp_fail {
- auto_tc_exp_fail() : m_value( 0 ) {}
-
- explicit auto_tc_exp_fail( unsigned v )
- : m_value( v )
- {
- instance() = this;
- }
-
- static auto_tc_exp_fail*& instance()
- {
- static auto_tc_exp_fail inst;
- static auto_tc_exp_fail* inst_ptr = &inst;
-
- return inst_ptr;
- }
-
- unsigned value() const { return m_value; }
-
-private:
- // Data members
- unsigned m_value;
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-// ************************************************************************** //
-// ************** global_fixture ************** //
-// ************************************************************************** //
-
-class BOOST_TEST_DECL global_fixture : public test_observer {
-public:
- // Constructor
- global_fixture();
-};
-
-//____________________________________________________________________________//
-
-namespace ut_detail {
-
-template<typename F>
-struct global_fixture_impl : public global_fixture {
- // Constructor
- global_fixture_impl(): m_fixure( 0 ) {}
-
- // test observer interface
- virtual void test_start( counter_t ) { m_fixure = new F; }
- virtual void test_finish() { delete m_fixure; m_fixure = 0; }
- virtual void test_aborted() { delete m_fixure; m_fixure = 0; }
-
-private:
- // Data members
- 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
-
-} // namespace boost
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_UNIT_TEST_SUITE_IMPL_HPP_071894GER
-
diff --git a/boost/test/utils/algorithm.hpp b/boost/test/utils/algorithm.hpp
index 1ad389dbaf..7a70654718 100644
--- a/boost/test/utils/algorithm.hpp
+++ b/boost/test/utils/algorithm.hpp
@@ -1,20 +1,18 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : addition to STL algorithms
+/// @file
+/// Addition to STL algorithms
// ***************************************************************************
-#ifndef BOOST_ALGORITHM_HPP_062304GER
-#define BOOST_ALGORITHM_HPP_062304GER
+#ifndef BOOST_TEST_UTILS_ALGORITHM_HPP
+#define BOOST_TEST_UTILS_ALGORITHM_HPP
+// STL
#include <utility>
#include <algorithm> // std::find
#include <functional> // std::bind1st
@@ -29,7 +27,7 @@ namespace unit_test {
/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair
/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
@@ -52,7 +50,7 @@ mismatch( InputIter1 first1, InputIter1 last1,
/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair
/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one. This algorithms
/// uses supplied predicate for collection elements comparison
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
@@ -75,14 +73,14 @@ mismatch( InputIter1 first1, InputIter1 last1,
//____________________________________________________________________________//
/// @brief this algorithm search through first collection for first element that does not belong a second one
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
/// @param last2 - second collection end iterator
template<class ForwardIterator1, class ForwardIterator2>
inline ForwardIterator1
-find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
+find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2 )
{
while( first1 != last1 ) {
@@ -96,9 +94,9 @@ find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
//____________________________________________________________________________//
-/// @brief this algorithm search through first collection for first element that does not satisfy binary
+/// @brief this algorithm search through first collection for first element that does not satisfy binary
/// predicate in conjunction will any element in second collection
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
@@ -106,8 +104,8 @@ find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
/// @param pred - predicate to be used for search
template<class ForwardIterator1, class ForwardIterator2, class Predicate>
inline ForwardIterator1
-find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
- ForwardIterator2 first2, ForwardIterator2 last2,
+find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2,
Predicate pred )
{
while( first1 != last1 ) {
@@ -122,14 +120,14 @@ find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
//____________________________________________________________________________//
/// @brief this algorithm search through first collection for last element that belongs to a second one
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
/// @param last2 - second collection end iterator
template<class BidirectionalIterator1, class ForwardIterator2>
inline BidirectionalIterator1
-find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
+find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2 )
{
if( first1 == last1 || first2 == last2 )
@@ -143,9 +141,9 @@ find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
//____________________________________________________________________________//
-/// @brief this algorithm search through first collection for last element that satisfy binary
+/// @brief this algorithm search through first collection for last element that satisfy binary
/// predicate in conjunction will at least one element in second collection
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
@@ -153,8 +151,8 @@ find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
/// @param pred - predicate to be used for search
template<class BidirectionalIterator1, class ForwardIterator2, class Predicate>
inline BidirectionalIterator1
-find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
- ForwardIterator2 first2, ForwardIterator2 last2,
+find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2,
Predicate pred )
{
if( first1 == last1 || first2 == last2 )
@@ -169,14 +167,14 @@ find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
//____________________________________________________________________________//
/// @brief this algorithm search through first collection for last element that does not belong to a second one
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
/// @param last2 - second collection end iterator
template<class BidirectionalIterator1, class ForwardIterator2>
inline BidirectionalIterator1
-find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
+find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2 )
{
if( first1 == last1 || first2 == last2 )
@@ -190,9 +188,9 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
//____________________________________________________________________________//
-/// @brief this algorithm search through first collection for last element that does not satisfy binary
+/// @brief this algorithm search through first collection for last element that does not satisfy binary
/// predicate in conjunction will any element in second collection
-
+///
/// @param first1 - first collection begin iterator
/// @param last1 - first collection end iterator
/// @param first2 - second collection begin iterator
@@ -200,8 +198,8 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
/// @param pred - predicate to be used for search
template<class BidirectionalIterator1, class ForwardIterator2, class Predicate>
inline BidirectionalIterator1
-find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
- ForwardIterator2 first2, ForwardIterator2 last2,
+find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2,
Predicate pred )
{
if( first1 == last1 || first2 == last2 )
@@ -216,13 +214,10 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
//____________________________________________________________________________//
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_ALGORITHM_HPP_062304GER
+#endif // BOOST_TEST_UTILS_ALGORITHM_HPP
diff --git a/boost/test/utils/assign_op.hpp b/boost/test/utils/assign_op.hpp
index 434219fa9d..ea49b5148b 100644
--- a/boost/test/utils/assign_op.hpp
+++ b/boost/test/utils/assign_op.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,11 +12,10 @@
// Description : overloadable assignment
// ***************************************************************************
-#ifndef BOOST_TEST_ASSIGN_OP_033005GER
-#define BOOST_TEST_ASSIGN_OP_033005GER
+#ifndef BOOST_TEST_UTILS_ASSIGN_OP_HPP
+#define BOOST_TEST_UTILS_ASSIGN_OP_HPP
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -34,8 +33,7 @@ assign_op( T& t, S const& s, long )
//____________________________________________________________________________//
} // namespace unit_test
-
} // namespace boost
-#endif // BOOST_TEST_ASSIGN_OP_033005GER
+#endif // BOOST_TEST_UTILS_ASSIGN_OP_HPP
diff --git a/boost/test/utils/basic_cstring/basic_cstring.hpp b/boost/test/utils/basic_cstring/basic_cstring.hpp
index 14742c49f9..7cbd36b328 100644
--- a/boost/test/utils/basic_cstring/basic_cstring.hpp
+++ b/boost/test/utils/basic_cstring/basic_cstring.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,17 +9,20 @@
//
// Version : $Revision$
//
-// Description : class basic_cstring wraps C string and provide std_string like
+// Description : class basic_cstring wraps C string and provide std_string like
// interface
// ***************************************************************************
-#ifndef BOOST_TEST_BASIC_CSTRING_HPP_071894GER
-#define BOOST_TEST_BASIC_CSTRING_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_HPP
+#define BOOST_TEST_UTILS_BASIC_CSTRING_HPP
// Boost.Test
#include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp>
#include <boost/test/utils/basic_cstring/bcs_char_traits.hpp>
+// Boost
+#include <boost/type_traits/remove_cv.hpp>
+
// STL
#include <string>
@@ -44,6 +47,7 @@ public:
typedef typename ut_detail::bcs_char_traits<CharT>::std_string std_string;
typedef CharT value_type;
+ typedef typename remove_cv<value_type>::type value_ret_type;
typedef value_type* pointer;
typedef value_type const* const_pointer;
typedef value_type& reference;
@@ -70,12 +74,13 @@ public:
basic_cstring();
basic_cstring( std_string const& s );
basic_cstring( pointer s );
- basic_cstring( pointer s, size_type arg_size );
+ template<typename LenType>
+ basic_cstring( pointer s, LenType len ) : m_begin( s ), m_end( m_begin + len ) {}
basic_cstring( pointer first, pointer last );
// data access methods
- value_type operator[]( size_type index ) const;
- value_type at( size_type index ) const;
+ value_ret_type operator[]( size_type index ) const;
+ value_ret_type at( size_type index ) const;
// size operators
size_type size() const;
@@ -84,25 +89,25 @@ public:
void resize( size_type new_len );
// !! only for STL container conformance use is_empty instead
- bool empty() const;
+ bool empty() const;
// Trimming
self_type& trim_right( size_type trim_size );
self_type& trim_left( size_type trim_size );
self_type& trim_right( iterator it );
self_type& trim_left( iterator it );
-#ifndef __IBMCPP__
+#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(800))
self_type& trim_left( self_type exclusions = self_type() ) ;
self_type& trim_right( self_type exclusions = self_type() ) ;
self_type& trim( self_type exclusions = self_type() ) ;
#else
- // VisualAge version 6 has in this case a problem with the default arguments.
- self_type& trim_left( self_type exclusions ) ;
- self_type& trim_right( self_type exclusions ) ;
- self_type& trim( self_type exclusions ) ;
- self_type& trim_left() { trim_left( self_type() ) ; }
- self_type& trim_right() { trim_right( self_type() ) ; }
- self_type& trim() { trim( self_type() ) ; }
+ // VA C++/XL C++ v6 and v8 has in this case a problem with the default arguments.
+ self_type& trim_left( self_type exclusions );
+ self_type& trim_right( self_type exclusions );
+ self_type& trim( self_type exclusions );
+ self_type& trim_left() { return trim_left( self_type() ); }
+ self_type& trim_right() { return trim_right( self_type() ); }
+ self_type& trim() { return trim( self_type() ); }
#endif
// Assignment operators
@@ -111,12 +116,28 @@ public:
basic_cstring& operator=( pointer s );
template<typename CharT2>
- basic_cstring& assign( basic_cstring<CharT2> const& s ) { *this = basic_cstring<CharT>( s.begin(), s.end() ); return *this; }
- basic_cstring& assign( self_type const& s, size_type pos, size_type len );
+ basic_cstring& assign( basic_cstring<CharT2> const& s )
+ {
+ return *this = basic_cstring<CharT>( s.begin(), s.end() );
+ }
+ template<typename PosType, typename LenType>
+ basic_cstring& assign( self_type const& s, PosType pos, LenType len )
+ {
+ return *this = self_type( s.m_begin + pos, len );
+ }
+
basic_cstring& assign( std_string const& s );
- basic_cstring& assign( std_string const& s, size_type pos, size_type len );
+ template<typename PosType, typename LenType>
+ basic_cstring& assign( std_string const& s, PosType pos, LenType len )
+ {
+ return *this = self_type( s.c_str() + pos, len );
+ }
basic_cstring& assign( pointer s );
- basic_cstring& assign( pointer s, size_type len );
+ template<typename LenType>
+ basic_cstring& assign( pointer s, LenType len )
+ {
+ return *this = self_type( s, len );
+ }
basic_cstring& assign( pointer f, pointer l );
// swapping
@@ -187,15 +208,6 @@ basic_cstring<CharT>::basic_cstring( pointer s )
template<typename CharT>
inline
-basic_cstring<CharT>::basic_cstring( pointer s, size_type arg_size )
-: m_begin( s ), m_end( m_begin + arg_size )
-{
-}
-
-//____________________________________________________________________________//
-
-template<typename CharT>
-inline
basic_cstring<CharT>::basic_cstring( pointer first, pointer last )
: m_begin( first )
, m_end( last )
@@ -205,7 +217,7 @@ basic_cstring<CharT>::basic_cstring( pointer first, pointer last )
//____________________________________________________________________________//
template<typename CharT>
-inline typename basic_cstring<CharT>::value_type
+inline typename basic_cstring<CharT>::value_ret_type
basic_cstring<CharT>::operator[]( size_type index ) const
{
return m_begin[index];
@@ -214,7 +226,7 @@ basic_cstring<CharT>::operator[]( size_type index ) const
//____________________________________________________________________________//
template<typename CharT>
-inline typename basic_cstring<CharT>::value_type
+inline typename basic_cstring<CharT>::value_ret_type
basic_cstring<CharT>::at( size_type index ) const
{
if( m_begin + index >= m_end )
@@ -229,7 +241,7 @@ template<typename CharT>
inline typename basic_cstring<CharT>::size_type
basic_cstring<CharT>::size() const
{
- return m_end - m_begin;
+ return static_cast<size_type>(m_end - m_begin);
}
//____________________________________________________________________________//
@@ -309,7 +321,7 @@ basic_cstring<CharT>::trim_left( basic_cstring exclusions )
if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
-
+
return trim_left( it );
}
@@ -354,7 +366,7 @@ basic_cstring<CharT>::trim_right( basic_cstring exclusions )
if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
-
+
return trim_right( it+1 );
}
@@ -404,15 +416,6 @@ basic_cstring<CharT>::operator=( pointer s )
template<typename CharT>
inline basic_cstring<CharT>&
-basic_cstring<CharT>::assign( basic_cstring<CharT> const& s, size_type pos, size_type len )
-{
- return *this = self_type( s.m_begin + pos, len );
-}
-
-//____________________________________________________________________________//
-
-template<typename CharT>
-inline basic_cstring<CharT>&
basic_cstring<CharT>::assign( std_string const& s )
{
return *this = self_type( s );
@@ -422,15 +425,6 @@ basic_cstring<CharT>::assign( std_string const& s )
template<typename CharT>
inline basic_cstring<CharT>&
-basic_cstring<CharT>::assign( std_string const& s, size_type pos, size_type len )
-{
- return *this = self_type( s.c_str() + pos, len );
-}
-
-//____________________________________________________________________________//
-
-template<typename CharT>
-inline basic_cstring<CharT>&
basic_cstring<CharT>::assign( pointer s )
{
return *this = self_type( s );
@@ -440,15 +434,6 @@ basic_cstring<CharT>::assign( pointer s )
template<typename CharT>
inline basic_cstring<CharT>&
-basic_cstring<CharT>::assign( pointer s, size_type len )
-{
- return *this = self_type( s, len );
-}
-
-//____________________________________________________________________________//
-
-template<typename CharT>
-inline basic_cstring<CharT>&
basic_cstring<CharT>::assign( pointer f, pointer l )
{
return *this = self_type( f, l );
@@ -526,7 +511,7 @@ basic_cstring<CharT>::find( basic_cstring<CharT> str ) const
++it;
}
- return it == last ? static_cast<size_type>(npos) : it - begin();
+ return it == last ? npos : static_cast<size_type>(it - begin());
}
//____________________________________________________________________________//
@@ -586,7 +571,7 @@ inline bool
operator==( basic_cstring<CharT1> const& s1, basic_cstring<CharT2> const& s2 )
{
typedef typename basic_cstring<CharT1>::traits_type traits_type;
- return s1.size() == s2.size() &&
+ return s1.size() == s2.size() &&
traits_type::compare( s1.begin(), s2.begin(), s1.size() ) == 0;
}
@@ -682,12 +667,12 @@ operator!=( typename basic_cstring<CharT>::std_string const& s2, basic_cstring<C
// ************************************************************************** //
template<typename CharT>
-inline typename basic_cstring<CharT>::value_type
+inline typename basic_cstring<CharT>::value_ret_type
first_char( basic_cstring<CharT> source )
{
- typedef typename basic_cstring<CharT>::value_type string_value_type;
+ typedef typename basic_cstring<CharT>::value_ret_type res_type;
- return source.is_empty() ? static_cast<string_value_type>(0) : *source.begin();
+ return source.is_empty() ? static_cast<res_type>(0) : *source.begin();
}
//____________________________________________________________________________//
@@ -697,12 +682,12 @@ first_char( basic_cstring<CharT> source )
// ************************************************************************** //
template<typename CharT>
-inline typename basic_cstring<CharT>::value_type
+inline typename basic_cstring<CharT>::value_ret_type
last_char( basic_cstring<CharT> source )
{
- typedef typename basic_cstring<CharT>::value_type string_value_type;
+ typedef typename basic_cstring<CharT>::value_ret_type res_type;
- return source.is_empty() ? static_cast<string_value_type>(0) : *(source.end()-1);
+ return source.is_empty() ? static_cast<res_type>(0) : *(source.end()-1);
}
//____________________________________________________________________________//
@@ -720,6 +705,28 @@ assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int )
//____________________________________________________________________________//
+template<typename CharT1, typename CharT2>
+inline std::basic_string<CharT1>&
+operator+=( std::basic_string<CharT1>& target, basic_cstring<CharT2> const& str )
+{
+ target.append( str.begin(), str.end() );
+ return target;
+}
+
+//____________________________________________________________________________//
+
+template<typename CharT1, typename CharT2>
+inline std::basic_string<CharT1>
+operator+( std::basic_string<CharT1> const& lhs, basic_cstring<CharT2> const& rhs )
+{
+ std::basic_string<CharT1> res( lhs );
+
+ res.append( rhs.begin(), rhs.end() );
+ return res;
+}
+
+//____________________________________________________________________________//
+
} // namespace unit_test
} // namespace boost
@@ -728,4 +735,4 @@ assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int )
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_BASIC_CSTRING_HPP_071894GER
+#endif // BOOST_TEST_UTILS_BASIC_CSTRING_HPP
diff --git a/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp b/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp
index f3d11a5cd2..a1865f4f94 100644
--- a/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp
+++ b/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,12 +9,12 @@
//
// Version : $Revision$
//
-// Description : basic_cstring class wrap C string and provide std_string like
+// Description : basic_cstring class wrap C string and provide std_string like
// interface
// ***************************************************************************
-#ifndef BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER
-#define BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP
+#define BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP
#include <boost/detail/workaround.hpp>
@@ -36,5 +36,5 @@ typedef char const* const c_literal_string;
} // namespace boost
-#endif // BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER
+#endif // BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP
diff --git a/boost/test/utils/basic_cstring/bcs_char_traits.hpp b/boost/test/utils/basic_cstring/bcs_char_traits.hpp
index a97d4616a2..4700d14291 100644
--- a/boost/test/utils/basic_cstring/bcs_char_traits.hpp
+++ b/boost/test/utils/basic_cstring/bcs_char_traits.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : generic char traits class; wraps std::char_traits
// ***************************************************************************
-#ifndef BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER
-#define BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP
+#define BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP
// Boost
#include <boost/config.hpp>
@@ -119,11 +119,11 @@ struct char_traits_with_find : std::string_char_traits<CharT> {
}
};
-template<> struct bcs_char_traits_impl<char> : char_traits_with_find<char> {};
-template<> struct bcs_char_traits_impl<wchar_t> : char_traits_with_find<wchar_t> {};
+template<> struct bcs_char_traits_impl<char> : public char_traits_with_find<char> {};
+template<> struct bcs_char_traits_impl<wchar_t> : public char_traits_with_find<wchar_t> {};
#else
-template<> struct bcs_char_traits_impl<char> : std::char_traits<char> {};
-template<> struct bcs_char_traits_impl<wchar_t> : std::char_traits<wchar_t> {};
+template<> struct bcs_char_traits_impl<char> : public std::char_traits<char> {};
+template<> struct bcs_char_traits_impl<wchar_t> : public std::char_traits<wchar_t> {};
#endif
template<typename CharT>
@@ -147,4 +147,4 @@ public:
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER
+#endif // BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP
diff --git a/boost/test/utils/basic_cstring/compare.hpp b/boost/test/utils/basic_cstring/compare.hpp
index 5c1416f17a..f071a2540c 100644
--- a/boost/test/utils/basic_cstring/compare.hpp
+++ b/boost/test/utils/basic_cstring/compare.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : class basic_cstring comparisons implementation
// ***************************************************************************
-#ifndef BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER
-#define BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP
+#define BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP
// Boost.Test
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
@@ -81,8 +81,8 @@ class case_ins_less : public std::binary_function<basic_cstring<CharT>,basic_cst
public:
bool operator()( basic_cstring<CharT> x, basic_cstring<CharT> y ) const
{
- return x.size() != y.size()
- ? x.size() < y.size()
+ return x.size() != y.size()
+ ? x.size() < y.size()
: ut_detail::case_ins<CharT>::compare( x.begin(), y.begin(), x.size() ) < 0;
}
};
@@ -90,7 +90,7 @@ public:
//____________________________________________________________________________//
// ************************************************************************** //
-// ************** operator < ************** //
+// ************** operators <,> ************** //
// ************************************************************************** //
template<class CharT>
@@ -99,11 +99,43 @@ operator <( boost::unit_test::basic_cstring<CharT> const& x,
boost::unit_test::basic_cstring<CharT> const& y )
{
typedef typename boost::unit_test::basic_cstring<CharT>::traits_type traits_type;
- return x.size() != y.size()
- ? x.size() < y.size()
+ return x.size() != y.size()
+ ? x.size() < y.size()
: traits_type::compare( x.begin(), y.begin(), x.size() ) < 0;
}
+//____________________________________________________________________________//
+
+template<class CharT>
+inline bool
+operator <=( boost::unit_test::basic_cstring<CharT> const& x,
+ boost::unit_test::basic_cstring<CharT> const& y )
+{
+ return !(y < x);
+}
+
+//____________________________________________________________________________//
+
+template<class CharT>
+inline bool
+operator >( boost::unit_test::basic_cstring<CharT> const& x,
+ boost::unit_test::basic_cstring<CharT> const& y )
+{
+ return y < x;
+}
+
+//____________________________________________________________________________//
+
+template<class CharT>
+inline bool
+operator >=( boost::unit_test::basic_cstring<CharT> const& x,
+ boost::unit_test::basic_cstring<CharT> const& y )
+{
+ return !(x < y);
+}
+
+//____________________________________________________________________________//
+
} // namespace unit_test
} // namespace boost
diff --git a/boost/test/utils/basic_cstring/io.hpp b/boost/test/utils/basic_cstring/io.hpp
index 1c8a2a3826..218ae6a520 100644
--- a/boost/test/utils/basic_cstring/io.hpp
+++ b/boost/test/utils/basic_cstring/io.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : basic_cstring i/o implementation
// ***************************************************************************
-#ifndef BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER
-#define BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP
+#define BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP
// Boost.Test
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
diff --git a/boost/test/utils/callback.hpp b/boost/test/utils/callback.hpp
deleted file mode 100644
index 6aa0a15773..0000000000
--- a/boost/test/utils/callback.hpp
+++ /dev/null
@@ -1,310 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description :
-// ***************************************************************************
-
-#ifndef BOOST_TEST_CALLBACK_020505GER
-#define BOOST_TEST_CALLBACK_020505GER
-
-// Boost
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(BOOST_INTEL, <= 700)
-# define BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR
-#endif
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace unit_test {
-
-namespace ut_detail {
-
-struct unused {};
-
-template<typename R>
-struct invoker {
- template<typename Functor>
- R invoke( Functor& f ) { return f(); }
- template<typename Functor, typename T1>
- R invoke( Functor& f, T1 t1 ) { return f( t1 ); }
- template<typename Functor, typename T1, typename T2>
- R invoke( Functor& f, T1 t1, T2 t2 ) { return f( t1, t2 ); }
- template<typename Functor, typename T1, typename T2, typename T3>
- R invoke( Functor& f, T1 t1, T2 t2, T3 t3 ) { return f( t1, t2, t3 ); }
-};
-
-//____________________________________________________________________________//
-
-template<>
-struct invoker<unused> {
- template<typename Functor>
- unused invoke( Functor& f ) { f(); return unused(); }
- template<typename Functor, typename T1>
- unused invoke( Functor& f, T1 t1 ) { f( t1 ); return unused(); }
- template<typename Functor, typename T1, typename T2>
- unused invoke( Functor& f, T1 t1, T2 t2 ) { f( t1, t2 ); return unused(); }
- template<typename Functor, typename T1, typename T2, typename T3>
- unused invoke( Functor& f, T1 t1, T2 t2, T3 t3 ) { f( t1, t2, t3 ); return unused(); }
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-// ************************************************************************** //
-// ************** unit_test::callback0 ************** //
-// ************************************************************************** //
-
-namespace ut_detail {
-
-template<typename R>
-struct callback0_impl {
- virtual ~callback0_impl() {}
-
- virtual R invoke() = 0;
-};
-
-//____________________________________________________________________________//
-
-template<typename R, typename Functor>
-struct callback0_impl_t : callback0_impl<R> {
- // Constructor
- explicit callback0_impl_t( Functor f ) : m_f( f ) {}
-
- virtual R invoke() { return invoker<R>().invoke( m_f ); }
-
-private:
- // Data members
- Functor m_f;
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-template<typename R = ut_detail::unused>
-class callback0 {
-public:
- // Constructors
- callback0() {}
-#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR
- callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {}
-#endif
-
- template<typename Functor>
- callback0( Functor f )
- : m_impl( new ut_detail::callback0_impl_t<R,Functor>( f ) ) {}
-
- void operator=( callback0 const& rhs ) { m_impl = rhs.m_impl; }
-
- template<typename Functor>
- void operator=( Functor f ) { m_impl.reset( new ut_detail::callback0_impl_t<R,Functor>( f ) ); }
-
- R operator()() const { return m_impl->invoke(); }
-
- bool operator!() const { return !m_impl; }
-
-private:
- // Data members
- boost::shared_ptr<ut_detail::callback0_impl<R> > m_impl;
-};
-
-// ************************************************************************** //
-// ************** unit_test::callback1 ************** //
-// ************************************************************************** //
-
-namespace ut_detail {
-
-template<typename R, typename T1>
-struct callback1_impl {
- virtual ~callback1_impl() {}
-
- virtual R invoke( T1 t1 ) = 0;
-};
-
-//____________________________________________________________________________//
-
-template<typename R, typename T1,typename Functor>
-struct callback1_impl_t : callback1_impl<R,T1> {
- // Constructor
- explicit callback1_impl_t( Functor f ) : m_f( f ) {}
-
- virtual R invoke( T1 t1 ) { return invoker<R>().invoke( m_f, t1 ); }
-
-private:
- // Data members
- Functor m_f;
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-template<typename T1,typename R = ut_detail::unused>
-class callback1 {
-public:
- // Constructors
- callback1() {}
-#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR
- callback1( callback1 const& rhs ) : m_impl( rhs.m_impl ) {}
-#endif
-
- template<typename Functor>
- callback1( Functor f )
- : m_impl( new ut_detail::callback1_impl_t<R,T1,Functor>( f ) ) {}
-
- void operator=( callback1 const& rhs ) { m_impl = rhs.m_impl; }
-
- template<typename Functor>
- void operator=( Functor f ) { m_impl.reset( new ut_detail::callback1_impl_t<R,T1,Functor>( f ) ); }
-
- R operator()( T1 t1 ) const { return m_impl->invoke( t1 ); }
-
- bool operator!() const { return !m_impl; }
-
-private:
- // Data members
- boost::shared_ptr<ut_detail::callback1_impl<R,T1> > m_impl;
-};
-
-// ************************************************************************** //
-// ************** unit_test::callback2 ************** //
-// ************************************************************************** //
-
-namespace ut_detail {
-
-template<typename R, typename T1,typename T2>
-struct callback2_impl {
- virtual ~callback2_impl() {}
-
- virtual R invoke( T1 t1, T2 t2 ) = 0;
-};
-
-//____________________________________________________________________________//
-
-template<typename R, typename T1, typename T2, typename Functor>
-struct callback2_impl_t : callback2_impl<R,T1,T2> {
- // Constructor
- explicit callback2_impl_t( Functor f ) : m_f( f ) {}
-
- virtual R invoke( T1 t1, T2 t2 ) { return invoker<R>().template invoke<Functor,T1,T2>( m_f, t1, t2 ); }
-
-private:
- // Data members
- Functor m_f;
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-template<typename T1,typename T2, typename R = ut_detail::unused>
-class callback2 {
-public:
- // Constructors
- callback2() {}
-#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR
- callback2( callback2 const& rhs ) : m_impl( rhs.m_impl ) {}
-#endif
-
- template<typename Functor>
- callback2( Functor f ) : m_impl( new ut_detail::callback2_impl_t<R,T1,T2,Functor>( f ) ) {}
-
- void operator=( callback2 const& rhs ) { m_impl = rhs.m_impl; }
-
- template<typename Functor>
- void operator=( Functor f ) { m_impl.reset( new ut_detail::callback2_impl_t<R,T1,T2,Functor>( f ) ); }
-
- R operator()( T1 t1, T2 t2 ) const { return m_impl->invoke( t1, t2 ); }
-
- bool operator!() const { return !m_impl; }
-
-private:
- // Data members
- boost::shared_ptr<ut_detail::callback2_impl<R,T1,T2> > m_impl;
-};
-
-// ************************************************************************** //
-// ************** unit_test::callback3 ************** //
-// ************************************************************************** //
-
-namespace ut_detail {
-
-template<typename R, typename T1, typename T2, typename T3>
-struct callback3_impl {
- virtual ~callback3_impl() {}
-
- virtual R invoke( T1 t1, T2 t2, T3 t3 ) = 0;
-};
-
-//____________________________________________________________________________//
-
-template<typename R, typename T1, typename T2, typename T3, typename Functor>
-struct callback3_impl_t : callback3_impl<R,T1,T2,T3> {
- // Constructor
- explicit callback3_impl_t( Functor f ) : m_f( f ) {}
-
- virtual R invoke( T1 t1, T2 t2, T3 t3 ) { return invoker<R>().invoke( m_f, t1, t2, t3 ); }
-
-private:
- // Data members
- Functor m_f;
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-template<typename T1,typename T2, typename T3, typename R = ut_detail::unused>
-class callback3 {
-public:
- // Constructors
- callback3() {}
-#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR
- callback3( callback3 const& rhs ) : m_impl( rhs.m_impl ) {}
-#endif
-
- template<typename Functor>
- callback3( Functor f )
- : m_impl( new ut_detail::callback3_impl_t<R,T1,T2,T3,Functor>( f ) ) {}
-
- void operator=( callback3 const& rhs ) { m_impl = rhs.m_impl; }
-
- template<typename Functor>
- void operator=( Functor f ) { m_impl.reset( new ut_detail::callback3_impl_t<R,T1,T2,T3,Functor>( f ) ); }
-
- R operator()( T1 t1, T2 t2, T3 t3 ) const { return m_impl->invoke( t1, t2, t3 ); }
-
- bool operator!() const { return !m_impl; }
-
-private:
- // Data members
- boost::shared_ptr<ut_detail::callback3_impl<R,T1,T2,T3> > m_impl;
-};
-
-} // namespace unit_test
-
-} // namespace boost
-
-#undef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_CALLBACK_020505GER
diff --git a/boost/test/utils/class_properties.hpp b/boost/test/utils/class_properties.hpp
index d2070dc97a..1781a17dd0 100644
--- a/boost/test/utils/class_properties.hpp
+++ b/boost/test/utils/class_properties.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,12 +9,12 @@
//
// Version : $Revision$
//
-// Description : simple facility that mimmic notion of read-only read-write
+// Description : simple facility that mimmic notion of read-only read-write
// properties in C++ classes. Original idea by Henrik Ravn.
// ***************************************************************************
-#ifndef BOOST_TEST_CLASS_PROPERTIES_HPP_071894GER
-#define BOOST_TEST_CLASS_PROPERTIES_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP
+#define BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP
// Boost.Test
#include <boost/test/detail/config.hpp>
@@ -36,7 +36,6 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -116,28 +115,6 @@ DEFINE_PROPERTY_FREE_BINARY_OPERATOR( != )
#undef DEFINE_PROPERTY_FREE_BINARY_OPERATOR
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
-
-#define DEFINE_PROPERTY_LOGICAL_OPERATOR( op ) \
-template<class PropertyType> \
-inline bool \
-operator op( bool b, class_property<PropertyType> const& p ) \
-{ \
- return b op p.get(); \
-} \
-template<class PropertyType> \
-inline bool \
-operator op( class_property<PropertyType> const& p, bool b ) \
-{ \
- return b op p.get(); \
-} \
-/**/
-
-DEFINE_PROPERTY_LOGICAL_OPERATOR( && )
-DEFINE_PROPERTY_LOGICAL_OPERATOR( || )
-
-#endif
-
// ************************************************************************** //
// ************** readonly_property ************** //
// ************************************************************************** //
@@ -209,13 +186,10 @@ public:
//____________________________________________________________________________//
} // unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#undef BOOST_TEST_NO_PROTECTED_USING
-#endif // BOOST_TEST_CLASS_PROPERTIES_HPP_071894GER
+#endif // BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP
diff --git a/boost/test/utils/custom_manip.hpp b/boost/test/utils/custom_manip.hpp
index 52705a9703..43b581df16 100644
--- a/boost/test/utils/custom_manip.hpp
+++ b/boost/test/utils/custom_manip.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : simple helpers for creating cusom output manipulators
// ***************************************************************************
-#ifndef BOOST_TEST_CUSTOM_MANIP_HPP_071894GER
-#define BOOST_TEST_CUSTOM_MANIP_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
+#define BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
// STL
#include <iosfwd>
@@ -23,7 +23,6 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -53,11 +52,8 @@ operator<<( std::ostream& ostr, custom_manip<Uniq> const& ) { return custom_prin
//____________________________________________________________________________//
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_CUSTOM_MANIP_HPP_071894GER
+#endif // BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
diff --git a/boost/test/utils/fixed_mapping.hpp b/boost/test/utils/fixed_mapping.hpp
index e8139337bb..299a77b789 100644
--- a/boost/test/utils/fixed_mapping.hpp
+++ b/boost/test/utils/fixed_mapping.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2001-2008.
+// (C) Copyright Gennadiy Rozental 2001-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : fixed sized mapping with specified invalid value
// ***************************************************************************
-#ifndef BOOST_TEST_FIXED_MAPPING_HPP_071894GER
-#define BOOST_TEST_FIXED_MAPPING_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_FIXED_MAPPING_HPP
+#define BOOST_TEST_UTILS_FIXED_MAPPING_HPP
// Boost
#include <boost/preprocessor/repetition/repeat.hpp>
@@ -32,7 +32,6 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// configurable maximum fixed sized mapping size supported by this header.
@@ -107,11 +106,8 @@ private:
};
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
#undef MAX_MAP_SIZE
@@ -120,5 +116,5 @@ private:
#undef CONSTR_DECL
#undef CONTRUCTORS
-#endif // BOOST_TEST_FIXED_MAPPING_HPP_071894GER
+#endif // BOOST_TEST_UTILS_FIXED_MAPPING_HPP
diff --git a/boost/test/utils/foreach.hpp b/boost/test/utils/foreach.hpp
index da32ae300f..d57b628cd3 100644
--- a/boost/test/utils/foreach.hpp
+++ b/boost/test/utils/foreach.hpp
@@ -1,5 +1,5 @@
// (C) Copyright Eric Niebler 2004-2005
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -11,14 +11,14 @@
// 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 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
+// 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.
// ***************************************************************************
-#ifndef BOOST_TEST_FOREACH_HPP_021005GER
-#define BOOST_TEST_FOREACH_HPP_021005GER
+#ifndef BOOST_TEST_UTILS_FOREACH_HPP
+#define BOOST_TEST_UTILS_FOREACH_HPP
// Boost.Test
#include <boost/test/detail/config.hpp>
@@ -35,9 +35,7 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
-
namespace for_each {
// ************************************************************************** //
@@ -178,6 +176,28 @@ next( static_any_t cur, C const&, mpl::true_ )
//____________________________________________________________________________//
// ************************************************************************** //
+// ************** prev ************** //
+// ************************************************************************** //
+
+template<typename C>
+inline void
+prev( static_any_t cur, C&, mpl::false_ )
+{
+ --static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( cur );
+}
+
+//____________________________________________________________________________//
+
+template<typename C>
+inline void
+prev( static_any_t cur, C const&, mpl::true_ )
+{
+ --static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( cur );
+}
+
+//____________________________________________________________________________//
+
+// ************************************************************************** //
// ************** deref ************** //
// ************************************************************************** //
@@ -233,6 +253,13 @@ deref( static_any_t cur, C const&, ::boost::type<RefType>, mpl::true_ )
BOOST_TEST_FE_IS_CONST( COL ) ) \
/**/
+#define BOOST_TEST_FE_PREV( COL ) \
+ ::boost::unit_test::for_each::prev( \
+ BOOST_TEST_FE_CUR_VAR, \
+ COL, \
+ BOOST_TEST_FE_IS_CONST( COL ) ) \
+/**/
+
#define BOOST_FOREACH_NOOP(COL) \
((void)&(COL))
@@ -266,16 +293,24 @@ for( bool BOOST_TEST_FE_CON_VAR = true;
!BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \
/**/
+#define BOOST_TEST_REVERSE_FOREACH( RefType, var, COL ) \
+if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_END( COL ) ) {} else \
+if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \
+for( bool BOOST_TEST_FE_CON_VAR = true; \
+ BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); ) \
+ \
+ if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \
+ if( (BOOST_TEST_FE_PREV( COL ), false) ) {} else \
+ for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \
+ !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \
+/**/
+
//____________________________________________________________________________//
} // namespace for_each
-
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_FOREACH_HPP_021005GER
+#endif // BOOST_TEST_UTILS_FOREACH_HPP
diff --git a/boost/test/utils/is_cstring.hpp b/boost/test/utils/is_cstring.hpp
new file mode 100644
index 0000000000..5172246c67
--- /dev/null
+++ b/boost/test/utils/is_cstring.hpp
@@ -0,0 +1,58 @@
+// (C) Copyright Gennadiy Rozental 2012-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision$
+//
+// Description : defines the is_cstring type trait
+// ***************************************************************************
+
+#ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP
+#define BOOST_TEST_UTILS_IS_CSTRING_HPP
+
+// Boost
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/decay.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** is_cstring ************** //
+// ************************************************************************** //
+
+namespace ut_detail {
+
+template<typename T>
+struct is_cstring_impl : public mpl::false_ {};
+
+template<typename T>
+struct is_cstring_impl<T const*> : public is_cstring_impl<T*> {};
+
+template<typename T>
+struct is_cstring_impl<T const* const> : public is_cstring_impl<T*> {};
+
+template<>
+struct is_cstring_impl<char*> : public mpl::true_ {};
+
+template<>
+struct is_cstring_impl<wchar_t*> : public mpl::true_ {};
+
+} // namespace ut_detail
+
+template<typename T>
+struct is_cstring : public ut_detail::is_cstring_impl<typename decay<T>::type> {};
+
+} // namespace unit_test
+} // namespace boost
+
+#endif // BOOST_TEST_UTILS_IS_CSTRING_HPP
diff --git a/boost/test/utils/is_forward_iterable.hpp b/boost/test/utils/is_forward_iterable.hpp
new file mode 100644
index 0000000000..8b46b1b268
--- /dev/null
+++ b/boost/test/utils/is_forward_iterable.hpp
@@ -0,0 +1,152 @@
+// (C) Copyright Gennadiy Rozental 2012-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+//! @file
+//! Defines the is_forward_iterable collection type trait
+// ***************************************************************************
+
+#ifndef BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP
+#define BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP
+
+#if defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_NULLPTR) || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES)
+ #define BOOST_TEST_FWD_ITERABLE_CXX03
+#endif
+
+
+#if defined(BOOST_TEST_FWD_ITERABLE_CXX03)
+// Boost
+#include <boost/mpl/bool.hpp>
+
+// STL
+#include <list>
+#include <vector>
+#include <map>
+#include <set>
+
+#else
+
+// Boost
+#include <boost/utility/declval.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/test/utils/is_cstring.hpp>
+
+// STL
+#include <utility>
+#include <type_traits>
+
+#endif
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** is_forward_iterable ************** //
+// ************************************************************************** //
+
+#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) && !defined(BOOST_TEST_DOXYGEN_DOC__)
+template<typename T>
+struct is_forward_iterable : public mpl::false_ {};
+
+template<typename T>
+struct is_forward_iterable<T const> : public is_forward_iterable<T> {};
+
+template<typename T>
+struct is_forward_iterable<T&> : public is_forward_iterable<T> {};
+
+template<typename T, typename A>
+struct is_forward_iterable< std::vector<T, A> > : public mpl::true_ {};
+
+template<typename T, typename A>
+struct is_forward_iterable< std::list<T, A> > : public mpl::true_ {};
+
+template<typename K, typename V, typename C, typename A>
+struct is_forward_iterable< std::map<K, V, C, A> > : public mpl::true_ {};
+
+template<typename K, typename C, typename A>
+struct is_forward_iterable< std::set<K, C, A> > : public mpl::true_ {};
+
+#else
+
+namespace ut_detail {
+
+ template<typename T>
+ struct is_present : public mpl::true_ {};
+
+ // some compiler do not implement properly decltype non expression involving members (eg. VS2013)
+ // a workaround is to use -> decltype syntax.
+ template <class T>
+ struct has_member_size {
+ private:
+ struct nil_t {};
+ template<typename U> static auto test(U*) -> decltype( boost::declval<U>().size() );
+ template<typename> static nil_t test(...);
+
+ public:
+ static bool const value = !std::is_same< decltype(test<T>(nullptr)), nil_t>::value;
+ };
+
+ template <class T>
+ struct has_member_begin {
+ private:
+ struct nil_t {};
+ template<typename U> static auto test(U*) -> decltype( boost::declval<U>().begin() );
+ template<typename> static nil_t test(...);
+ public:
+ static bool const value = !std::is_same< decltype(test<T>(nullptr)), nil_t>::value;
+ };
+
+ template <class T>
+ struct has_member_end {
+ private:
+ struct nil_t {};
+ template<typename U> static auto test(U*) -> decltype( boost::declval<U>().end() );
+ template<typename> static nil_t test(...);
+ public:
+ static bool const value = !std::is_same< decltype(test<T>(nullptr)), nil_t>::value;
+ };
+
+ template <class T, class enabled = void>
+ struct is_forward_iterable_impl : std::false_type
+ {};
+
+ template <class T>
+ struct is_forward_iterable_impl<
+ T,
+ typename std::enable_if<
+ is_present<typename T::const_iterator>::value &&
+ is_present<typename T::value_type>::value &&
+ has_member_size<T>::value &&
+ has_member_begin<T>::value &&
+ has_member_end<T>::value &&
+ !is_cstring<T>::value
+ >::type
+ > : std::true_type
+ {};
+
+
+} // namespace ut_detail
+
+
+/*! Indicates that a specific type implements the forward iterable concept.
+ */
+template<typename T>
+struct is_forward_iterable {
+ typedef typename std::remove_reference<T>::type T_ref;
+ typedef ut_detail::is_forward_iterable_impl<T_ref> is_fwd_it_t;
+ typedef mpl::bool_<is_fwd_it_t::value> type;
+ enum { value = is_fwd_it_t::value };
+};
+
+#endif /* defined(BOOST_TEST_FWD_ITERABLE_CXX03) */
+
+} // namespace unit_test
+} // namespace boost
+
+#endif // BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP
diff --git a/boost/test/utils/iterator/ifstream_line_iterator.hpp b/boost/test/utils/iterator/ifstream_line_iterator.hpp
index d41b09d8f8..9a2154828c 100644
--- a/boost/test/utils/iterator/ifstream_line_iterator.hpp
+++ b/boost/test/utils/iterator/ifstream_line_iterator.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,11 +9,11 @@
//
// Version : $Revision$
//
-// Description :
+// Description :
// ***************************************************************************
-#ifndef BOOST_IFSTREAM_LINE_ITERATOR_HPP_071894GER
-#define BOOST_IFSTREAM_LINE_ITERATOR_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_IFSTREAM_LINE_ITERATOR_HPP
+#define BOOST_TEST_UTILS_IFSTREAM_LINE_ITERATOR_HPP
// Boost
#include <boost/test/utils/iterator/istream_line_iterator.hpp>
@@ -87,6 +87,7 @@ public:
#ifdef BOOST_MSVC
# pragma warning(default: 4355)
+# pragma warning(pop)
#endif
typedef basic_ifstream_line_iterator<char> ifstream_line_iterator;
@@ -100,5 +101,5 @@ typedef basic_ifstream_line_iterator<wchar_t> wifstream_line_iterator;
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_IFSTREAM_LINE_ITERATOR_HPP_071894GER
+#endif // BOOST_TEST_UTILS_IFSTREAM_LINE_ITERATOR_HPP
diff --git a/boost/test/utils/iterator/input_iterator_facade.hpp b/boost/test/utils/iterator/input_iterator_facade.hpp
index 6ce07b2af2..a160808971 100644
--- a/boost/test/utils/iterator/input_iterator_facade.hpp
+++ b/boost/test/utils/iterator/input_iterator_facade.hpp
@@ -1,19 +1,16 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : Input iterator facade
+//!@file
+//! Input iterator facade
// ***************************************************************************
-#ifndef BOOST_INPUT_ITERATOR_FACADE_HPP_071894GER
-#define BOOST_INPUT_ITERATOR_FACADE_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP
+#define BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP
// Boost
#include <boost/iterator/iterator_facade.hpp>
@@ -80,7 +77,7 @@ private:
// iterator facade interface implementation
void increment()
{
- // we make post-end incrementation indefinetly safe
+ // we make post-end incrementation indefinetly safe
if( m_valid )
m_valid = input_iterator_core_access::get( *static_cast<Derived*>(this) );
}
@@ -105,5 +102,5 @@ private:
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_INPUT_ITERATOR_FACADE_HPP_071894GER
+#endif // BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP
diff --git a/boost/test/utils/iterator/istream_line_iterator.hpp b/boost/test/utils/iterator/istream_line_iterator.hpp
index 5aa517d7c8..f75be9ca77 100644
--- a/boost/test/utils/iterator/istream_line_iterator.hpp
+++ b/boost/test/utils/iterator/istream_line_iterator.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,11 +9,11 @@
//
// Version : $Revision$
//
-// Description :
+// Description :
// ***************************************************************************
-#ifndef BOOST_ISTREAM_LINE_ITERATOR_HPP_071894GER
-#define BOOST_ISTREAM_LINE_ITERATOR_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_ISTREAM_LINE_ITERATOR_HPP
+#define BOOST_TEST_UTILS_ISTREAM_LINE_ITERATOR_HPP
// Boost
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
@@ -58,7 +58,7 @@ public:
this->init();
}
explicit basic_istream_line_iterator( istream_type& input )
- : m_input_stream( &input )
+ : m_input_stream( &input )
, m_delimeter( input.widen( '\n' ) )
{
this->init();
@@ -89,5 +89,5 @@ typedef basic_istream_line_iterator<wchar_t> wistream_line_iterator;
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_ISTREAM_LINE_ITERATOR_HPP_071894GER
+#endif // BOOST_TEST_UTILS_ISTREAM_LINE_ITERATOR_HPP
diff --git a/boost/test/utils/iterator/token_iterator.hpp b/boost/test/utils/iterator/token_iterator.hpp
index 001507847d..c41f071739 100644
--- a/boost/test/utils/iterator/token_iterator.hpp
+++ b/boost/test/utils/iterator/token_iterator.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : token iterator for string and range tokenization
// ***************************************************************************
-#ifndef BOOST_TOKEN_ITERATOR_HPP_071894GER
-#define BOOST_TOKEN_ITERATOR_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP
+#define BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP
// Boost
#include <boost/config.hpp>
@@ -47,7 +47,7 @@ namespace unit_test {
// ************** ti_delimeter_type ************** //
// ************************************************************************** //
-enum ti_delimeter_type {
+enum ti_delimeter_type {
dt_char, // character is delimeter if it among explicit list of some characters
dt_ispunct, // character is delimeter if it satisfies ispunct functor
dt_isspace, // character is delimeter if it satisfies isspace functor
@@ -93,7 +93,7 @@ public:
void set_delimeters( Src d )
{
nfp::optionally_assign( m_delimeters, d );
-
+
if( !m_delimeters.is_empty() )
m_type = dt_char;
}
@@ -135,7 +135,7 @@ struct token_assigner {
template<typename Iterator, typename C, typename T>
static void assign( Iterator b, Iterator e, std::basic_string<C,T>& t )
{ for( ; b != e; ++b ) t += *b; }
-
+
template<typename Iterator, typename C>
static void assign( Iterator b, Iterator e, basic_cstring<C>& t ) { t.assign( b, e ); }
#else
@@ -151,7 +151,7 @@ struct token_assigner {
template<>
struct token_assigner<single_pass_traversal_tag> {
template<typename Iterator, typename Token>
- static void assign( Iterator b, Iterator e, Token& t ) {}
+ static void assign( Iterator /*b*/, Iterator /*e*/, Token& /*t*/ ) {}
template<typename Iterator, typename Token>
static void append_move( Iterator& b, Token& t ) { t += *b; ++b; }
@@ -213,7 +213,7 @@ protected:
nfp::optionally_assign( m_tokens_left, m, max_tokens );
}
- template<typename Iter>
+ template<typename Iter>
bool get( Iter& begin, Iter end )
{
typedef ut_detail::token_assigner<BOOST_DEDUCED_TYPENAME iterator_traversal<Iter>::type> Assigner;
@@ -240,22 +240,22 @@ protected:
Assigner::append_move( begin, this->m_value );
--m_tokens_left;
- }
+ }
else { // m_keep_empty_tokens is true
check_point = begin;
if( begin == end ) {
- if( m_token_produced )
+ if( m_token_produced )
return false;
m_token_produced = true;
}
if( m_is_kept( *begin ) ) {
- if( m_token_produced )
+ if( m_token_produced )
Assigner::append_move( begin, this->m_value );
m_token_produced = !m_token_produced;
- }
+ }
else if( !m_token_produced && m_is_dropped( *begin ) )
m_token_produced = true;
else {
@@ -414,5 +414,5 @@ make_range_token_iterator( Iter begin, Iter end, Modifier const& m )
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TOKEN_ITERATOR_HPP_071894GER
+#endif // BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP
diff --git a/boost/test/utils/lazy_ostream.hpp b/boost/test/utils/lazy_ostream.hpp
index 87d96602f9..8aef34133b 100644
--- a/boost/test/utils/lazy_ostream.hpp
+++ b/boost/test/utils/lazy_ostream.hpp
@@ -1,19 +1,15 @@
-// (C) Copyright Gennadiy Rozental 2008.
+// (C) Copyright Gennadiy Rozental 2008-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
// Description : contains definition for all test tools in test toolbox
// ***************************************************************************
-#ifndef BOOST_TEST_LAZY_OSTREAM_HPP_070708GER
-#define BOOST_TEST_LAZY_OSTREAM_HPP_070708GER
+#ifndef BOOST_TEST_UTILS_LAZY_OSTREAM_HPP
+#define BOOST_TEST_UTILS_LAZY_OSTREAM_HPP
// Boost.Test
#include <boost/test/detail/config.hpp>
@@ -30,11 +26,12 @@
// ************************************************************************** //
namespace boost {
-
namespace unit_test {
class lazy_ostream {
public:
+ virtual ~lazy_ostream() {}
+
static lazy_ostream& instance() { static lazy_ostream inst; return inst; }
friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); }
@@ -45,13 +42,7 @@ public:
// actual printing interface; to be accessed only by this class and children
virtual std::ostream& operator()( std::ostream& ostr ) const { return ostr; }
protected:
- explicit lazy_ostream( bool empty = true ) : m_empty( empty ) {}
-
- // protected destructor to make sure right one is called
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
-public:
-#endif
- BOOST_TEST_PROTECTED_VIRTUAL ~lazy_ostream() {}
+ explicit lazy_ostream( bool p_empty = true ) : m_empty( p_empty ) {}
private:
// Data members
@@ -60,32 +51,43 @@ private:
//____________________________________________________________________________//
-template<typename T>
+template<typename PrevType, typename T, typename StorageT=T const&>
class lazy_ostream_impl : public lazy_ostream {
public:
- lazy_ostream_impl( lazy_ostream const& prev, T value )
+ lazy_ostream_impl( PrevType const& prev, T const& value )
: lazy_ostream( false )
, m_prev( prev )
, m_value( value )
- {}
-private:
+ {
+ }
+
virtual std::ostream& operator()( std::ostream& ostr ) const
{
return m_prev(ostr) << m_value;
}
-
+private:
// Data members
- lazy_ostream const& m_prev;
- T m_value;
+ PrevType const& m_prev;
+ StorageT m_value;
};
//____________________________________________________________________________//
template<typename T>
-inline lazy_ostream_impl<T const&>
+inline lazy_ostream_impl<lazy_ostream,T>
operator<<( lazy_ostream const& prev, T const& v )
{
- return lazy_ostream_impl<T const&>( prev, v );
+ return lazy_ostream_impl<lazy_ostream,T>( prev, v );
+}
+
+//____________________________________________________________________________//
+
+template<typename PrevPrevType, typename TPrev, typename T>
+inline lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,T>
+operator<<( lazy_ostream_impl<PrevPrevType,TPrev> const& prev, T const& v )
+{
+ typedef lazy_ostream_impl<PrevPrevType,TPrev> PrevType;
+ return lazy_ostream_impl<PrevType,T>( prev, v );
}
//____________________________________________________________________________//
@@ -93,22 +95,36 @@ operator<<( lazy_ostream const& prev, T const& v )
#if BOOST_TEST_USE_STD_LOCALE
template<typename R,typename S>
-inline lazy_ostream_impl<R& (BOOST_TEST_CALL_DECL *)(S&)>
+inline lazy_ostream_impl<lazy_ostream,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)>
operator<<( lazy_ostream const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) )
{
- return lazy_ostream_impl<R& (BOOST_TEST_CALL_DECL *)(S&)>( prev, man );
+ typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&);
+
+ return lazy_ostream_impl<lazy_ostream,ManipType,ManipType>( prev, man );
+}
+
+//____________________________________________________________________________//
+
+template<typename PrevPrevType, typename TPrev,typename R,typename S>
+inline lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)>
+operator<<( lazy_ostream_impl<PrevPrevType,TPrev> const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) )
+{
+ typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&);
+
+ return lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,ManipType,ManipType>( prev, man );
}
//____________________________________________________________________________//
#endif
-} // namespace unit_test
+#define BOOST_TEST_LAZY_MSG( M ) (::boost::unit_test::lazy_ostream::instance() << M)
+} // namespace unit_test
} // namespace boost
//____________________________________________________________________________//
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_LAZY_OSTREAM_HPP_070708GER
+#endif // BOOST_TEST_UTILS_LAZY_OSTREAM_HPP
diff --git a/boost/test/utils/named_params.hpp b/boost/test/utils/named_params.hpp
index 0a6277ce12..0e66dc39c5 100644
--- a/boost/test/utils/named_params.hpp
+++ b/boost/test/utils/named_params.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,29 +12,32 @@
// Description : facilities for named function parameters support
// ***************************************************************************
-#ifndef BOOST_TEST_NAMED_PARAM_022505GER
-#define BOOST_TEST_NAMED_PARAM_022505GER
+#ifndef BOOST_TEST_UTILS_NAMED_PARAM
+#define BOOST_TEST_UTILS_NAMED_PARAM
// Boost
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
+#include <boost/mpl/bool.hpp>
// Boost.Test
#include <boost/test/utils/rtti.hpp>
#include <boost/test/utils/assign_op.hpp>
#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+
+#include <boost/test/detail/throw_exception.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
-
namespace nfp { // named function parameters
// ************************************************************************** //
-// ************** forward declarations ************** //
+// ************** forward declarations ************** //
// ************************************************************************** //
template<typename T, typename unique_id,typename RefType> struct named_parameter;
@@ -52,16 +55,17 @@ struct access_to_invalid_parameter {};
//____________________________________________________________________________//
-inline void
-report_access_to_invalid_parameter()
+inline void
+report_access_to_invalid_parameter(bool v)
{
- throw access_to_invalid_parameter();
+ if(v)
+ BOOST_TEST_IMPL_THROW( access_to_invalid_parameter() );
}
//____________________________________________________________________________//
// ************************************************************************** //
-// ************** nil ************** //
+// ************** nil ************** //
// ************************************************************************** //
struct nil {
@@ -71,35 +75,35 @@ struct nil {
#else
operator T const&() const
#endif
- { report_access_to_invalid_parameter(); static T* v = 0; return *v; }
+ { report_access_to_invalid_parameter(true); 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; }
+ { report_access_to_invalid_parameter(true); static typename remove_reference<T>::type* v = 0; return *v; }
template<typename Arg1>
nil operator()( Arg1 const& )
- { report_access_to_invalid_parameter(); return nil(); }
+ { report_access_to_invalid_parameter(true); return nil(); }
template<typename Arg1,typename Arg2>
nil operator()( Arg1 const&, Arg2 const& )
- { report_access_to_invalid_parameter(); return nil(); }
+ { report_access_to_invalid_parameter(true); return nil(); }
template<typename Arg1,typename Arg2,typename Arg3>
nil operator()( Arg1 const&, Arg2 const&, Arg3 const& )
- { report_access_to_invalid_parameter(); return nil(); }
+ { report_access_to_invalid_parameter(true); return nil(); }
// Visitation support
template<typename Visitor>
- void apply_to( Visitor& V ) const {}
+ void apply_to( Visitor& /*v*/ ) const {}
static nil& inst() { static nil s_inst; return s_inst; }
private:
nil() {}
};
-
+
// ************************************************************************** //
-// ************** named_parameter_base ************** //
+// ************** named_parameter_base ************** //
// ************************************************************************** //
template<typename Derived>
@@ -112,11 +116,11 @@ struct named_parameter_base {
//____________________________________________________________________________//
// ************************************************************************** //
-// ************** named_parameter_combine ************** //
+// ************** named_parameter_combine ************** //
// ************************************************************************** //
template<typename NP, typename Rest = nil>
-struct named_parameter_combine
+struct named_parameter_combine
: Rest
, named_parameter_base<named_parameter_combine<NP,Rest> > {
typedef typename NP::ref_type res_type;
@@ -164,10 +168,10 @@ private:
} // namespace nfp_detail
// ************************************************************************** //
-// ************** named_parameter ************** //
+// ************** named_parameter ************** //
// ************************************************************************** //
-template<typename T, typename unique_id,typename ReferenceType=T&>
+template<typename T, typename unique_id, typename ReferenceType=T&>
struct named_parameter
: nfp_detail::named_parameter_base<named_parameter<T, unique_id,ReferenceType> >
{
@@ -177,7 +181,7 @@ struct named_parameter
typedef unique_id id;
// Constructor
- explicit named_parameter( ref_type v )
+ explicit named_parameter( ref_type v )
: m_value( v )
, m_erased( false )
{}
@@ -216,7 +220,7 @@ private:
//____________________________________________________________________________//
// ************************************************************************** //
-// ************** no_params ************** //
+// ************** no_params ************** //
// ************************************************************************** //
namespace nfp_detail {
@@ -230,7 +234,7 @@ nfp_detail::no_params_type no_params( '\0' );
//____________________________________________________________________________//
// ************************************************************************** //
-// ************** keyword ************** //
+// ************** keyword ************** //
// ************************************************************************** //
template<typename unique_id, bool required = false>
@@ -252,7 +256,7 @@ struct keyword {
//____________________________________________________________________________//
// ************************************************************************** //
-// ************** typed_keyword ************** //
+// ************** typed_keyword ************** //
// ************************************************************************** //
template<typename T, typename unique_id, bool required = false>
@@ -281,14 +285,14 @@ struct typed_keyword<bool,unique_id,false>
//____________________________________________________________________________//
// ************************************************************************** //
-// ************** optionally_assign ************** //
+// ************** optionally_assign ************** //
// ************************************************************************** //
template<typename T>
inline void
optionally_assign( T&, nfp_detail::nil )
{
- nfp_detail::report_access_to_invalid_parameter();
+ nfp_detail::report_access_to_invalid_parameter(true);
}
//____________________________________________________________________________//
@@ -319,11 +323,48 @@ optionally_assign( T& target, Params const& p, Keyword k )
//____________________________________________________________________________//
-} // namespace nfp
+// ************************************************************************** //
+// ************** is_named_params ************** //
+// ************************************************************************** //
+
+template<typename T>
+struct is_named_params : public boost::mpl::false_ {};
+template<typename T, typename unique_id, typename ReferenceType>
+struct is_named_params<named_parameter<T,unique_id,ReferenceType> > : public boost::mpl::true_ {};
+
+template<typename NP, typename Rest>
+struct is_named_params<nfp_detail::named_parameter_combine<NP,Rest> > : public boost::mpl::true_ {};
+
+// ************************************************************************** //
+// ************** param_type ************** //
+// ************************************************************************** //
+
+template<typename Params,typename KeywordType,typename DefaultType=void>
+struct param_type {
+ typedef DefaultType type;
+};
+
+template<typename NP,typename Rest,typename Keyword,typename DefaultType>
+struct param_type<nfp_detail::named_parameter_combine<NP,Rest>,Keyword,DefaultType> : param_type<Rest,Keyword,DefaultType> {
+};
+
+template<typename T, typename unique_id, typename ReferenceType,bool required,typename DefaultType>
+struct param_type<named_parameter<T,unique_id,ReferenceType>,keyword<unique_id,required>,DefaultType> {
+ typedef typename boost::remove_cv<T>::type type;
+};
+
+template<typename T, typename unique_id, typename ReferenceType,typename Rest,bool required,typename DefaultType>
+struct param_type<nfp_detail::named_parameter_combine<named_parameter<T,unique_id,ReferenceType>,Rest>,
+ keyword<unique_id,required>,
+ DefaultType> {
+ typedef typename boost::remove_cv<T>::type type;
+};
+
+} // namespace nfp
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_NAMED_PARAM_022505GER
+#endif // BOOST_TEST_UTILS_NAMED_PARAM
diff --git a/boost/test/utils/nullstream.hpp b/boost/test/utils/nullstream.hpp
index deca6ed15f..b4cedd0842 100644
--- a/boost/test/utils/nullstream.hpp
+++ b/boost/test/utils/nullstream.hpp
@@ -1,7 +1,7 @@
-// (C) Copyright Gennadiy Rozental 2002-2008.
-// (C) Copyright Daryle Walker 2000-2001.
+// (C) Copyright Gennadiy Rozental 2002-2014.
+// (C) Copyright Daryle Walker 2000-2001.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -13,13 +13,15 @@
// Description : simulate /dev/null stream
// ***************************************************************************
-#ifndef BOOST_NULLSTREAM_HPP_071894GER
-#define BOOST_NULLSTREAM_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_NULLSTREAM_HPP
+#define BOOST_TEST_UTILS_NULLSTREAM_HPP
+// STL
#include <ostream> // for std::basic_ostream
#include <streambuf> // for std::basic_streambuf
#include <string> // for std::char_traits
+// Boost
#include <boost/utility/base_from_member.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -86,6 +88,7 @@ public:
#ifdef BOOST_MSVC
# pragma warning(default: 4355)
+# pragma warning(pop)
#endif
typedef basic_onullstream<char> onullstream;
@@ -97,4 +100,4 @@ typedef basic_onullstream<wchar_t> wonullstream;
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_NULLSTREAM_HPP_071894GER
+#endif // BOOST_TEST_UTILS_NULLSTREAM_HPP
diff --git a/boost/test/utils/rtti.hpp b/boost/test/utils/rtti.hpp
index f795a2cbe4..42f2bc648b 100644
--- a/boost/test/utils/rtti.hpp
+++ b/boost/test/utils/rtti.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,13 +12,13 @@
// Description : simple facilities for accessing type information at runtime
// ***************************************************************************
-#ifndef BOOST_TEST_RTTI_HPP_062604GER
-#define BOOST_TEST_RTTI_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RTTI_HPP
+#define BOOST_TEST_UTILS_RTTI_HPP
+// C Runtime
#include <cstddef>
namespace boost {
-
namespace rtti {
// ************************************************************************** //
@@ -43,7 +43,7 @@ private:
//____________________________________________________________________________//
-template<typename T>
+template<typename T>
inline id_t
type_id()
{
@@ -58,7 +58,6 @@ type_id()
//____________________________________________________________________________//
} // namespace rtti
-
} // namespace boost
-#endif // BOOST_RT_RTTI_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RTTI_HPP
diff --git a/boost/test/utils/runtime/argument.hpp b/boost/test/utils/runtime/argument.hpp
index d0f420aab7..b5133e23c3 100644
--- a/boost/test/utils/runtime/argument.hpp
+++ b/boost/test/utils/runtime/argument.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : model of actual argument (both typed and abstract interface)
// ***************************************************************************
-#ifndef BOOST_RT_ARGUMENT_HPP_062604GER
-#define BOOST_RT_ARGUMENT_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP
+#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -29,7 +29,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
// ************************************************************************** //
// ************** runtime::argument ************** //
@@ -105,8 +105,8 @@ arg_value( argument& arg_ )
//____________________________________________________________________________//
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_ARGUMENT_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP
diff --git a/boost/test/utils/runtime/cla/argument_factory.hpp b/boost/test/utils/runtime/cla/argument_factory.hpp
index 19ccc08c0f..6683540612 100644
--- a/boost/test/utils/runtime/cla/argument_factory.hpp
+++ b/boost/test/utils/runtime/cla/argument_factory.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : generic typed_argument_factory implementation
// ***************************************************************************
-#ifndef BOOST_RT_CLA_ARGUMENT_FACTORY_HPP_062604GER
-#define BOOST_RT_CLA_ARGUMENT_FACTORY_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_FACTORY_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_FACTORY_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -33,15 +33,13 @@
#include <boost/test/utils/runtime/cla/iface/argument_factory.hpp>
-// Boost.Test
-#include <boost/test/utils/callback.hpp>
-
// Boost
#include <boost/optional.hpp>
+#include <boost/function/function2.hpp>
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -72,7 +70,7 @@ struct typed_argument_factory : public argument_factory {
typed_argument_factory()
: m_value_interpreter( rt_cla_detail::default_value_interpreter() )
{}
- BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~typed_argument_factory() {}
+ BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~typed_argument_factory() {}
// properties modification
template<typename Modifier>
@@ -82,24 +80,24 @@ struct typed_argument_factory : public argument_factory {
optionally_assign( m_value_interpreter, m, interpreter );
if( m.has( default_value ) ) {
- BOOST_RT_PARAM_VALIDATE_LOGIC( !m_value_generator,
- BOOST_RT_PARAM_LITERAL( "multiple value generators for parameter" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !m_value_generator,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "multiple value generators for parameter" ) );
T const& dv_ref = m[default_value];
m_value_generator = rt_cla_detail::const_generator<T>( dv_ref );
}
if( m.has( default_refer_to ) ) {
- BOOST_RT_PARAM_VALIDATE_LOGIC( !m_value_generator,
- BOOST_RT_PARAM_LITERAL( "multiple value generators for parameter" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !m_value_generator,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "multiple value generators for parameter" ) );
cstring ref_id = m[default_refer_to];
m_value_generator = rt_cla_detail::ref_generator<T>( ref_id );
}
if( m.has( assign_to ) ) {
- BOOST_RT_PARAM_VALIDATE_LOGIC( !m_value_handler,
- BOOST_RT_PARAM_LITERAL( "multiple value handlers for parameter" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !m_value_handler,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "multiple value handlers for parameter" ) );
m_value_handler = rt_cla_detail::assigner<T>( m[assign_to] );
}
@@ -112,9 +110,9 @@ struct typed_argument_factory : public argument_factory {
// !! private?
// Data members
- unit_test::callback2<parameter const&,T&> m_value_handler;
- unit_test::callback2<parser const&,boost::optional<T>&> m_value_generator;
- unit_test::callback2<argv_traverser&,boost::optional<T>&> m_value_interpreter;
+ boost::function<void (parameter const&,T&)> m_value_handler;
+ boost::function<void (parser const&,boost::optional<T>&)> m_value_generator;
+ boost::function<void (argv_traverser&,boost::optional<T>&)> m_value_interpreter;
};
//____________________________________________________________________________//
@@ -125,23 +123,23 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr )
{
boost::optional<T> value;
- try {
+ BOOST_TEST_IMPL_TRY {
m_value_interpreter( tr, value );
}
- catch( ... ) { // !! should we do that?
- BOOST_RT_PARAM_TRACE( "Fail to parse argument value" );
+ BOOST_TEST_IMPL_CATCHALL() { // !! should we do that?
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Fail to parse argument value" );
if( !p.p_optional_value )
- throw;
+ BOOST_TEST_IMPL_RETHROW;
}
argument_ptr actual_arg = p.actual_argument();
- BOOST_RT_CLA_VALIDATE_INPUT( !!value || p.p_optional_value, tr,
- BOOST_RT_PARAM_LITERAL( "Argument value missing for parameter " ) << p.id_2_report() );
+ BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( !!value || p.p_optional_value, tr,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Argument value missing for parameter " ) << p.id_2_report() );
- BOOST_RT_CLA_VALIDATE_INPUT( !actual_arg || p.p_multiplicable, tr,
- BOOST_RT_PARAM_LITERAL( "Unexpected repetition of the parameter " ) << p.id_2_report() );
+ BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( !actual_arg || p.p_multiplicable, tr,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Unexpected repetition of the parameter " ) << p.id_2_report() );
if( !!value && !!m_value_handler )
m_value_handler( p, *value );
@@ -154,7 +152,7 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr )
typedef std::list<boost::optional<T> > optional_list;
if( !actual_arg )
- actual_arg.reset( p.p_optional_value
+ actual_arg.reset( p.p_optional_value
? static_cast<argument*>(new typed_argument<optional_list>( p ))
: static_cast<argument*>(new typed_argument<std::list<T> >( p )) );
@@ -165,7 +163,7 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr )
}
else {
std::list<T>& values = arg_value<std::list<T> >( *actual_arg );
-
+
values.push_back( *value );
}
}
@@ -176,7 +174,7 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr )
//____________________________________________________________________________//
template<typename T>
-inline argument_ptr
+inline argument_ptr
typed_argument_factory<T>::produce_using( parameter& p, parser const& pa )
{
argument_ptr actual_arg;
@@ -211,8 +209,8 @@ typed_argument_factory<T>::argument_usage_info( format_stream& fs )
} // namespace boost
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace cla
-#endif // BOOST_RT_CLA_ARGUMENT_FACTORY_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_FACTORY_HPP
diff --git a/boost/test/utils/runtime/cla/argv_traverser.cpp b/boost/test/utils/runtime/cla/argv_traverser.cpp
index a7a44f7fd9..9716b8fb9c 100644
--- a/boost/test/utils/runtime/cla/argv_traverser.cpp
+++ b/boost/test/utils/runtime/cla/argv_traverser.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,5 +12,5 @@
// Description : offline implementation for argc/argv traverser
// ***************************************************************************
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/cla/argv_traverser.ipp>
diff --git a/boost/test/utils/runtime/cla/argv_traverser.hpp b/boost/test/utils/runtime/cla/argv_traverser.hpp
index 58cf2fe5f7..6f6e03dfc8 100644
--- a/boost/test/utils/runtime/cla/argv_traverser.hpp
+++ b/boost/test/utils/runtime/cla/argv_traverser.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines facility to hide input traversing details
// ***************************************************************************
-#ifndef BOOST_RT_CLA_ARGV_TRAVERSER_HPP_062604GER
-#define BOOST_RT_CLA_ARGV_TRAVERSER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -27,7 +27,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -84,15 +84,17 @@ private:
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-# define BOOST_RT_PARAM_INLINE inline
-# include <boost/test/utils/runtime/cla/argv_traverser.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/cla/argv_traverser.ipp>
#endif
-#endif // BOOST_RT_CLA_ARGV_TRAVERSER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP
diff --git a/boost/test/utils/runtime/cla/argv_traverser.ipp b/boost/test/utils/runtime/cla/argv_traverser.ipp
index 2b5e3818b3..d1ae93be82 100644
--- a/boost/test/utils/runtime/cla/argv_traverser.ipp
+++ b/boost/test/utils/runtime/cla/argv_traverser.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : implements facility to hide input traversing details
// ***************************************************************************
-#ifndef BOOST_RT_CLA_ARGV_TRAVERSER_IPP_070604GER
-#define BOOST_RT_CLA_ARGV_TRAVERSER_IPP_070604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_IPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/trace.hpp>
@@ -30,7 +30,7 @@ namespace std { using ::memcpy; }
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -38,21 +38,23 @@ namespace cla {
// ************** runtime::cla::argv_traverser ************** //
// ************************************************************************** //
-BOOST_RT_PARAM_INLINE
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
argv_traverser::argv_traverser()
-: p_ignore_mismatch( false ), p_separator( BOOST_RT_PARAM_LITERAL( ' ' ) )
+: p_ignore_mismatch( false ), p_separator( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' ) )
{
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
argv_traverser::init( int argc, char_type** argv )
{
+ m_buffer.clear();
+
for( int index = 1; index < argc; ++index ) {
m_buffer += argv[index];
if( index != argc-1 )
- m_buffer += BOOST_RT_PARAM_LITERAL( ' ' );
+ m_buffer += BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' );
}
m_remainder.reset( new char_type[m_buffer.size()+1] );
@@ -60,14 +62,14 @@ argv_traverser::init( int argc, char_type** argv )
m_work_buffer = m_buffer;
m_commited_end = m_work_buffer.begin();
- BOOST_RT_PARAM_TRACE( "Input buffer: " << m_buffer );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Input buffer: " << m_buffer );
next_token();
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
argv_traverser::remainder( int& argc, char_type** argv )
{
argc = 1;
@@ -75,15 +77,16 @@ argv_traverser::remainder( int& argc, char_type** argv )
while(pos < m_remainder_size ) {
argv[argc++] = m_remainder.get() + pos;
- pos = std::find( m_remainder.get() + pos, m_remainder.get() + m_remainder_size,
- BOOST_RT_PARAM_LITERAL( ' ' ) ) - m_remainder.get();
- m_remainder[pos++] = BOOST_RT_PARAM_LITERAL( '\0' );
+ pos = static_cast<size_t>(std::find( m_remainder.get() + pos, m_remainder.get() + m_remainder_size,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' ) ) -
+ m_remainder.get());
+ m_remainder[pos++] = BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '\0' );
}
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE cstring
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring
argv_traverser::token() const
{
return m_token;
@@ -91,7 +94,7 @@ argv_traverser::token() const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
argv_traverser::next_token()
{
if( m_work_buffer.is_empty() )
@@ -108,7 +111,7 @@ argv_traverser::next_token()
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE cstring
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring
argv_traverser::input() const
{
return m_work_buffer;
@@ -116,7 +119,7 @@ argv_traverser::input() const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
argv_traverser::trim( std::size_t size )
{
m_work_buffer.trim_left( size );
@@ -131,7 +134,7 @@ argv_traverser::trim( std::size_t size )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
argv_traverser::match_front( cstring str )
{
return m_work_buffer.size() < str.size() ? false : m_work_buffer.substr( 0, str.size() ) == str;
@@ -139,7 +142,7 @@ argv_traverser::match_front( cstring str )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
argv_traverser::match_front( char_type c )
{
return first_char( m_work_buffer ) == c;
@@ -147,7 +150,7 @@ argv_traverser::match_front( char_type c )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
argv_traverser::eoi() const
{
return m_work_buffer.is_empty();
@@ -155,7 +158,7 @@ argv_traverser::eoi() const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
argv_traverser::commit()
{
m_commited_end = m_work_buffer.begin();
@@ -163,7 +166,7 @@ argv_traverser::commit()
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
argv_traverser::rollback()
{
m_work_buffer.assign( m_commited_end, m_work_buffer.end() );
@@ -174,15 +177,15 @@ argv_traverser::rollback()
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE std::size_t
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE std::size_t
argv_traverser::input_pos() const
{
- return m_work_buffer.begin() - m_commited_end;
+ return static_cast<std::size_t>(m_work_buffer.begin() - m_commited_end);
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
argv_traverser::handle_mismatch()
{
if( !p_ignore_mismatch )
@@ -202,8 +205,8 @@ argv_traverser::handle_mismatch()
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_ARGV_TRAVERSER_IPP_070604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_IPP
diff --git a/boost/test/utils/runtime/cla/basic_parameter.hpp b/boost/test/utils/runtime/cla/basic_parameter.hpp
index 8b826bba0a..817b12a301 100644
--- a/boost/test/utils/runtime/cla/basic_parameter.hpp
+++ b/boost/test/utils/runtime/cla/basic_parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : generic custom parameter generator
// ***************************************************************************
-#ifndef BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER
-#define BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_BASIC_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_BASIC_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -28,7 +28,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -40,7 +40,7 @@ template<typename T, typename IdPolicy>
class basic_parameter : private base_from_member<IdPolicy>, public typed_parameter<T> {
public:
// Constructors
- explicit basic_parameter( cstring n )
+ explicit basic_parameter( cstring n )
: base_from_member<IdPolicy>()
, typed_parameter<T>( base_from_member<IdPolicy>::member )
{
@@ -59,7 +59,7 @@ public:
//____________________________________________________________________________//
-#define BOOST_RT_CLA_NAMED_PARAM_GENERATORS( param_type ) \
+#define BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( param_type ) \
template<typename T> \
inline shared_ptr<param_type ## _t<T> > \
param_type( cstring name = cstring() ) \
@@ -78,8 +78,8 @@ param_type( cstring name = cstring() )
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_BASIC_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/cla/char_parameter.cpp b/boost/test/utils/runtime/cla/char_parameter.cpp
index 017402e8e7..6e85fe4136 100644
--- a/boost/test/utils/runtime/cla/char_parameter.cpp
+++ b/boost/test/utils/runtime/cla/char_parameter.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,5 +12,5 @@
// Description : offline implementation of char parameter
// ***************************************************************************
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/cla/char_parameter.ipp>
diff --git a/boost/test/utils/runtime/cla/char_parameter.hpp b/boost/test/utils/runtime/cla/char_parameter.hpp
index 425c24f3f9..0e2928b1af 100644
--- a/boost/test/utils/runtime/cla/char_parameter.hpp
+++ b/boost/test/utils/runtime/cla/char_parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines model of parameter with single char name
// ***************************************************************************
-#ifndef BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER
-#define BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -24,7 +24,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -36,7 +36,7 @@ class char_name_policy : public basic_naming_policy {
public:
// Constructor
char_name_policy();
- BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~char_name_policy() {}
+ BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~char_name_policy() {}
// policy interface
virtual bool conflict_with( identification_policy const& ) const;
@@ -47,7 +47,7 @@ public:
{
basic_naming_policy::accept_modifier( m );
- BOOST_RT_PARAM_VALIDATE_LOGIC( p_name->size() <= 1, "Invalid parameter name " << p_name );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( p_name->size() <= 1, "Invalid parameter name " << p_name );
}
};
@@ -84,15 +84,17 @@ char_parameter( char_type name )
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-# define BOOST_RT_PARAM_INLINE inline
-# include <boost/test/utils/runtime/cla/char_parameter.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/cla/char_parameter.ipp>
#endif
-#endif // BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/cla/char_parameter.ipp b/boost/test/utils/runtime/cla/char_parameter.ipp
index db4d0c1ed1..398ce79ac4 100644
--- a/boost/test/utils/runtime/cla/char_parameter.ipp
+++ b/boost/test/utils/runtime/cla/char_parameter.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : implements model of parameter with single char name
// ***************************************************************************
-#ifndef BOOST_RT_CLA_CHAR_PARAMETER_IPP_062904GER
-#define BOOST_RT_CLA_CHAR_PARAMETER_IPP_062904GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_IPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -22,7 +22,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -30,19 +30,19 @@ namespace cla {
// ************** char_name_policy ************** //
// ************************************************************************** //
-BOOST_RT_PARAM_INLINE
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
char_name_policy::char_name_policy()
: basic_naming_policy( rtti::type_id<char_name_policy>() )
{
- assign_op( p_prefix.value, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 );
+ assign_op( p_prefix.value, BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "-" ), 0 );
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
char_name_policy::conflict_with( identification_policy const& id ) const
{
- return id.p_type_id == p_type_id &&
+ return id.p_type_id == p_type_id &&
p_name == static_cast<char_name_policy const&>( id ).p_name;
}
@@ -50,8 +50,8 @@ char_name_policy::conflict_with( identification_policy const& id ) const
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_CHAR_PARAMETER_IPP_062904GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_IPP
diff --git a/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp b/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp
index 0d59595612..a70b6d1fb7 100644
--- a/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp
+++ b/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp
@@ -1,10 +1,9 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// See http://www.boost.org for updates, documentation, and revision history.
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
@@ -13,8 +12,8 @@
// Description : argument usage printing helpers
// ***************************************************************************
-#ifndef BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER
-#define BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_VALUE_USAGE_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_VALUE_USAGE_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -32,7 +31,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -47,7 +46,7 @@ template<typename T>
inline void
argument_value_usage( format_stream& fs, long, T* = 0 )
{
- fs << BOOST_RT_PARAM_CSTRING_LITERAL( "<value>" );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "<value>" );
}
//____________________________________________________________________________//
@@ -57,7 +56,7 @@ template<typename T>
inline void
argument_value_usage( format_stream& fs, int, std::list<T>* = 0 )
{
- fs << BOOST_RT_PARAM_CSTRING_LITERAL( "(<value1>, ..., <valueN>)" );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "(<value1>, ..., <valueN>)" );
}
//____________________________________________________________________________//
@@ -66,7 +65,7 @@ argument_value_usage( format_stream& fs, int, std::list<T>* = 0 )
inline void
argument_value_usage( format_stream& fs, int, bool* = 0 )
{
- fs << BOOST_RT_PARAM_CSTRING_LITERAL( "yes|y|no|n" );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "yes|y|no|n" );
}
//____________________________________________________________________________//
@@ -75,8 +74,8 @@ argument_value_usage( format_stream& fs, int, bool* = 0 )
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_VALUE_USAGE_HPP
diff --git a/boost/test/utils/runtime/cla/dual_name_parameter.cpp b/boost/test/utils/runtime/cla/dual_name_parameter.cpp
index c715de349e..ab034ff04c 100644
--- a/boost/test/utils/runtime/cla/dual_name_parameter.cpp
+++ b/boost/test/utils/runtime/cla/dual_name_parameter.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,5 +12,5 @@
// Description : offline implementation of generic parameter with dual naming
// ***************************************************************************
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/cla/dual_name_parameter.ipp>
diff --git a/boost/test/utils/runtime/cla/dual_name_parameter.hpp b/boost/test/utils/runtime/cla/dual_name_parameter.hpp
index 26ac657c86..789b67ad1d 100644
--- a/boost/test/utils/runtime/cla/dual_name_parameter.hpp
+++ b/boost/test/utils/runtime/cla/dual_name_parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines model of generic parameter with dual naming
// ***************************************************************************
-#ifndef BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER
-#define BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -76,21 +76,23 @@ public:
//____________________________________________________________________________//
-BOOST_RT_CLA_NAMED_PARAM_GENERATORS( dual_name_parameter )
+BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( dual_name_parameter )
//____________________________________________________________________________//
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-# define BOOST_RT_PARAM_INLINE inline
-# include <boost/test/utils/runtime/cla/dual_name_parameter.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/cla/dual_name_parameter.ipp>
#endif
-#endif // BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/cla/dual_name_parameter.ipp b/boost/test/utils/runtime/cla/dual_name_parameter.ipp
index 6e3a37f58d..e39d132d62 100644
--- a/boost/test/utils/runtime/cla/dual_name_parameter.ipp
+++ b/boost/test/utils/runtime/cla/dual_name_parameter.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : implements model of generic parameter with dual naming
// ***************************************************************************
-#ifndef BOOST_RT_CLA_DUAL_NAME_PARAMETER_IPP_062904GER
-#define BOOST_RT_CLA_DUAL_NAME_PARAMETER_IPP_062904GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_IPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -31,11 +31,11 @@ namespace cla {
// ************** dual_name_policy ************** //
// ************************************************************************** //
-BOOST_RT_PARAM_INLINE
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
dual_name_policy::dual_name_policy()
{
- m_primary.accept_modifier( prefix = BOOST_RT_PARAM_CSTRING_LITERAL( "--" ) );
- m_secondary.accept_modifier( prefix = BOOST_RT_PARAM_CSTRING_LITERAL( "-" ) );
+ m_primary.accept_modifier( prefix = BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "--" ) );
+ m_secondary.accept_modifier( prefix = BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "-" ) );
}
//____________________________________________________________________________//
@@ -46,8 +46,8 @@ template<typename K>
inline void
split( string_name_policy& snp, char_name_policy& cnp, cstring src, K const& k )
{
- cstring::iterator sep = std::find( src.begin(), src.end(), BOOST_RT_PARAM_LITERAL( '|' ) );
-
+ cstring::iterator sep = std::find( src.begin(), src.end(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '|' ) );
+
if( sep != src.begin() )
snp.accept_modifier( k = cstring( src.begin(), sep ) );
@@ -57,7 +57,7 @@ split( string_name_policy& snp, char_name_policy& cnp, cstring src, K const& k )
} // local namespace
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
dual_name_policy::set_prefix( cstring src )
{
split( m_primary, m_secondary, src, prefix );
@@ -65,7 +65,7 @@ dual_name_policy::set_prefix( cstring src )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
dual_name_policy::set_name( cstring src )
{
split( m_primary, m_secondary, src, name );
@@ -73,7 +73,7 @@ dual_name_policy::set_name( cstring src )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
dual_name_policy::set_separator( cstring src )
{
split( m_primary, m_secondary, src, separator );
@@ -83,8 +83,8 @@ dual_name_policy::set_separator( cstring src )
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_DUAL_NAME_PARAMETER_IPP_062904GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_IPP
diff --git a/boost/test/utils/runtime/cla/fwd.hpp b/boost/test/utils/runtime/cla/fwd.hpp
index b5039339d8..df02974345 100644
--- a/boost/test/utils/runtime/cla/fwd.hpp
+++ b/boost/test/utils/runtime/cla/fwd.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : cla subsystem forward declarations
// ***************************************************************************
-#ifndef BOOST_RT_CLA_FWD_HPP_062604GER
-#define BOOST_RT_CLA_FWD_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_FWD_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_FWD_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -48,8 +48,8 @@ class positional_parameter_base;
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_FWD_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_FWD_HPP
diff --git a/boost/test/utils/runtime/cla/id_policy.cpp b/boost/test/utils/runtime/cla/id_policy.cpp
index c3a5ab8273..b000e26f94 100644
--- a/boost/test/utils/runtime/cla/id_policy.cpp
+++ b/boost/test/utils/runtime/cla/id_policy.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,5 +12,5 @@
// Description : some generic identification policies offline implementation
// ***************************************************************************
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/cla/id_policy.ipp>
diff --git a/boost/test/utils/runtime/cla/id_policy.hpp b/boost/test/utils/runtime/cla/id_policy.hpp
index 596805ea21..3308b07c61 100644
--- a/boost/test/utils/runtime/cla/id_policy.hpp
+++ b/boost/test/utils/runtime/cla/id_policy.hpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -12,8 +12,8 @@
// Description : some generic identification policies definition
// ***************************************************************************
-#ifndef BOOST_RT_CLA_ID_POLICY_HPP_062604GER
-#define BOOST_RT_CLA_ID_POLICY_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -30,7 +30,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -65,7 +65,7 @@ protected:
explicit basic_naming_policy( rtti::id_t dyn_type )
: identification_policy( dyn_type )
{}
- BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~basic_naming_policy() {}
+ BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~basic_naming_policy() {}
// Naming policy interface
virtual bool match_prefix( argv_traverser& tr ) const;
@@ -102,11 +102,11 @@ public:
}
virtual void usage_info( format_stream& fs ) const
{
- fs << BOOST_RT_PARAM_LITERAL( '{' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '{' );
m_primary.usage_info( fs );
- fs << BOOST_RT_PARAM_LITERAL( '|' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '|' );
m_secondary.usage_info( fs );
- fs << BOOST_RT_PARAM_LITERAL( '}' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '}' );
}
virtual bool matching( parameter const& p, argv_traverser& tr, bool primary ) const
{
@@ -122,7 +122,7 @@ public:
}
protected:
- BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~dual_id_policy() {}
+ BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~dual_id_policy() {}
// Data members
PrimaryId m_primary;
@@ -131,15 +131,17 @@ protected:
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-# define BOOST_RT_PARAM_INLINE inline
-# include <boost/test/utils/runtime/cla/id_policy.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/cla/id_policy.ipp>
#endif
-#endif // BOOST_RT_CLA_ID_POLICY_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_HPP
diff --git a/boost/test/utils/runtime/cla/id_policy.ipp b/boost/test/utils/runtime/cla/id_policy.ipp
index 5498b9a8d0..879ccfd1e1 100644
--- a/boost/test/utils/runtime/cla/id_policy.ipp
+++ b/boost/test/utils/runtime/cla/id_policy.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : some generic identification policies implementation
// ***************************************************************************
-#ifndef BOOST_RT_CLA_ID_POLICY_IPP_062904GER
-#define BOOST_RT_CLA_ID_POLICY_IPP_062904GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_IPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -31,18 +31,18 @@ namespace cla {
// ************** basic_naming_policy ************** //
// ************************************************************************** //
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
basic_naming_policy::usage_info( format_stream& fs ) const
{
fs << p_prefix << p_name << p_separator;
if( p_separator->empty() )
- fs << BOOST_RT_PARAM_LITERAL( ' ' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' );
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
basic_naming_policy::match_prefix( argv_traverser& tr ) const
{
if( !tr.match_front( p_prefix.get() ) )
@@ -53,8 +53,8 @@ basic_naming_policy::match_prefix( argv_traverser& tr ) const
}
//____________________________________________________________________________//
-
-BOOST_RT_PARAM_INLINE bool
+
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
basic_naming_policy::match_name( argv_traverser& tr ) const
{
if( !tr.match_front( p_name.get() ) )
@@ -65,8 +65,8 @@ basic_naming_policy::match_name( argv_traverser& tr ) const
}
//____________________________________________________________________________//
-
-BOOST_RT_PARAM_INLINE bool
+
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
basic_naming_policy::match_separator( argv_traverser& tr, bool optional_value ) const
{
if( p_separator->empty() ) {
@@ -92,12 +92,12 @@ basic_naming_policy::match_separator( argv_traverser& tr, bool optional_value )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
basic_naming_policy::matching( parameter const& p, argv_traverser& tr, bool ) const
{
if( !match_prefix( tr ) )
return false;
-
+
if( !match_name( tr ) )
return false;
@@ -111,8 +111,8 @@ basic_naming_policy::matching( parameter const& p, argv_traverser& tr, bool ) co
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_ID_POLICY_IPP_062904GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_IPP
diff --git a/boost/test/utils/runtime/cla/iface/argument_factory.hpp b/boost/test/utils/runtime/cla/iface/argument_factory.hpp
index 03669e0cc0..cbca713bd3 100644
--- a/boost/test/utils/runtime/cla/iface/argument_factory.hpp
+++ b/boost/test/utils/runtime/cla/iface/argument_factory.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines interface for argument_factory
// ***************************************************************************
-#ifndef BOOST_RT_CLA_IFACE_ARGUMENT_FACTORY_HPP_062604GER
-#define BOOST_RT_CLA_IFACE_ARGUMENT_FACTORY_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ARGUMENT_FACTORY_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ARGUMENT_FACTORY_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -44,8 +44,8 @@ protected:
} // namespace boost
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace cla
-#endif // BOOST_RT_CLA_IFACE_ARGUMENT_FACTORY_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ARGUMENT_FACTORY_HPP
diff --git a/boost/test/utils/runtime/cla/iface/id_policy.hpp b/boost/test/utils/runtime/cla/iface/id_policy.hpp
index 1e2d684c25..5fa13e6bc7 100644
--- a/boost/test/utils/runtime/cla/iface/id_policy.hpp
+++ b/boost/test/utils/runtime/cla/iface/id_policy.hpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -12,8 +12,8 @@
// Description : defines interface for identification_policy
// ***************************************************************************
-#ifndef BOOST_RT_CLA_IFACE_ID_POLICY_HPP_062604GER
-#define BOOST_RT_CLA_IFACE_ID_POLICY_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ID_POLICY_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ID_POLICY_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -26,7 +26,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -66,8 +66,8 @@ protected:
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_IFACE_ID_POLICY_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ID_POLICY_HPP
diff --git a/boost/test/utils/runtime/cla/modifier.hpp b/boost/test/utils/runtime/cla/modifier.hpp
index 08924e2f94..4b55536b73 100644
--- a/boost/test/utils/runtime/cla/modifier.hpp
+++ b/boost/test/utils/runtime/cla/modifier.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : parameter modifiers
// ***************************************************************************
-#ifndef BOOST_RT_CLA_MODIFIER_HPP_062604GER
-#define BOOST_RT_CLA_MODIFIER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_MODIFIER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_MODIFIER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -62,8 +62,8 @@ nfp::keyword<struct assign_to_t> assign_to;
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_MODIFIER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_MODIFIER_HPP
diff --git a/boost/test/utils/runtime/cla/named_parameter.cpp b/boost/test/utils/runtime/cla/named_parameter.cpp
index 1b91059fd0..7e94722dc9 100644
--- a/boost/test/utils/runtime/cla/named_parameter.cpp
+++ b/boost/test/utils/runtime/cla/named_parameter.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,5 +12,5 @@
// Description : offline implementation of named parameter
// ***************************************************************************
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/cla/named_parameter.ipp>
diff --git a/boost/test/utils/runtime/cla/named_parameter.hpp b/boost/test/utils/runtime/cla/named_parameter.hpp
index 9f0ac1dae0..be3f9c570b 100644
--- a/boost/test/utils/runtime/cla/named_parameter.hpp
+++ b/boost/test/utils/runtime/cla/named_parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines model of named parameter
// ***************************************************************************
-#ifndef BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER
-#define BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -35,7 +35,7 @@ class string_name_policy : public basic_naming_policy {
public:
// Constructor
string_name_policy();
- BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~string_name_policy() {}
+ BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~string_name_policy() {}
// policy interface
virtual bool responds_to( cstring name ) const;
@@ -73,21 +73,23 @@ public:
//____________________________________________________________________________//
-BOOST_RT_CLA_NAMED_PARAM_GENERATORS( named_parameter )
+BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( named_parameter )
//____________________________________________________________________________//
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-# define BOOST_RT_PARAM_INLINE inline
-# include <boost/test/utils/runtime/cla/named_parameter.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/cla/named_parameter.ipp>
#endif
-#endif // BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/cla/named_parameter.ipp b/boost/test/utils/runtime/cla/named_parameter.ipp
index e04348f53b..e59ebdf89c 100644
--- a/boost/test/utils/runtime/cla/named_parameter.ipp
+++ b/boost/test/utils/runtime/cla/named_parameter.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : implements model of named parameter
// ***************************************************************************
-#ifndef BOOST_RT_CLA_NAMED_PARAMETER_IPP_062904GER
-#define BOOST_RT_CLA_NAMED_PARAMETER_IPP_062904GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_IPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -26,7 +26,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -34,17 +34,17 @@ namespace cla {
// ************** string_name_policy ************** //
// ************************************************************************** //
-BOOST_RT_PARAM_INLINE
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
string_name_policy::string_name_policy()
: basic_naming_policy( rtti::type_id<string_name_policy>() )
, m_guess_name( false )
{
- assign_op( p_prefix.value, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 );
+ assign_op( p_prefix.value, BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "-" ), 0 );
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
string_name_policy::responds_to( cstring name ) const
{
std::pair<cstring::iterator,dstring::const_iterator> mm_pos;
@@ -61,7 +61,7 @@ string_name_policy::responds_to( cstring name ) const
# pragma warning(disable:4244)
#endif
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
string_name_policy::conflict_with( identification_policy const& id ) const
{
if( id.p_type_id == p_type_id ) {
@@ -80,16 +80,16 @@ string_name_policy::conflict_with( identification_policy const& id ) const
((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 &&
- (p_prefix == cnp.p_prefix) &&
+ 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;
+
+ return false;
}
#ifdef BOOST_MSVC
@@ -98,7 +98,7 @@ string_name_policy::conflict_with( identification_policy const& id ) const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE bool
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool
string_name_policy::match_name( argv_traverser& tr ) const
{
if( !m_guess_name )
@@ -107,13 +107,13 @@ string_name_policy::match_name( argv_traverser& tr ) const
cstring in = tr.input();
std::pair<cstring::iterator,dstring::const_iterator> mm_pos;
-
+
mm_pos = unit_test::mismatch( in.begin(), in.end(), p_name->begin(), p_name->end() );
if( mm_pos.first == in.begin() )
return false;
- tr.trim( mm_pos.first - in.begin() );
+ tr.trim( static_cast<std::size_t>(mm_pos.first - in.begin()) );
return true;
}
@@ -122,8 +122,8 @@ string_name_policy::match_name( argv_traverser& tr ) const
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_NAMED_PARAMETER_IPP_062904GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_IPP
diff --git a/boost/test/utils/runtime/cla/parameter.hpp b/boost/test/utils/runtime/cla/parameter.hpp
index 25680db087..9e26d25007 100644
--- a/boost/test/utils/runtime/cla/parameter.hpp
+++ b/boost/test/utils/runtime/cla/parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines model of formal parameter
// ***************************************************************************
-#ifndef BOOST_RT_CLA_PARAMETER_HPP_062604GER
-#define BOOST_RT_CLA_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -32,7 +32,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -40,7 +40,7 @@ namespace cla {
// ************** runtime::cla::parameter ************** //
// ************************************************************************** //
-class parameter : public BOOST_RT_PARAM_NAMESPACE::parameter {
+class parameter : public BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::parameter {
public:
parameter( identification_policy& ID, argument_factory& F, bool optional_value = false )
: p_optional( false )
@@ -78,9 +78,10 @@ public:
}
// access methods
- bool has_argument() const { return m_actual_argument!=0; }
+ bool has_argument() const { return !!m_actual_argument; }
argument const& actual_argument() const { return *m_actual_argument; }
argument_ptr actual_argument() { return m_actual_argument; }
+ void reset() { m_actual_argument.reset(); }
// identification interface
@@ -88,20 +89,20 @@ public:
bool conflict_with( parameter const& p ) const
{
return (id_2_report() == p.id_2_report() && !id_2_report().is_empty()) ||
- m_id_policy.conflict_with( p.m_id_policy ) ||
+ m_id_policy.conflict_with( p.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
- {
+ {
m_id_policy.usage_info( fs );
if( p_optional_value )
- fs << BOOST_RT_PARAM_LITERAL( '[' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '[' );
m_arg_factory.argument_usage_info( fs );
if( p_optional_value )
- fs << BOOST_RT_PARAM_LITERAL( ']' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ']' );
}
// argument match/produce based on input
@@ -143,8 +144,8 @@ operator-( shared_ptr<Parameter> p, Modifier const& m )
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/cla/parser.cpp b/boost/test/utils/runtime/cla/parser.cpp
index 4d1d7afe97..8efc17d3b2 100644
--- a/boost/test/utils/runtime/cla/parser.cpp
+++ b/boost/test/utils/runtime/cla/parser.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,10 +9,10 @@
//
// Version : $Revision$
//
-// Description : offline implementation for parser
+// Description : offline implementation for parser
// ***************************************************************************
#include <boost/test/utils/runtime/config.hpp>
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/cla/parser.ipp>
diff --git a/boost/test/utils/runtime/cla/parser.hpp b/boost/test/utils/runtime/cla/parser.hpp
index f95d26a095..ffe09e4adc 100644
--- a/boost/test/utils/runtime/cla/parser.hpp
+++ b/boost/test/utils/runtime/cla/parser.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines parser - public interface for CLA parsing and accessing
// ***************************************************************************
-#ifndef BOOST_RT_CLA_PARSER_HPP_062604GER
-#define BOOST_RT_CLA_PARSER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -32,7 +32,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -76,6 +76,7 @@ private:
class parser {
public:
typedef std::list<parameter_ptr>::const_iterator param_iterator;
+ typedef std::list<parameter_ptr>::size_type param_size_type;
// Constructor
explicit parser( cstring program_name = cstring() );
@@ -100,10 +101,12 @@ public:
// parameters access
param_iterator first_param() const;
param_iterator last_param() const;
+ param_size_type num_params() const { return m_parameters.size(); }
+ void reset();
// arguments access
const_argument_ptr operator[]( cstring string_id ) const;
- cstring get( cstring string_id ) const;
+ cstring get( cstring string_id ) const;
template<typename T>
T const& get( cstring string_id ) const
@@ -139,15 +142,17 @@ private:
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-# define BOOST_RT_PARAM_INLINE inline
-# include <boost/test/utils/runtime/cla/parser.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/cla/parser.ipp>
#endif
-#endif // BOOST_RT_CLA_PARSER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP
diff --git a/boost/test/utils/runtime/cla/parser.ipp b/boost/test/utils/runtime/cla/parser.ipp
index 188d303156..b8a4ca4636 100644
--- a/boost/test/utils/runtime/cla/parser.ipp
+++ b/boost/test/utils/runtime/cla/parser.ipp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -12,8 +12,8 @@
// Description : implements parser - public interface for CLA parsing and accessing
// ***************************************************************************
-#ifndef BOOST_RT_CLA_PARSER_IPP_062904GER
-#define BOOST_RT_CLA_PARSER_IPP_062904GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_IPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -35,7 +35,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -43,7 +43,7 @@ namespace cla {
// ************** runtime::cla::parser ************** //
// ************************************************************************** //
-BOOST_RT_PARAM_INLINE
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
parser::parser( cstring program_name )
{
assign_op( m_program_name, program_name, 0 );
@@ -51,7 +51,7 @@ parser::parser( cstring program_name )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE parser::param_iterator
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE parser::param_iterator
parser::first_param() const
{
return m_parameters.begin();
@@ -59,7 +59,7 @@ parser::first_param() const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE parser::param_iterator
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE parser::param_iterator
parser::last_param() const
{
return m_parameters.end();
@@ -67,25 +67,25 @@ parser::last_param() const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE argument const&
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE argument const&
parser::valid_argument( cstring string_id ) const
{
const_argument_ptr arg = (*this)[string_id];
- BOOST_RT_PARAM_VALIDATE_LOGIC( !!arg, "Actual argument for parameter " << string_id << " is not present" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !!arg, "Actual argument for parameter " << string_id << " is not present" );
return *arg;
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE parser&
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE parser&
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 ),
- 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() );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !old_param->conflict_with( *new_param ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Definition of parameter " ) << new_param->id_2_report() <<
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " conflicts with defintion of parameter " ) << old_param->id_2_report() );
}
m_parameters.push_back( new_param );
@@ -95,12 +95,12 @@ parser::operator<<( parameter_ptr new_param )
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
parser::parse( int& argc, char_type** argv )
{
if( m_program_name.empty() ) {
m_program_name.assign( argv[0] );
- dstring::size_type pos = m_program_name.find_last_of( BOOST_RT_PARAM_LITERAL( "/\\" ) );
+ dstring::size_type pos = m_program_name.find_last_of( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "/\\" ) );
if( pos != static_cast<dstring::size_type>(cstring::npos) )
m_program_name.erase( 0, pos+1 );
@@ -108,18 +108,18 @@ parser::parse( int& argc, char_type** argv )
m_traverser.init( argc, argv );
- try {
+ BOOST_TEST_IMPL_TRY {
while( !m_traverser.eoi() ) {
parameter_ptr found_param;
- BOOST_RT_PARAM_TRACE( "Total " << m_parameters.size() << " parameters registered" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Total " << m_parameters.size() << " parameters registered" );
BOOST_TEST_FOREACH( parameter_ptr const&, curr_param, m_parameters ) {
- BOOST_RT_PARAM_TRACE( "Try parameter " << curr_param->id_2_report() );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Try parameter " << curr_param->id_2_report() );
if( curr_param->matching( m_traverser, !found_param ) ) {
- BOOST_RT_PARAM_TRACE( "Match found" );
- BOOST_RT_CLA_VALIDATE_INPUT( !found_param, (m_traverser.rollback(),m_traverser), "Ambiguous input" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Match found" );
+ BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( !found_param, (m_traverser.rollback(),m_traverser), "Ambiguous input" );
found_param = curr_param;
}
@@ -128,14 +128,14 @@ parser::parse( int& argc, char_type** argv )
}
if( !found_param ) {
- BOOST_RT_PARAM_TRACE( "No match found" );
- BOOST_RT_CLA_VALIDATE_INPUT( m_traverser.handle_mismatch(), m_traverser,
- BOOST_RT_PARAM_LITERAL( "Unexpected input" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "No match found" );
+ BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( m_traverser.handle_mismatch(), m_traverser,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Unexpected input" ) );
continue;
}
- BOOST_RT_PARAM_TRACE( "Parse argument value" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Parse argument value" );
found_param->produce_argument( m_traverser );
m_traverser.commit();
@@ -145,31 +145,31 @@ parser::parse( int& argc, char_type** argv )
if( !curr_param->p_optional && !curr_param->actual_argument() ) {
curr_param->produce_argument( *this );
- BOOST_RT_PARAM_VALIDATE_LOGIC( curr_param->actual_argument(),
- BOOST_RT_PARAM_LITERAL( "Required argument for parameter " ) << curr_param->id_2_report()
- << BOOST_RT_PARAM_LITERAL( " is missing" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( curr_param->actual_argument(),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Required argument for parameter " ) << curr_param->id_2_report()
+ << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " is missing" ) );
}
}
}
- catch( bad_lexical_cast const& ) {
- BOOST_RT_PARAM_REPORT_LOGIC_ERROR(
- BOOST_RT_PARAM_LITERAL( "String to value convertion error during input parsing" ) );
- }
+ BOOST_TEST_IMPL_CATCH0( bad_lexical_cast ) {
+ BOOST_TEST_UTILS_RUNTIME_PARAM_REPORT_LOGIC_ERROR(
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "String to value convertion error during input parsing" ) );
+ };
m_traverser.remainder( argc, argv );
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE const_argument_ptr
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE const_argument_ptr
parser::operator[]( cstring string_id ) const
{
parameter_ptr found_param;
BOOST_TEST_FOREACH( parameter_ptr const&, curr_param, m_parameters ) {
if( curr_param->responds_to( string_id ) ) {
- BOOST_RT_PARAM_VALIDATE_LOGIC( !found_param,
- BOOST_RT_PARAM_LITERAL( "Ambiguous parameter string id: " ) << string_id );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !found_param,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Ambiguous parameter string id: " ) << string_id );
found_param = curr_param;
}
@@ -180,7 +180,7 @@ parser::operator[]( cstring string_id ) const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE cstring
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring
parser::get( cstring string_id ) const
{
return get<cstring>( string_id );
@@ -188,46 +188,46 @@ parser::get( cstring string_id ) const
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
parser::usage( out_stream& ostr )
{
if( m_program_name.empty() )
- assign_op( m_program_name, BOOST_RT_PARAM_CSTRING_LITERAL( "<program>" ), 0 );
+ assign_op( m_program_name, BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "<program>" ), 0 );
format_stream fs;
fs << m_program_name;
BOOST_TEST_FOREACH( parameter_ptr const&, curr_param, m_parameters ) {
- fs << BOOST_RT_PARAM_LITERAL( ' ' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' );
if( curr_param->p_optional )
- fs << BOOST_RT_PARAM_LITERAL( '[' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '[' );
curr_param->usage_info( fs );
if( curr_param->p_optional )
- fs << BOOST_RT_PARAM_LITERAL( ']' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ']' );
if( curr_param->p_multiplicable ) {
- fs << BOOST_RT_PARAM_CSTRING_LITERAL( " ... " );
-
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( " ... " );
+
if( curr_param->p_optional )
- fs << BOOST_RT_PARAM_LITERAL( '[' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '[' );
curr_param->usage_info( fs );
if( curr_param->p_optional )
- fs << BOOST_RT_PARAM_LITERAL( ']' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ']' );
}
}
- ostr << BOOST_RT_PARAM_CSTRING_LITERAL( "Usage:\n" ) << fs.str() << std::endl;
+ ostr << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "Usage:\n" ) << fs.str() << std::endl;
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
parser::help( out_stream& ostr )
{
usage( ostr );
@@ -239,20 +239,29 @@ parser::help( out_stream& ostr )
continue;
if( need_where ) {
- ostr << BOOST_RT_PARAM_CSTRING_LITERAL( "where:\n" );
+ ostr << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "where:\n" );
need_where = false;
}
- ostr << curr_param->id_2_report() << BOOST_RT_PARAM_CSTRING_LITERAL( " - " ) << curr_param->p_description << std::endl;
+ ostr << curr_param->id_2_report() << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( " - " ) << curr_param->p_description << std::endl;
}
}
//____________________________________________________________________________//
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
+parser::reset()
+{
+ BOOST_TEST_FOREACH( parameter_ptr const&, param, m_parameters )
+ param->reset();
+}
+
+//____________________________________________________________________________//
+
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_PARSER_IPP_062904GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_IPP
diff --git a/boost/test/utils/runtime/cla/positional_parameter.hpp b/boost/test/utils/runtime/cla/positional_parameter.hpp
index 60da845627..f378743dd5 100644
--- a/boost/test/utils/runtime/cla/positional_parameter.hpp
+++ b/boost/test/utils/runtime/cla/positional_parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : positional parameter model
// ***************************************************************************
-#ifndef BOOST_RT_CLA_POSITIONAL_PARAMETER_HPP_062604GER
-#define BOOST_RT_CLA_POSITIONAL_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_POSITIONAL_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_POSITIONAL_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -22,7 +22,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -35,17 +35,17 @@ public:
trivial_id_policy()
: identification_policy( rtti::type_id<trivial_id_policy>() )
{}
- BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~trivial_id_policy() {}
+ BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~trivial_id_policy() {}
virtual bool responds_to( cstring name ) const { return m_name == name; }
virtual bool conflict_with( identification_policy const& ) const { return false; }
virtual cstring id_2_report() const { return m_name; }
virtual void usage_info( format_stream& fs ) const
- {
+ {
if( !m_name.empty() )
- fs << BOOST_RT_PARAM_LITERAL( '<' ) << m_name << BOOST_RT_PARAM_LITERAL( '>' );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '<' ) << m_name << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '>' );
else
- fs << BOOST_RT_PARAM_CSTRING_LITERAL( "<value>" );
+ fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "<value>" );
}
virtual bool matching( parameter const& p, argv_traverser&, bool primary ) const
@@ -80,12 +80,12 @@ public:
//____________________________________________________________________________//
-BOOST_RT_CLA_NAMED_PARAM_GENERATORS( positional_parameter )
+BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( positional_parameter )
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_POSITIONAL_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_POSITIONAL_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/cla/typed_parameter.hpp b/boost/test/utils/runtime/cla/typed_parameter.hpp
index 3d4c57b23a..70c5bbc009 100644
--- a/boost/test/utils/runtime/cla/typed_parameter.hpp
+++ b/boost/test/utils/runtime/cla/typed_parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : generic typed parameter model
// ***************************************************************************
-#ifndef BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER
-#define BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_TYPED_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_TYPED_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -29,7 +29,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -40,8 +40,8 @@ namespace cla {
template<typename T>
class typed_parameter : public cla::parameter {
public:
- explicit typed_parameter( identification_policy& ID )
- : cla::parameter( ID, m_arg_factory, rtti::type_id<T>() == rtti::type_id<bool>() )
+ explicit typed_parameter( identification_policy& ID )
+ : cla::parameter( ID, m_arg_factory, rtti::type_id<T>() == rtti::type_id<bool>() )
{}
// parameter properties modification
@@ -52,8 +52,8 @@ public:
m_arg_factory.accept_modifier( m );
- BOOST_RT_PARAM_VALIDATE_LOGIC( !p_optional || !m_arg_factory.m_value_generator,
- BOOST_RT_PARAM_LITERAL( "can't define a value generator for optional parameter " ) << id_2_report() );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !p_optional || !m_arg_factory.m_value_generator,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "can't define a value generator for optional parameter " ) << id_2_report() );
}
private:
@@ -63,8 +63,8 @@ private:
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_TYPED_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/cla/validation.cpp b/boost/test/utils/runtime/cla/validation.cpp
index f5c1e6669a..7f19a5ca45 100644
--- a/boost/test/utils/runtime/cla/validation.cpp
+++ b/boost/test/utils/runtime/cla/validation.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,5 +12,5 @@
// Description : input validation helpers offline implementation
// ***************************************************************************
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/cla/validation.ipp>
diff --git a/boost/test/utils/runtime/cla/validation.hpp b/boost/test/utils/runtime/cla/validation.hpp
index 57a7f2459f..8a3da14c5b 100644
--- a/boost/test/utils/runtime/cla/validation.hpp
+++ b/boost/test/utils/runtime/cla/validation.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : input validation helpers definition
// ***************************************************************************
-#ifndef BOOST_RT_CLA_VALIDATION_HPP_062604GER
-#define BOOST_RT_CLA_VALIDATION_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -22,7 +22,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -34,22 +34,24 @@ void report_input_error( argv_traverser const& tr, format_stream& msg );
//____________________________________________________________________________//
-#define BOOST_RT_CLA_VALIDATE_INPUT( b, tr, msg ) \
- if( b ) ; else ::boost::BOOST_RT_PARAM_NAMESPACE::cla::report_input_error( tr, format_stream().ref() << msg )
+#define BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( b, tr, msg ) \
+ if( b ) ; else ::boost::BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::cla::report_input_error( tr, format_stream().ref() << msg )
//____________________________________________________________________________//
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-# define BOOST_RT_PARAM_INLINE inline
-# include <boost/test/utils/runtime/cla/validation.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/cla/validation.ipp>
#endif
-#endif // BOOST_RT_CLA_VALIDATION_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_HPP
diff --git a/boost/test/utils/runtime/cla/validation.ipp b/boost/test/utils/runtime/cla/validation.ipp
index 9728bd6702..9d8cd27b4a 100644
--- a/boost/test/utils/runtime/cla/validation.ipp
+++ b/boost/test/utils/runtime/cla/validation.ipp
@@ -1,35 +1,31 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : input validation helpers implementation
+//! @file
+//! @brief Input validation helpers implementation
// ***************************************************************************
-#ifndef BOOST_RT_CLA_VALIDATION_IPP_070604GER
-#define BOOST_RT_CLA_VALIDATION_IPP_070604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_IPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
#include <boost/test/utils/runtime/cla/argv_traverser.hpp>
#include <boost/test/utils/runtime/cla/validation.hpp>
-#include <boost/test/utils/runtime/validation.hpp> // BOOST_RT_PARAM_NAMESPACE::logic_error
+#include <boost/test/utils/runtime/validation.hpp> // BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error
-// Boost
+// Boost.Test
#include <boost/test/utils/basic_cstring/io.hpp>
-
-// STL
+#include <boost/test/detail/throw_exception.hpp>
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -37,29 +33,29 @@ namespace cla {
// ************** runtime::cla::validation ************** //
// ************************************************************************** //
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
report_input_error( argv_traverser const& tr, format_stream& msg )
{
if( tr.eoi() )
- msg << BOOST_RT_PARAM_LITERAL( " at the end of input" );
+ msg << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " at the end of input" );
else {
- msg << BOOST_RT_PARAM_LITERAL( " in the following position: " );
+ msg << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " in the following position: " );
if( tr.input().size() > 5 )
- msg << tr.input().substr( 0, 5 ) << BOOST_RT_PARAM_LITERAL( "..." );
+ msg << tr.input().substr( 0, 5 ) << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "..." );
else
msg << tr.input();
}
- throw BOOST_RT_PARAM_NAMESPACE::logic_error( msg.str() );
+ BOOST_TEST_IMPL_THROW( BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() ) );
}
//____________________________________________________________________________//
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_VALIDATION_IPP_070604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_IPP
diff --git a/boost/test/utils/runtime/cla/value_generator.hpp b/boost/test/utils/runtime/cla/value_generator.hpp
index ab15c9b551..0efc25def1 100644
--- a/boost/test/utils/runtime/cla/value_generator.hpp
+++ b/boost/test/utils/runtime/cla/value_generator.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : specific value generators
// ***************************************************************************
-#ifndef BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
-#define BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_GENERATOR_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_GENERATOR_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -74,8 +74,8 @@ private:
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_GENERATOR_HPP
diff --git a/boost/test/utils/runtime/cla/value_handler.hpp b/boost/test/utils/runtime/cla/value_handler.hpp
index fbf99667aa..38792602ac 100644
--- a/boost/test/utils/runtime/cla/value_handler.hpp
+++ b/boost/test/utils/runtime/cla/value_handler.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : specific value handlers
// ***************************************************************************
-#ifndef BOOST_RT_CLA_VALUE_HANDLER_HPP_062604GER
-#define BOOST_RT_CLA_VALUE_HANDLER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_HANDLER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_HANDLER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -22,7 +22,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace cla {
@@ -50,8 +50,8 @@ private:
} // namespace cla
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CLA_VALUE_HANDLER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_HANDLER_HPP
diff --git a/boost/test/utils/runtime/config.hpp b/boost/test/utils/runtime/config.hpp
index 771a8ee7af..dfa9ae30de 100644
--- a/boost/test/utils/runtime/config.hpp
+++ b/boost/test/utils/runtime/config.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : Runtime.Param library configuration
// ***************************************************************************
-#ifndef BOOST_RT_CONFIG_HPP_062604GER
-#define BOOST_RT_CONFIG_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CONFIG_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CONFIG_HPP
// Boost
#include <boost/config.hpp>
@@ -34,26 +34,28 @@
#include <string>
#include <cstdlib>
+#ifdef __SUNPRO_CC
+ #include <stdlib.h>
+#endif
+
//____________________________________________________________________________//
-#ifndef BOOST_RT_PARAM_CUSTOM_STRING
-# ifndef BOOST_RT_PARAM_WIDE_STRING
-# define BOOST_RT_PARAM_NAMESPACE runtime
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_CUSTOM_STRING
+# ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_WIDE_STRING
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE runtime
# else
-# define BOOST_RT_PARAM_NAMESPACE wide_runtime
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE wide_runtime
# endif
#endif
-#ifdef __SUNPRO_CC
-extern int putenv(char*);
-#endif
+
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
-#ifndef BOOST_RT_PARAM_CUSTOM_STRING
-# ifndef BOOST_RT_PARAM_WIDE_STRING
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_CUSTOM_STRING
+# ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_WIDE_STRING
typedef char char_type;
typedef std::string dstring;
@@ -72,6 +74,10 @@ typedef std::basic_ostream<char_type> out_stream;
#pragma warning(disable:4996) // putenv
#endif
+#if defined(__MINGW32__)
+extern "C" int putenv( const char * );
+#endif
+
#ifndef UNDER_CE
#if defined(__COMO__) && 0
inline void
@@ -97,15 +103,15 @@ putenv_impl( cstring name, cstring value )
#endif
#endif
-#ifdef BOOST_MSVC
-#pragma warning(pop)
-#endif
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#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 ::boost::BOOST_RT_PARAM_NAMESPACE::putenv_impl
-#define BOOST_RT_PARAM_EXCEPTION_INHERIT_STD
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( l ) l
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( l ) cstring( l, sizeof( l ) - 1 )
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_GETENV getenv
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_PUTENV ::boost::BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::putenv_impl
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_EXCEPTION_INHERIT_STD
//____________________________________________________________________________//
@@ -133,24 +139,24 @@ putenv_impl( cstring name, cstring value )
}
#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 )
-#define BOOST_RT_PARAM_GETENV wgetenv
-#define BOOST_RT_PARAM_PUTENV putenv_impl
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( l ) L ## l
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( l ) cstring( L ## l, sizeof( L ## l )/sizeof(wchar_t) - 1 )
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_GETENV wgetenv
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_PUTENV putenv_impl
# endif
#endif
#ifdef __GNUC__
-#define BOOST_RT_PARAM_UNNEEDED_VIRTUAL virtual
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL virtual
#else
-#define BOOST_RT_PARAM_UNNEEDED_VIRTUAL
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL
#endif
//____________________________________________________________________________//
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CONFIG_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CONFIG_HPP
diff --git a/boost/test/utils/runtime/configuration.hpp b/boost/test/utils/runtime/configuration.hpp
index 4c133bdea2..bf731736ee 100644
--- a/boost/test/utils/runtime/configuration.hpp
+++ b/boost/test/utils/runtime/configuration.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : abstract interface for the formal parameter
// ***************************************************************************
-#ifndef BOOST_RT_CONFIGURATION_HPP_062604GER
-#define BOOST_RT_CONFIGURATION_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_CONFIGURATION_HPP
+#define BOOST_TEST_UTILS_RUNTIME_CONFIGURATION_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -22,7 +22,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
// ************************************************************************** //
// ************** runtime::configuration ************** //
@@ -54,8 +54,8 @@ public:
private:
};
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_CONFIGURATION_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_CONFIGURATION_HPP
diff --git a/boost/test/utils/runtime/env/environment.cpp b/boost/test/utils/runtime/env/environment.cpp
index a7a0fdf0c2..ddf47b342c 100644
--- a/boost/test/utils/runtime/env/environment.cpp
+++ b/boost/test/utils/runtime/env/environment.cpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2004-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,7 +9,7 @@
//
// Version : $Revision$
//
-// Description : implements offline model of program environment
+// Description : implements offline model of program environment
// ***************************************************************************
#include <boost/test/utils/runtime/config.hpp>
@@ -19,5 +19,5 @@
# pragma warning(disable: 4701) // local environment 'result' may be used without having been initialized
#endif
-#define BOOST_RT_PARAM_INLINE
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
#include <boost/test/utils/runtime/env/environment.ipp>
diff --git a/boost/test/utils/runtime/env/environment.hpp b/boost/test/utils/runtime/env/environment.hpp
index f3170ff53a..62b2ae6dc1 100644
--- a/boost/test/utils/runtime/env/environment.hpp
+++ b/boost/test/utils/runtime/env/environment.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,11 +9,11 @@
//
// Version : $Revision$
//
-// Description : defines and implements inline model of program environment
+// Description : defines and implements inline model of program environment
// ***************************************************************************
-#ifndef BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER
-#define BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_HPP
+#define BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_HPP
#ifdef UNDER_CE
#error Windows CE does not support environment variables.
@@ -29,15 +29,12 @@
#include <boost/test/utils/runtime/env/modifier.hpp>
#include <boost/test/utils/runtime/env/variable.hpp>
-// Boost.Test
-#include <boost/test/utils/callback.hpp>
-
// Boost
#include <boost/optional.hpp>
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
// ************************************************************************** //
// ************** runtime::environment implementation ************** //
@@ -56,7 +53,7 @@ init_new_var( cstring var_name, Modifiers m = nfp::no_params )
cstring str_value = sys_read_var( new_vd.m_var_name );
if( !str_value.is_empty() ) {
- try {
+ BOOST_TEST_IMPL_TRY {
boost::optional<T> value;
if( m.has( interpreter ) )
@@ -70,7 +67,7 @@ init_new_var( cstring var_name, Modifiers m = nfp::no_params )
arg_value<T>( *new_vd.m_value ) = *value;
}
}
- catch( ... ) { // !! could we do that
+ BOOST_TEST_IMPL_CATCHALL() { // !! could we do that
// !! should we report an error?
}
}
@@ -158,15 +155,17 @@ namespace environment {
namespace env = environment;
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#ifndef BOOST_RT_PARAM_OFFLINE
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE
-#define BOOST_RT_PARAM_INLINE inline
-#include <boost/test/utils/runtime/env/environment.ipp>
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline
+#endif
+# include <boost/test/utils/runtime/env/environment.ipp>
#endif
-#endif // BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_HPP
diff --git a/boost/test/utils/runtime/env/environment.ipp b/boost/test/utils/runtime/env/environment.ipp
index 5a320003f7..6baf72f430 100644
--- a/boost/test/utils/runtime/env/environment.ipp
+++ b/boost/test/utils/runtime/env/environment.ipp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -9,11 +9,11 @@
//
// Version : $Revision$
//
-// Description : implements model of program environment
+// Description : implements model of program environment
// ***************************************************************************
-#ifndef BOOST_RT_ENV_ENVIRONMENT_IPP_062904GER
-#define BOOST_RT_ENV_ENVIRONMENT_IPP_062904GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_IPP
+#define BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_IPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -31,7 +31,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace environment {
@@ -44,10 +44,10 @@ namespace rt_env_detail {
typedef std::map<cstring,rt_env_detail::variable_data> registry;
typedef std::list<dstring> keys;
-BOOST_RT_PARAM_INLINE registry& s_registry() { static registry instance; return instance; }
-BOOST_RT_PARAM_INLINE keys& s_keys() { static keys instance; return instance; }
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE registry& s_registry() { static registry instance; return instance; }
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE keys& s_keys() { static keys instance; return instance; }
-BOOST_RT_PARAM_INLINE variable_data&
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE variable_data&
new_var_record( cstring var_name )
{
// save the name in list of keys
@@ -57,15 +57,15 @@ new_var_record( cstring var_name )
// create and return new record
variable_data& new_var_data = s_registry()[key];
-
+
new_var_data.m_var_name = key;
-
+
return new_var_data;
}
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE variable_data*
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE variable_data*
find_var_record( cstring var_name )
{
registry::iterator it = s_registry().find( var_name );
@@ -75,41 +75,41 @@ find_var_record( cstring var_name )
//____________________________________________________________________________//
-#ifdef BOOST_MSVC
-#pragma warning(push)
+#ifdef BOOST_MSVC
+#pragma warning(push)
#pragma warning(disable:4996) // getenv
#endif
-BOOST_RT_PARAM_INLINE cstring
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring
sys_read_var( cstring var_name )
{
using namespace std;
- return BOOST_RT_PARAM_GETENV( var_name.begin() );
+ return BOOST_TEST_UTILS_RUNTIME_PARAM_GETENV( var_name.begin() );
}
-#ifdef BOOST_MSVC
-#pragma warning(pop)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
#endif
//____________________________________________________________________________//
-BOOST_RT_PARAM_INLINE void
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void
sys_write_var( cstring var_name, format_stream& var_value )
{
- BOOST_RT_PARAM_PUTENV( var_name, cstring( var_value.str() ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_PUTENV( var_name, cstring( var_value.str() ) );
}
//____________________________________________________________________________//
} // namespace rt_env_detail
-BOOST_RT_PARAM_INLINE variable_base
+BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE variable_base
var( cstring var_name )
{
rt_env_detail::variable_data* vd = rt_env_detail::find_var_record( var_name );
- BOOST_RT_PARAM_VALIDATE_LOGIC( !!vd,
- BOOST_RT_PARAM_LITERAL( "First access to the environment variable " )
- << var_name << BOOST_RT_PARAM_LITERAL( " should be typed" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !!vd,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "First access to the environment variable " )
+ << var_name << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " should be typed" ) );
return variable_base( *vd );
}
@@ -118,8 +118,8 @@ var( cstring var_name )
} // namespace environment
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_ENV_ENVIRONMENT_IPP_062904GER
+#endif // BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_IPP_062904GER
diff --git a/boost/test/utils/runtime/env/fwd.hpp b/boost/test/utils/runtime/env/fwd.hpp
index dff5dfd299..438795ea8f 100644
--- a/boost/test/utils/runtime/env/fwd.hpp
+++ b/boost/test/utils/runtime/env/fwd.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : environment subsystem forward declarations
// ***************************************************************************
-#ifndef BOOST_RT_ENV_FWD_HPP_062604GER
-#define BOOST_RT_ENV_FWD_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_FWD_HPP
+#define BOOST_TEST_UTILS_RUNTIME_ENV_FWD_HPP
#ifdef UNDER_CE
#error Windows CE does not support environment variables.
@@ -24,13 +24,20 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace environment {
+template<typename T>
+class variable;
+
class variable_base;
variable_base var( cstring var_name );
+template<typename T>
+inline variable<T>
+ var( cstring var_name );
+
namespace rt_env_detail {
struct variable_data;
@@ -47,8 +54,8 @@ template <typename T> class variable;
} // namespace environment
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_ENV_FWD_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_ENV_FWD_HPP
diff --git a/boost/test/utils/runtime/env/modifier.hpp b/boost/test/utils/runtime/env/modifier.hpp
index cdd6be908f..536461a549 100644
--- a/boost/test/utils/runtime/env/modifier.hpp
+++ b/boost/test/utils/runtime/env/modifier.hpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -12,8 +12,8 @@
// Description : defines variable modifiers
// ***************************************************************************
-#ifndef BOOST_RT_ENV_MODIFIER_HPP_062604GER
-#define BOOST_RT_ENV_MODIFIER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_MODIFIER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_ENV_MODIFIER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace environment {
@@ -40,8 +40,8 @@ nfp::keyword<struct interpreter_t> interpreter;
} // local namespace
} // namespace environment
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_ENV_MODIFIER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_ENV_MODIFIER_HPP
diff --git a/boost/test/utils/runtime/env/variable.hpp b/boost/test/utils/runtime/env/variable.hpp
index 8e8b0a0737..df776a619a 100644
--- a/boost/test/utils/runtime/env/variable.hpp
+++ b/boost/test/utils/runtime/env/variable.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : defines model of program environment variable
// ***************************************************************************
-#ifndef BOOST_RT_ENV_VARIABLE_HPP_062604GER
-#define BOOST_RT_ENV_VARIABLE_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_VARIABLE_HPP
+#define BOOST_TEST_UTILS_RUNTIME_ENV_VARIABLE_HPP
#ifdef UNDER_CE
#error Windows CE does not support environment variables.
@@ -32,7 +32,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace environment {
@@ -74,7 +74,7 @@ public:
res.reset();
}
- bool has_value() const { return m_data->m_value!=0; }
+ bool has_value() const { return !!m_data->m_value; }
cstring name() const { return m_data->m_var_name; }
protected:
@@ -95,7 +95,7 @@ public:
template<typename Modifiers>
explicit variable( cstring var_name, Modifiers const& m );
- explicit variable( rt_env_detail::variable_data& data )
+ explicit variable( rt_env_detail::variable_data& data )
: variable_base( data ) {}
// other variable assignment
@@ -179,7 +179,7 @@ operator!=( V const& v, variable<T> ev )
} // namespace environment
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
@@ -195,7 +195,7 @@ operator!=( V const& v, variable<T> ev )
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace environment {
@@ -216,8 +216,8 @@ variable<T>::variable( cstring var_name, Modifiers const& m )
} // namespace environment
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_ENV_VARIABLE_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_ENV_VARIABLE_HPP
diff --git a/boost/test/utils/runtime/file/config_file.cpp b/boost/test/utils/runtime/file/config_file.cpp
index d369d79504..1e13d66eee 100644
--- a/boost/test/utils/runtime/file/config_file.cpp
+++ b/boost/test/utils/runtime/file/config_file.cpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -26,7 +26,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace file {
@@ -60,7 +60,7 @@ operator<<( std::ostream& os, parameter const& p )
param_namespace::param_namespace( cstring name, param_namespace const* parent )
: p_parent( parent )
{
- assign_op( p_name.value, name );
+ assign_op( p_name.value, name, 0 );
}
//____________________________________________________________________________//
@@ -69,8 +69,8 @@ void
param_namespace::insert_param( cstring param_name, cstring param_value )
{
BOOST_TEST_FOREACH( parameter const&, p, m_parameters )
- BOOST_RT_PARAM_VALIDATE_LOGIC( p.p_name != param_name,
- BOOST_RT_PARAM_LITERAL( "Duplicate parameter " ) << param_name );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( p.p_name != param_name,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Duplicate parameter " ) << param_name );
m_parameters.push_back( parameter( param_name, param_value, *this ) );
}
@@ -133,7 +133,7 @@ get_param_value( param_namespace const& where_from,
return res;
}
-
+
param_namespace const* sns = get_param_subns( where_from, name_part1 );
return sns ? get_param_value( *sns, name_part2, name_part3, name_part4, name_part5 )
@@ -153,13 +153,13 @@ get_requ_param_value( param_namespace const& where_from,
boost::optional<cstring> v = get_param_value( where_from, name_part1, name_part2, name_part3, name_part4, name_part5 );
#define APPEND_PART( part ) (part.is_empty() ? "" : "::") << (part.is_empty() ? cstring() : part)
- BOOST_RT_PARAM_VALIDATE_LOGIC( !!v, BOOST_RT_PARAM_LITERAL( "Required parameter " )
- << name_part1
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !!v, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Required parameter " )
+ << name_part1
<< APPEND_PART( name_part2 )
<< APPEND_PART( name_part3 )
<< APPEND_PART( name_part4 )
<< APPEND_PART( name_part5 )
- << BOOST_RT_PARAM_LITERAL( " value is missing" ) );
+ << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " value is missing" ) );
#undef APPEND_PART
return *v;
@@ -186,7 +186,7 @@ get_param_subns( param_namespace const& where_from, cstring namespace_name )
//____________________________________________________________________________//
void
-param_namespace::load_impl( config_file_iterator cf_it,
+param_namespace::load_impl( config_file_iterator cf_it,
cstring value_marker, cstring value_delimeter, cstring namespace_delimeter )
{
using namespace unit_test;
@@ -242,7 +242,7 @@ config_file::config_file( cstring file_name )
} // namespace file
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
diff --git a/boost/test/utils/runtime/file/config_file.hpp b/boost/test/utils/runtime/file/config_file.hpp
index f9c71b8138..e7baf08bf2 100644
--- a/boost/test/utils/runtime/file/config_file.hpp
+++ b/boost/test/utils/runtime/file/config_file.hpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -12,8 +12,8 @@
// Description : defines models configuration file, it's parameter and parameter namespaces
// ***************************************************************************
-#ifndef BOOST_RT_FILE_CONFIG_FILE_HPP_010105GER
-#define BOOST_RT_FILE_CONFIG_FILE_HPP_010105GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_HPP
+#define BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -32,7 +32,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace file {
@@ -65,7 +65,7 @@ namespace {
nfp::typed_keyword<cstring, struct value_marker_t> value_marker;
nfp::typed_keyword<cstring, struct value_delimeter_t> value_delimeter;
nfp::typed_keyword<cstring, struct namespace_delimeter_t> namespace_delimeter;
-} // local namespace
+} // local namespace
// ************************************************************************** //
// ************** runtime::file::param_namespace ************** //
@@ -86,9 +86,9 @@ public:
template<typename Modifier>
void load( config_file_iterator cf_it, Modifier const& m )
{
- cstring vm = m.has( value_marker ) ? m[value_marker] : BOOST_RT_PARAM_CSTRING_LITERAL( "\"" );
- cstring vd = m.has( value_delimeter ) ? m[value_delimeter] : BOOST_RT_PARAM_CSTRING_LITERAL( "= \t\n\r" );
- cstring nd = m.has( namespace_delimeter ) ? m[namespace_delimeter] : BOOST_RT_PARAM_CSTRING_LITERAL( "::" );
+ cstring vm = m.has( value_marker ) ? m[value_marker] : BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "\"" );
+ cstring vd = m.has( value_delimeter ) ? m[value_delimeter] : BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "= \t\n\r" );
+ cstring nd = m.has( namespace_delimeter ) ? m[namespace_delimeter] : BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "::" );
load_impl( cf_it, vm, vd, nd );
}
@@ -126,7 +126,7 @@ protected:
explicit param_namespace( cstring name, param_namespace const* parent = 0 );
private:
- void load_impl( config_file_iterator cf_it,
+ void load_impl( config_file_iterator cf_it,
cstring value_marker_, cstring value_delimeter_, cstring namespace_delimeter_ );
// Data members
@@ -175,8 +175,8 @@ public:
} // namespace file
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_FILE_CONFIG_FILE_HPP_010105GER
+#endif // BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_HPP_010105GER
diff --git a/boost/test/utils/runtime/file/config_file_iterator.cpp b/boost/test/utils/runtime/file/config_file_iterator.cpp
index a81a0c83e5..5d6cbdf7dc 100644
--- a/boost/test/utils/runtime/file/config_file_iterator.cpp
+++ b/boost/test/utils/runtime/file/config_file_iterator.cpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -24,9 +24,9 @@
// Boost
-#include <boost/utility.hpp>
#include <boost/scoped_array.hpp>
#include <boost/bind.hpp>
+#include <boost/noncopyable.hpp>
// Boost.Test
#include <boost/test/utils/basic_cstring/compare.hpp>
@@ -45,7 +45,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace file {
@@ -71,7 +71,7 @@ struct symbol_to_value_map : std::map<cstring, ValueType> {
m_name_store.erase( it );
- erase( name );
+ this->erase( name );
}
private:
@@ -106,7 +106,7 @@ is_valid_identifier( cstring const& source )
return false;
while( ++it < source.end() ) {
- if( !std::isalnum( *it ) && *it != BOOST_RT_PARAM_LITERAL( '_' ) && *it != BOOST_RT_PARAM_LITERAL( '-' ) )
+ if( !std::isalnum( *it ) && *it != BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '_' ) && *it != BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '-' ) )
return false;
}
@@ -158,7 +158,7 @@ include_level::include_level( cstring file_name, cstring path_separators, includ
}
}
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_RT_PARAM_LITERAL( "can't open file " ) << file_name );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "can't open file " ) << file_name );
}
//____________________________________________________________________________//
@@ -234,21 +234,21 @@ struct config_file_iterator::Impl : noncopyable {
//____________________________________________________________________________//
config_file_iterator::Impl::Impl()
-: m_path_separators( BOOST_RT_PARAM_LITERAL( "/\\" ) )
-, m_line_delimeter( BOOST_RT_PARAM_LITERAL( '\n' ) )
-, m_sl_comment_delimeter( BOOST_RT_PARAM_LITERAL( "#" ) )
-, m_command_delimeter( BOOST_RT_PARAM_LITERAL( "$" ) )
-, m_line_beak( BOOST_RT_PARAM_LITERAL( "\\" ) )
-, m_macro_ref_begin( BOOST_RT_PARAM_LITERAL( "$" ) )
-, m_macro_ref_end( BOOST_RT_PARAM_LITERAL( "$" ) )
-
-, m_include_kw( BOOST_RT_PARAM_LITERAL( "include" ) )
-, m_define_kw( BOOST_RT_PARAM_LITERAL( "define" ) )
-, m_undef_kw( BOOST_RT_PARAM_LITERAL( "undef" ) )
-, m_ifdef_kw( BOOST_RT_PARAM_LITERAL( "ifdef" ) )
-, m_ifndef_kw( BOOST_RT_PARAM_LITERAL( "ifndef" ) )
-, m_else_kw( BOOST_RT_PARAM_LITERAL( "else" ) )
-, m_endif_kw( BOOST_RT_PARAM_LITERAL( "endif" ) )
+: m_path_separators( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "/\\" ) )
+, m_line_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '\n' ) )
+, m_sl_comment_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "#" ) )
+, m_command_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) )
+, m_line_beak( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "\\" ) )
+, m_macro_ref_begin( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) )
+, m_macro_ref_end( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) )
+
+, m_include_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "include" ) )
+, m_define_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "define" ) )
+, m_undef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "undef" ) )
+, m_ifdef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "ifdef" ) )
+, m_ifndef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "ifndef" ) )
+, m_else_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "else" ) )
+, m_endif_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "endif" ) )
, m_buffer_size( 8192 )
@@ -338,9 +338,9 @@ config_file_iterator::Impl::get_next_line( cstring& line )
return true; // 110 //
}
- BOOST_RT_PARAM_VALIDATE_LOGIC( !broken_line, BOOST_RT_PARAM_LITERAL( "broken line is not completed" ) );
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() == 0,
- BOOST_RT_PARAM_LITERAL( "matching endif command is missing" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !broken_line, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "broken line is not completed" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() == 0,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "matching endif command is missing" ) );
return false;
}
@@ -359,14 +359,14 @@ config_file_iterator::Impl::get_macro_value( cstring macro_name, bool ignore_mis
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( "\"" ) );
-
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( macro_value || ignore_missing || !m_detect_missing_macro,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Unknown macro \"" ) << macro_name << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "\"" ) );
+
if( !macro_value ) {
if( !ignore_missing )
macro_value = cstring();
}
- else
+ else
m_symbols_table.add( macro_name, *macro_value );
return macro_value;
@@ -386,7 +386,7 @@ config_file_iterator::Impl::process_command_line( cstring line )
command_handler_map::const_iterator it = m_command_handler_map.find( *tit );
- BOOST_RT_PARAM_VALIDATE_LOGIC( it != m_command_handler_map.end(), BOOST_RT_PARAM_LITERAL( "Invalid command " ) << *tit );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( it != m_command_handler_map.end(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Invalid command " ) << *tit );
++tit;
@@ -405,13 +405,13 @@ config_file_iterator::Impl::process_include( cstring line )
string_token_iterator tit( line, kept_delimeters = dt_none );
- BOOST_RT_PARAM_VALIDATE_LOGIC( tit != string_token_iterator(),
- BOOST_RT_PARAM_LITERAL( "include file name missing" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( tit != string_token_iterator(),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "include file name missing" ) );
cstring include_file_name = *tit;
- BOOST_RT_PARAM_VALIDATE_LOGIC( ++tit == string_token_iterator(),
- BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of include command" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( ++tit == string_token_iterator(),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of include command" ) );
substitute_macros( include_file_name );
@@ -431,8 +431,8 @@ config_file_iterator::Impl::process_define( cstring line )
string_token_iterator tit( line, (kept_delimeters = dt_none, max_tokens = 2 ));
cstring macro_name = *tit;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
cstring macro_value = *(++tit);
substitute_macros( macro_value );
@@ -449,8 +449,8 @@ config_file_iterator::Impl::process_undef( cstring line )
return;
cstring macro_name = line;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
m_symbols_table.remove( macro_name );
}
@@ -465,8 +465,8 @@ config_file_iterator::Impl::process_ifdef( cstring line )
return;
cstring macro_name = line;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
if( !get_macro_value( macro_name ) )
m_inactive_ifdef_level = m_conditional_states.size();
@@ -482,8 +482,8 @@ config_file_iterator::Impl::process_ifndef( cstring line )
return;
cstring macro_name = line;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
if( get_macro_value( macro_name ) )
m_inactive_ifdef_level = m_conditional_states.size();
@@ -494,12 +494,12 @@ config_file_iterator::Impl::process_ifndef( cstring line )
void
config_file_iterator::Impl::process_else( cstring line )
{
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0 && m_conditional_states.back(),
- BOOST_RT_PARAM_LITERAL( "else without matching if" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0 && m_conditional_states.back(),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "else without matching if" ) );
m_inactive_ifdef_level = m_conditional_states.size() == m_inactive_ifdef_level ? 0 : m_conditional_states.size();
- BOOST_RT_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of else command" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of else command" ) );
}
//____________________________________________________________________________//
@@ -507,13 +507,13 @@ config_file_iterator::Impl::process_else( cstring line )
void
config_file_iterator::Impl::process_endif( cstring line )
{
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0, BOOST_RT_PARAM_LITERAL( "endif without matching if" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "endif without matching if" ) );
if( m_conditional_states.size() == m_inactive_ifdef_level )
m_inactive_ifdef_level = 0;
m_conditional_states.pop_back();
- BOOST_RT_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of endif command" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of endif command" ) );
}
//____________________________________________________________________________//
@@ -531,7 +531,7 @@ config_file_iterator::Impl::substitute_macros( cstring& where )
pos = where.find( m_macro_ref_end );
- BOOST_RT_PARAM_VALIDATE_LOGIC( pos != cstring::npos, BOOST_RT_PARAM_LITERAL( "incomplete macro reference" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( pos != cstring::npos, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "incomplete macro reference" ) );
cstring value = *get_macro_value( where.substr( 0, pos ), false );
m_post_subst_line.append( value.begin(), value.size() );
@@ -562,18 +562,18 @@ config_file_iterator::construct()
void
config_file_iterator::load( cstring file_name )
{
- m_pimpl->m_curr_level.reset( new include_level( file_name, m_pimpl->m_path_separators ) );
- m_pimpl->m_buffer.reset( new char[m_pimpl->m_buffer_size] );
-
- register_command_handler( m_pimpl->m_include_kw, bind( &Impl::process_include, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_define_kw, bind( &Impl::process_define, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_undef_kw, bind( &Impl::process_undef, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_ifdef_kw, bind( &Impl::process_ifdef, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_ifndef_kw, bind( &Impl::process_ifndef, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_else_kw, bind( &Impl::process_else, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_endif_kw, bind( &Impl::process_endif, m_pimpl.get(), _1 ) );
-
- init();
+ m_pimpl->m_curr_level.reset( new include_level( file_name, m_pimpl->m_path_separators ) );
+ m_pimpl->m_buffer.reset( new char[m_pimpl->m_buffer_size] );
+
+ register_command_handler( m_pimpl->m_include_kw, boost::bind( &Impl::process_include, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_define_kw, boost::bind( &Impl::process_define, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_undef_kw, boost::bind( &Impl::process_undef, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_ifdef_kw, boost::bind( &Impl::process_ifdef, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_ifndef_kw, boost::bind( &Impl::process_ifndef, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_else_kw, boost::bind( &Impl::process_else, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_endif_kw, boost::bind( &Impl::process_endif, m_pimpl.get(), _1 ) );
+
+ init();
}
//____________________________________________________________________________//
@@ -606,31 +606,31 @@ void
config_file_iterator::set_parameter( rtti::id_t id, cstring value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::path_separators_t )
+ BOOST_RTTI_CASE( cfg_detail::path_separators_t )
assign_op( m_pimpl->m_path_separators , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::sl_comment_delimeter_t )
+ BOOST_RTTI_CASE( cfg_detail::sl_comment_delimeter_t )
assign_op( m_pimpl->m_sl_comment_delimeter , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::command_delimeter_t )
+ BOOST_RTTI_CASE( cfg_detail::command_delimeter_t )
assign_op( m_pimpl->m_command_delimeter , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::line_beak_t )
+ BOOST_RTTI_CASE( cfg_detail::line_beak_t )
assign_op( m_pimpl->m_line_beak , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::macro_ref_begin_t )
+ BOOST_RTTI_CASE( cfg_detail::macro_ref_begin_t )
assign_op( m_pimpl->m_macro_ref_begin , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::macro_ref_end_t )
+ BOOST_RTTI_CASE( cfg_detail::macro_ref_end_t )
assign_op( m_pimpl->m_macro_ref_end , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::include_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::include_kw_t )
assign_op( m_pimpl->m_include_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::define_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::define_kw_t )
assign_op( m_pimpl->m_define_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::undef_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::undef_kw_t )
assign_op( m_pimpl->m_undef_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::ifdef_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::ifdef_kw_t )
assign_op( m_pimpl->m_ifdef_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::ifndef_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::ifndef_kw_t )
assign_op( m_pimpl->m_ifndef_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::else_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::else_kw_t )
assign_op( m_pimpl->m_else_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::endif_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::endif_kw_t )
assign_op( m_pimpl->m_endif_kw , value, 0 );
}
}
@@ -641,7 +641,7 @@ void
config_file_iterator::set_parameter( rtti::id_t id, bool value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::trim_leading_spaces_t )
+ BOOST_RTTI_CASE( cfg_detail::trim_leading_spaces_t )
m_pimpl->m_trim_leading_spaces = value;
BOOST_RTTI_CASE( cfg_detail::trim_trailing_spaces_t )
m_pimpl->m_trim_trailing_spaces = value;
@@ -658,7 +658,7 @@ void
config_file_iterator::set_parameter( rtti::id_t id, char_type value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::line_delimeter_t )
+ BOOST_RTTI_CASE( cfg_detail::line_delimeter_t )
m_pimpl->m_line_delimeter = value;
}
}
@@ -669,7 +669,7 @@ void
config_file_iterator::set_parameter( rtti::id_t id, std::size_t value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::buffer_size_t )
+ BOOST_RTTI_CASE( cfg_detail::buffer_size_t )
m_pimpl->m_buffer_size = value;
}
}
@@ -678,7 +678,7 @@ config_file_iterator::set_parameter( rtti::id_t id, std::size_t value )
} // namespace file
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
diff --git a/boost/test/utils/runtime/file/config_file_iterator.hpp b/boost/test/utils/runtime/file/config_file_iterator.hpp
index 23d4a94f22..6c6273fca1 100644
--- a/boost/test/utils/runtime/file/config_file_iterator.hpp
+++ b/boost/test/utils/runtime/file/config_file_iterator.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
-// Use, modification, and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright Gennadiy Rozental 2005-2014.
+// Use, modification, and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : flexible configuration file iterator definition
// ***************************************************************************
-#ifndef BOOST_RT_FILE_CONFIG_FILE_ITERATOR_HPP_062604GER
-#define BOOST_RT_FILE_CONFIG_FILE_ITERATOR_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_ITERATOR_HPP
+#define BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_ITERATOR_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -22,19 +22,19 @@
// Boost.Test
#include <boost/test/utils/iterator/input_iterator_facade.hpp>
-#include <boost/test/utils/callback.hpp>
#include <boost/test/utils/named_params.hpp>
// Boost
#include <boost/shared_ptr.hpp>
+#include <boost/function.hpp>
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace file {
-// Public typedef
+// Public typedef
typedef std::pair<dstring,long> location;
// ************************************************************************** //
@@ -99,7 +99,7 @@ class config_file_iterator : public unit_test::input_iterator_facade<config_file
typedef unit_test::input_iterator_facade<config_file_iterator,cstring,cstring> base;
public:
// Public typedefs
- typedef unit_test::callback1<cstring> command_handler;
+ typedef boost::function<void (cstring)> command_handler;
// Constructors
config_file_iterator() {}
@@ -159,8 +159,8 @@ private:
} // namespace file
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_FILE_CONFIG_FILE_ITERATOR_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_ITERATOR_HPP
diff --git a/boost/test/utils/runtime/fwd.hpp b/boost/test/utils/runtime/fwd.hpp
index aafdf69d17..2647184c5d 100644
--- a/boost/test/utils/runtime/fwd.hpp
+++ b/boost/test/utils/runtime/fwd.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : global framework level forward declaration
// ***************************************************************************
-#ifndef BOOST_RT_FWD_HPP_062604GER
-#define BOOST_RT_FWD_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_FWD_HPP
+#define BOOST_TEST_UTILS_RUNTIME_FWD_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -23,7 +23,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
class parameter;
@@ -34,8 +34,8 @@ typedef shared_ptr<argument const> const_argument_ptr;
template<typename T> class value_interpreter;
template<typename T> class typed_argument;
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_FWD_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_FWD_HPP
diff --git a/boost/test/utils/runtime/interpret_argument_value.hpp b/boost/test/utils/runtime/interpret_argument_value.hpp
index f767e7a29b..016caa017f 100644
--- a/boost/test/utils/runtime/interpret_argument_value.hpp
+++ b/boost/test/utils/runtime/interpret_argument_value.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,8 +12,8 @@
// Description : default algorithms for string to specific type convertions
// ***************************************************************************
-#ifndef BOOST_RT_INTERPRET_ARGUMENT_VALUE_HPP_062604GER
-#define BOOST_RT_INTERPRET_ARGUMENT_VALUE_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_INTERPRET_ARGUMENT_VALUE_HPP
+#define BOOST_TEST_UTILS_RUNTIME_INTERPRET_ARGUMENT_VALUE_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
@@ -33,7 +33,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
// ************************************************************************** //
// ************** runtime::interpret_argument_value ************** //
@@ -45,11 +45,11 @@ template<typename T>
struct interpret_argument_value_impl {
static bool _( cstring source, boost::optional<T>& res )
{
- BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<" << typeid(T).name() << ">" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<" << typeid(T).name() << ">" );
res = lexical_cast<T>( source );
- BOOST_RT_PARAM_TRACE( "String " << source << " is interpreted as " << *res );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "String " << source << " is interpreted as " << *res );
return true;
}
};
@@ -62,7 +62,7 @@ template<>
struct interpret_argument_value_impl<dstring> {
static bool _( cstring source, boost::optional<dstring>& res )
{
- BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<dstring>" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<dstring>" );
res = dstring();
assign_op( *res, source, 0 );
@@ -78,7 +78,7 @@ template<>
struct interpret_argument_value_impl<cstring> {
static bool _( cstring source, boost::optional<cstring>& res )
{
- BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<cstring>" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<cstring>" );
res = source;
@@ -93,14 +93,14 @@ template<>
struct interpret_argument_value_impl<bool> {
static bool _( cstring source, boost::optional<bool>& res )
{
- BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<bool>" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<bool>" );
- static literal_cstring YES( BOOST_RT_PARAM_CSTRING_LITERAL( "YES" ) );
- static literal_cstring Y( BOOST_RT_PARAM_CSTRING_LITERAL( "Y" ) );
- static literal_cstring NO( BOOST_RT_PARAM_CSTRING_LITERAL( "NO" ) );
- static literal_cstring N( BOOST_RT_PARAM_CSTRING_LITERAL( "N" ) );
- static literal_cstring one( BOOST_RT_PARAM_CSTRING_LITERAL( "1" ) );
- static literal_cstring zero( BOOST_RT_PARAM_CSTRING_LITERAL( "0" ) );
+ static literal_cstring YES( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "YES" ) );
+ static literal_cstring Y( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "Y" ) );
+ static literal_cstring NO( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "NO" ) );
+ static literal_cstring N( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "N" ) );
+ static literal_cstring one( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "1" ) );
+ static literal_cstring zero( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "0" ) );
source.trim();
@@ -114,7 +114,7 @@ struct interpret_argument_value_impl<bool> {
}
else {
res = true;
- return false;
+ return source.is_empty();
}
}
};
@@ -135,13 +135,13 @@ template<typename T>
inline bool
interpret_argument_value( cstring source, boost::optional<std::list<T> >& res, int )
{
- BOOST_RT_PARAM_TRACE( "In interpret_argument_value<std::list<T>>" );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value<std::list<T>>" );
res = std::list<T>();
while( !source.is_empty() ) {
// !! should we use token_iterator
- cstring::iterator single_value_end = std::find( source.begin(), source.end(), BOOST_RT_PARAM_LITERAL( ',' ) );
+ cstring::iterator single_value_end = std::find( source.begin(), source.end(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ',' ) );
boost::optional<T> value;
interpret_argument_value( cstring( source.begin(), single_value_end ), value, 0 );
@@ -156,8 +156,8 @@ interpret_argument_value( cstring source, boost::optional<std::list<T> >& res, i
//____________________________________________________________________________//
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_INTERPRET_ARGUMENT_VALUE_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_INTERPRET_ARGUMENT_VALUE_HPP
diff --git a/boost/test/utils/runtime/parameter.hpp b/boost/test/utils/runtime/parameter.hpp
index b914a9b4e5..2dd4ba725c 100644
--- a/boost/test/utils/runtime/parameter.hpp
+++ b/boost/test/utils/runtime/parameter.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,15 +12,15 @@
// Description : abstract interface for the formal parameter
// ***************************************************************************
-#ifndef BOOST_RT_PARAMETER_HPP_062604GER
-#define BOOST_RT_PARAMETER_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP
+#define BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
// ************************************************************************** //
// ************** runtime::parameter ************** //
@@ -31,8 +31,8 @@ public:
virtual ~parameter() {}
};
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_PARAMETER_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP
diff --git a/boost/test/utils/runtime/trace.hpp b/boost/test/utils/runtime/trace.hpp
index 5c4e2a7c05..17a169b283 100644
--- a/boost/test/utils/runtime/trace.hpp
+++ b/boost/test/utils/runtime/trace.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,19 +12,19 @@
// Description : optional internal tracing
// ***************************************************************************
-#ifndef BOOST_RT_TRACE_HPP_062604GER
-#define BOOST_RT_TRACE_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_TRACE_HPP
+#define BOOST_TEST_UTILS_RUNTIME_TRACE_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
-#ifdef BOOST_RT_PARAM_DEBUG
+#ifdef BOOST_TEST_UTILS_RUNTIME_PARAM_DEBUG
#include <iostream>
-# define BOOST_RT_PARAM_TRACE( str ) std::cerr << str << std::endl
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( str ) std::cerr << str << std::endl
#else
-# define BOOST_RT_PARAM_TRACE( str )
+# define BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( str )
#endif
-#endif // BOOST_RT_TRACE_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_TRACE_HPP
diff --git a/boost/test/utils/runtime/validation.hpp b/boost/test/utils/runtime/validation.hpp
index bcfbc9f062..54163dc6a6 100644
--- a/boost/test/utils/runtime/validation.hpp
+++ b/boost/test/utils/runtime/validation.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,33 +12,34 @@
// Description : defines exceptions and validation tools
// ***************************************************************************
-#ifndef BOOST_RT_VALIDATION_HPP_062604GER
-#define BOOST_RT_VALIDATION_HPP_062604GER
+#ifndef BOOST_TEST_UTILS_RUNTIME_VALIDATION_HPP
+#define BOOST_TEST_UTILS_RUNTIME_VALIDATION_HPP
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
// Boost.Test
#include <boost/test/utils/class_properties.hpp>
+#include <boost/test/detail/throw_exception.hpp>
// Boost
#include <boost/shared_ptr.hpp>
// STL
-#ifdef BOOST_RT_PARAM_EXCEPTION_INHERIT_STD
+#ifdef BOOST_TEST_UTILS_RUNTIME_PARAM_EXCEPTION_INHERIT_STD
#include <stdexcept>
#endif
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
// ************************************************************************** //
// ************** runtime::logic_error ************** //
// ************************************************************************** //
-class logic_error
-#ifdef BOOST_RT_PARAM_EXCEPTION_INHERIT_STD
+class logic_error
+#ifdef BOOST_TEST_UTILS_RUNTIME_PARAM_EXCEPTION_INHERIT_STD
: public std::exception
#endif
{
@@ -46,10 +47,12 @@ class logic_error
public:
// Constructor // !! could we eliminate shared_ptr
explicit logic_error( cstring msg ) : m_msg( new dstring( msg.begin(), msg.size() ) ) {}
- ~logic_error() throw() {}
+ ~logic_error() BOOST_NOEXCEPT_OR_NOTHROW
+ {}
dstring const& msg() const { return *m_msg; }
- virtual char_type const* what() const throw() { return m_msg->c_str(); }
+ virtual char_type const* what() const BOOST_NOEXCEPT_OR_NOTHROW
+ { return m_msg->c_str(); }
private:
dstring_ptr m_msg;
@@ -62,21 +65,21 @@ private:
inline void
report_logic_error( format_stream& msg )
{
- throw BOOST_RT_PARAM_NAMESPACE::logic_error( msg.str() );
+ BOOST_TEST_IMPL_THROW( BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() ) );
}
//____________________________________________________________________________//
-#define BOOST_RT_PARAM_REPORT_LOGIC_ERROR( msg ) \
- boost::BOOST_RT_PARAM_NAMESPACE::report_logic_error( format_stream().ref() << msg )
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_REPORT_LOGIC_ERROR( msg ) \
+ boost::BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::report_logic_error( format_stream().ref() << msg )
-#define BOOST_RT_PARAM_VALIDATE_LOGIC( b, msg ) \
- if( b ) {} else BOOST_RT_PARAM_REPORT_LOGIC_ERROR( msg )
+#define BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( b, msg ) \
+ if( b ) {} else BOOST_TEST_UTILS_RUNTIME_PARAM_REPORT_LOGIC_ERROR( msg )
//____________________________________________________________________________//
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost
-#endif // BOOST_RT_VALIDATION_HPP_062604GER
+#endif // BOOST_TEST_UTILS_RUNTIME_VALIDATION_HPP
diff --git a/boost/test/utils/setcolor.hpp b/boost/test/utils/setcolor.hpp
new file mode 100644
index 0000000000..f47ec84d8d
--- /dev/null
+++ b/boost/test/utils/setcolor.hpp
@@ -0,0 +1,117 @@
+// (C) Copyright Gennadiy Rozental 2009-2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile$
+//
+// Version : $Revision$
+//
+// Description : contains definition for setcolor iostream manipulator
+// ***************************************************************************
+
+#ifndef BOOST_TEST_UTILS_SETCOLOR_HPP
+#define BOOST_TEST_UTILS_SETCOLOR_HPP
+
+// Boost.Test
+#include <boost/test/detail/config.hpp>
+
+// STL
+#include <iostream>
+#include <cstdio>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+namespace unit_test {
+
+// ************************************************************************** //
+// ************** term_attr ************** //
+// ************************************************************************** //
+
+struct term_attr { enum _ {
+ NORMAL = 0,
+ BRIGHT = 1,
+ DIM = 2,
+ UNDERLINE = 4,
+ BLINK = 5,
+ REVERSE = 7,
+ CROSSOUT = 9
+}; };
+
+// ************************************************************************** //
+// ************** term_color ************** //
+// ************************************************************************** //
+
+struct term_color { enum _ {
+ BLACK = 0,
+ RED = 1,
+ GREEN = 2,
+ YELLOW = 3,
+ BLUE = 4,
+ MAGENTA = 5,
+ CYAN = 6,
+ WHITE = 7,
+ ORIGINAL = 9
+}; };
+
+// ************************************************************************** //
+// ************** setcolor ************** //
+// ************************************************************************** //
+
+class setcolor {
+public:
+ // Constructor
+ explicit setcolor( term_attr::_ attr = term_attr::NORMAL,
+ term_color::_ fg = term_color::ORIGINAL,
+ term_color::_ bg = term_color::ORIGINAL )
+ {
+ m_command_size = std::sprintf( m_control_command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40 );
+ }
+
+ friend std::ostream&
+ operator<<( std::ostream& os, setcolor const& sc )
+ {
+ return os.write( sc.m_control_command, sc.m_command_size );
+ }
+
+private:
+ // Data members
+ char m_control_command[13];
+ int m_command_size;
+};
+
+// ************************************************************************** //
+// ************** scope_setcolor ************** //
+// ************************************************************************** //
+
+struct scope_setcolor {
+ scope_setcolor() : m_os( 0 ) {}
+ explicit scope_setcolor( std::ostream& os,
+ term_attr::_ attr = term_attr::NORMAL,
+ term_color::_ fg = term_color::ORIGINAL,
+ term_color::_ bg = term_color::ORIGINAL )
+ : m_os( &os )
+ {
+ os << setcolor( attr, fg, bg );
+ }
+ ~scope_setcolor()
+ {
+ if( m_os )
+ *m_os << setcolor();
+ }
+private:
+ // Data members
+ std::ostream* m_os;
+};
+
+} // namespace unit_test
+} // namespace boost
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+#endif // BOOST_TEST_UTILS_SETCOLOR_HPP
diff --git a/boost/test/utils/trivial_singleton.hpp b/boost/test/utils/trivial_singleton.hpp
index 61cca97e00..818bad73ea 100644
--- a/boost/test/utils/trivial_singleton.hpp
+++ b/boost/test/utils/trivial_singleton.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -12,20 +12,19 @@
// Description : simple helpers for creating cusom output manipulators
// ***************************************************************************
-#ifndef BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER
-#define BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER
+#ifndef BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP
+#define BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP
+// Boost.Test
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
-#include <boost/noncopyable.hpp>
-
+// Boost
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -33,15 +32,19 @@ namespace unit_test {
// ************************************************************************** //
template<typename Derived>
-class singleton : private boost::noncopyable {
+class singleton {
public:
- static Derived& instance() { static Derived the_inst; return the_inst; }
+ static Derived& instance() { static Derived the_inst; return the_inst; }
+
+ BOOST_DELETED_FUNCTION(singleton(singleton const&))
+ BOOST_DELETED_FUNCTION(singleton& operator=(singleton const&))
+
protected:
- singleton() {}
- ~singleton() {}
+ BOOST_DEFAULTED_FUNCTION(singleton(), {})
+ BOOST_DEFAULTED_FUNCTION(~singleton(), {})
};
-} // namespace unit_test
+//____________________________________________________________________________//
#define BOOST_TEST_SINGLETON_CONS( type ) \
friend class boost::unit_test::singleton<type>; \
@@ -65,10 +68,12 @@ namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); }
#endif
+//____________________________________________________________________________//
+
+} // namespace unit_test
} // namespace boost
-//____________________________________________________________________________//
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER
+#endif // BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP
diff --git a/boost/test/utils/wrap_stringstream.hpp b/boost/test/utils/wrap_stringstream.hpp
index d1122c8ca8..e42adbd3ad 100644
--- a/boost/test/utils/wrap_stringstream.hpp
+++ b/boost/test/utils/wrap_stringstream.hpp
@@ -1,6 +1,6 @@
-// (C) Copyright Gennadiy Rozental 2002-2008.
+// (C) Copyright Gennadiy Rozental 2002-2014.
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
@@ -13,8 +13,8 @@
// to provide the unified interface
// ***************************************************************************
-#ifndef BOOST_WRAP_STRINGSTREAM_HPP_071894GER
-#define BOOST_WRAP_STRINGSTREAM_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP
+#define BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP
// Boost.Test
#include <boost/test/detail/config.hpp>
@@ -81,7 +81,7 @@ basic_wrap_stringstream<CharT>::stream()
template <typename CharT>
inline basic_wrap_stringstream<CharT>&
basic_wrap_stringstream<CharT>::ref()
-{
+{
return *this;
}
@@ -114,7 +114,7 @@ operator<<( basic_wrap_stringstream<CharT>& targ, basic_wrap_stringstream<CharT>
//____________________________________________________________________________//
-#if BOOST_TEST_USE_STD_LOCALE
+#if BOOST_TEST_USE_STD_LOCALE
template <typename CharT>
inline basic_wrap_stringstream<CharT>&
@@ -157,8 +157,6 @@ typedef basic_wrap_stringstream<wchar_t> wrap_wstringstream;
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_WRAP_STRINGSTREAM_HPP_071894GER
+#endif // BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP
diff --git a/boost/test/utils/xml_printer.hpp b/boost/test/utils/xml_printer.hpp
index ae73cce105..8552a173f9 100644
--- a/boost/test/utils/xml_printer.hpp
+++ b/boost/test/utils/xml_printer.hpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2004-2008.
+// (C) Copyright Gennadiy Rozental 2004-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -9,11 +9,11 @@
//
// Version : $Revision$
//
-// Description : common code used by any agent serving as XML printer
+// Description : common code used by any agent serving as OF_XML printer
// ***************************************************************************
-#ifndef BOOST_TEST_XML_PRINTER_HPP_071894GER
-#define BOOST_TEST_XML_PRINTER_HPP_071894GER
+#ifndef BOOST_TEST_UTILS_XML_PRINTER_HPP
+#define BOOST_TEST_UTILS_XML_PRINTER_HPP
// Boost.Test
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
@@ -33,7 +33,6 @@
//____________________________________________________________________________//
namespace boost {
-
namespace unit_test {
// ************************************************************************** //
@@ -82,6 +81,22 @@ print_escaped( std::ostream& where_to, T const& value )
//____________________________________________________________________________//
+inline void
+print_escaped_cdata( std::ostream& where_to, const_string value )
+{
+ static const_string cdata_end( "]]>" );
+
+ const_string::size_type pos = value.find( cdata_end );
+ if( pos == const_string::npos )
+ where_to << value;
+ else {
+ where_to << value.substr( 0, pos+2 ) << cdata_end
+ << BOOST_TEST_L( "<![CDATA[" ) << value.substr( pos+2 );
+ }
+}
+
+//____________________________________________________________________________//
+
typedef custom_manip<struct attr_value_t> attr_value;
template<typename T>
@@ -102,17 +117,16 @@ typedef custom_manip<struct cdata_t> cdata;
inline std::ostream&
operator<<( custom_printer<cdata> const& p, const_string value )
{
- return *p << BOOST_TEST_L( "<![CDATA[" ) << value << BOOST_TEST_L( "]]>" );
+ *p << BOOST_TEST_L( "<![CDATA[" );
+ print_escaped_cdata( *p, value );
+ return *p << BOOST_TEST_L( "]]>" );
}
//____________________________________________________________________________//
} // namespace unit_test
-
} // namespace boost
-//____________________________________________________________________________//
-
#include <boost/test/detail/enable_warnings.hpp>
-#endif // BOOST_TEST_XML_PRINTER_HPP_071894GER
+#endif // BOOST_TEST_UTILS_XML_PRINTER_HPP