update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -15,10 +15,16 @@
// STL
#include <utility>
#include <algorithm> // std::find
#include <functional> // std::bind1st
#include <functional> // std::bind1st or std::bind
#include <boost/test/detail/suppress_warnings.hpp>
#ifdef BOOST_NO_CXX98_BINDERS
#define BOOST_TEST_BIND1ST(F,A) std::bind( (F), (A), std::placeholders::_1 )
#else
#define BOOST_TEST_BIND1ST(F,A) std::bind1st( (F), (A) )
#endif
//____________________________________________________________________________//
namespace boost {
@@ -109,7 +115,7 @@ find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
Predicate pred )
{
while( first1 != last1 ) {
if( std::find_if( first2, last2, std::bind1st( pred, *first1 ) ) == last2 )
if( std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *first1 ) ) == last2 )
break;
++first1;
}
@@ -159,9 +165,9 @@ find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
return last1;
BidirectionalIterator1 it1 = last1;
while( --it1 != first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ) {}
while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ) {}
return it1 == first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ? last1 : it1;
return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1;
}
//____________________________________________________________________________//
@@ -206,9 +212,9 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
return last1;
BidirectionalIterator1 it1 = last1;
while( --it1 != first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) != last2 ) {}
while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) != last2 ) {}
return it1 == first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ? last1 : it1;
return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1;
}
//____________________________________________________________________________//

View File

@@ -39,12 +39,12 @@ namespace unit_test {
// ************************************************************************** //
template<typename CharT>
class basic_cstring {
class BOOST_SYMBOL_VISIBLE basic_cstring {
typedef basic_cstring<CharT> self_type;
public:
// Subtypes
typedef ut_detail::bcs_char_traits<CharT> traits_type;
typedef typename ut_detail::bcs_char_traits<CharT>::std_string std_string;
typedef typename traits_type::std_string std_string;
typedef CharT value_type;
typedef typename remove_cv<value_type>::type value_ret_type;
@@ -60,8 +60,8 @@ public:
// !! should also present reverse_iterator, const_reverse_iterator
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
enum npos_type { npos = static_cast<size_type>(-1) };
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) && !defined(__DCC__)
BOOST_STATIC_CONSTANT(size_type, npos = static_cast<size_type>(-1));
#else
// IBM/VisualAge version 6 is not able to handle enums larger than 4 bytes.
// But size_type is 8 bytes in 64bit mode.
@@ -72,6 +72,7 @@ public:
// Constructors; default copy constructor is generated by compiler
basic_cstring();
basic_cstring( basic_cstring const & );
basic_cstring( std_string const& s );
basic_cstring( pointer s );
template<typename LenType>
@@ -162,15 +163,20 @@ private:
// Data members
iterator m_begin;
iterator m_end;
static CharT null;
};
//____________________________________________________________________________//
template<typename CharT>
CharT basic_cstring<CharT>::null = 0;
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::pointer
basic_cstring<CharT>::null_str()
{
static CharT null = 0;
return &null;
}
@@ -186,6 +192,16 @@ basic_cstring<CharT>::basic_cstring()
//____________________________________________________________________________//
template<typename CharT>
inline
basic_cstring<CharT>::basic_cstring(basic_cstring const & s)
: m_begin( s.m_begin )
, m_end( s.m_end )
{
}
//____________________________________________________________________________//
template<typename CharT>
inline
basic_cstring<CharT>::basic_cstring( std_string const& s )

View File

@@ -16,13 +16,13 @@
#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP
#define BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP
#include <boost/detail/workaround.hpp>
#include <boost/test/detail/config.hpp>
namespace boost {
namespace unit_test {
template<typename CharT> class basic_cstring;
template<typename CharT> class BOOST_SYMBOL_VISIBLE basic_cstring;
typedef basic_cstring<char const> const_string;
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590041))
typedef const_string literal_string;
@@ -37,4 +37,3 @@ typedef char const* const c_literal_string;
} // namespace boost
#endif // BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP

View File

@@ -76,9 +76,13 @@ case_ins_eq( basic_cstring<CharT> x, basic_cstring<CharT> y )
// ************************************************************************** //
template<class CharT>
class case_ins_less : public std::binary_function<basic_cstring<CharT>,basic_cstring<CharT>,bool>
class case_ins_less
{
public:
typedef bool result_type;
typedef basic_cstring<CharT> first_argument_type;
typedef basic_cstring<CharT> second_argument_type;
bool operator()( basic_cstring<CharT> x, basic_cstring<CharT> y ) const
{
return x.size() != y.size()

View File

@@ -26,7 +26,6 @@
// Boost
#include <boost/type.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/test/detail/workaround.hpp>
#include <boost/type_traits/is_const.hpp>

View File

@@ -23,6 +23,7 @@
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp>
#include <string>
//____________________________________________________________________________//
@@ -51,19 +52,36 @@ struct is_cstring_impl<char*> : public mpl::true_ {};
template<>
struct is_cstring_impl<wchar_t*> : public mpl::true_ {};
template <typename T, bool is_cstring = is_cstring_impl<typename boost::decay<T>::type>::value >
struct deduce_cstring_impl;
template <typename T, bool is_cstring >
struct deduce_cstring_impl<T&, is_cstring> : public deduce_cstring_impl<T, is_cstring>{};
template <typename T, bool is_cstring >
struct deduce_cstring_impl<T const, is_cstring> : public deduce_cstring_impl<T, is_cstring>{};
template <typename T>
struct deduce_cstring_impl {
struct deduce_cstring_impl<T, true> {
typedef typename boost::add_const<
typename boost::remove_pointer<
typename boost::decay<T>::type
>::type
>::type type;
>::type U;
typedef boost::unit_test::basic_cstring<U> type;
};
template <typename T>
struct deduce_cstring_impl< std::basic_string<T, std::char_traits<T> > > {
// const is required here
typedef typename boost::add_const<T>::type type;
struct deduce_cstring_impl< T, false > {
typedef typename
boost::remove_const<
typename boost::remove_reference<T>::type
>::type type;
};
template <typename T>
struct deduce_cstring_impl< std::basic_string<T, std::char_traits<T> >, false > {
typedef boost::unit_test::basic_cstring<typename boost::add_const<T>::type> type;
};
} // namespace ut_detail
@@ -71,8 +89,17 @@ struct deduce_cstring_impl< std::basic_string<T, std::char_traits<T> > > {
template<typename T>
struct is_cstring : public ut_detail::is_cstring_impl<typename decay<T>::type> {};
template<typename T, bool is_cstring = is_cstring<typename boost::decay<T>::type>::value >
struct is_cstring_comparable: public mpl::false_ {};
template<typename T>
struct is_cstring< std::basic_string<T, std::char_traits<T> > > : public mpl::true_ {};
struct is_cstring_comparable< T, true > : public mpl::true_ {};
template<typename T>
struct is_cstring_comparable< std::basic_string<T, std::char_traits<T> >, false > : public mpl::true_ {};
template<typename T>
struct is_cstring_comparable< boost::unit_test::basic_cstring<T>, false > : public mpl::true_ {};
template <class T>
struct deduce_cstring {
@@ -80,7 +107,7 @@ struct deduce_cstring {
boost::remove_const<
typename boost::remove_reference<T>::type
>::type U;
typedef typename ut_detail::deduce_cstring_impl<U>::type type;
typedef typename ut_detail::deduce_cstring_impl<typename boost::decay<U>::type>::type type;
};
} // namespace unit_test

View File

@@ -16,8 +16,8 @@
defined(BOOST_NO_CXX11_NULLPTR) || \
defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES)
// some issues with boost.config
#if !defined(BOOST_MSVC) || BOOST_MSVC_FULL_VER < 170061030 /* VC2012 upd 5 */
// this feature works with VC2012 upd 5 while BOOST_NO_CXX11_TRAILING_RESULT_TYPES is defined
#if !defined(BOOST_MSVC) || BOOST_MSVC_FULL_VER < 170061232 /* VC2012 upd 5 */
#define BOOST_TEST_FWD_ITERABLE_CXX03
#endif
#endif
@@ -35,6 +35,7 @@
#else
// Boost
#include <boost/static_assert.hpp>
#include <boost/utility/declval.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_reference.hpp>
@@ -51,6 +52,9 @@
namespace boost {
namespace unit_test {
template<typename T>
struct is_forward_iterable;
// ************************************************************************** //
// ************** is_forward_iterable ************** //
// ************************************************************************** //
@@ -65,6 +69,9 @@ 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, std::size_t N>
struct is_forward_iterable< T [N] > : public mpl::true_ {};
template<typename T, typename A>
struct is_forward_iterable< std::vector<T, A> > : public mpl::true_ {};
@@ -86,6 +93,7 @@ struct is_forward_iterable< std::string > : public mpl::true_ {};
namespace ut_detail {
// SFINAE helper
template<typename T>
struct is_present : public mpl::true_ {};
@@ -110,7 +118,7 @@ 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 U> static auto test( U* ) -> decltype(std::begin(boost::declval<U&>())); // does not work with boost::begin
template<typename> static nil_t test( ... );
public:
static bool const value = !std::is_same< decltype(test<T>( nullptr )), nil_t>::value;
@@ -122,7 +130,7 @@ 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 U> static auto test( U* ) -> decltype(std::end(boost::declval<U&>())); // does not work with boost::end
template<typename> static nil_t test( ... );
public:
static bool const value = !std::is_same< decltype(test<T>( nullptr )), nil_t>::value;
@@ -134,24 +142,36 @@ 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
has_member_begin<T>::value &&
has_member_end<T>::value
>::type
> : std::true_type
{};
//____________________________________________________________________________//
template <class T, class enabled = void>
struct is_container_forward_iterable_impl : std::false_type {
};
template <class T>
struct is_container_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 &&
is_forward_iterable_impl<T>::value
>::type
> : is_forward_iterable_impl<T>
{};
//____________________________________________________________________________//
} // namespace ut_detail
/*! Indicates that a specific type implements the forward iterable concept. */
@@ -163,8 +183,84 @@ struct is_forward_iterable {
enum { value = is_fwd_it_t::value };
};
/*! Indicates that a specific type implements the forward iterable concept. */
template<typename T>
struct is_container_forward_iterable {
typedef typename std::remove_reference<T>::type T_ref;
typedef ut_detail::is_container_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) */
//! Helper structure for accessing the content of a container or an array
template <typename T, bool is_forward_iterable = is_forward_iterable<T>::value >
struct bt_iterator_traits;
template <typename T>
struct bt_iterator_traits< T, true >{
BOOST_STATIC_ASSERT((is_forward_iterable<T>::value));
#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \
(defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061232))
typedef typename T::const_iterator const_iterator;
typedef typename std::iterator_traits<const_iterator>::value_type value_type;
#else
typedef decltype(boost::declval<
typename boost::add_const<
typename boost::remove_reference<T>::type
>::type>().begin()) const_iterator;
typedef typename std::iterator_traits<const_iterator>::value_type value_type;
#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */
static const_iterator begin(T const& container) {
return container.begin();
}
static const_iterator end(T const& container) {
return container.end();
}
#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \
(defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061232))
static std::size_t
size(T const& container) {
return container.size();
}
#else
static std::size_t
size(T const& container) {
return size(container,
std::integral_constant<bool, ut_detail::has_member_size<T>::value>());
}
private:
static std::size_t
size(T const& container, std::true_type) { return container.size(); }
static std::size_t
size(T const& container, std::false_type) { return std::distance(begin(container), end(container)); }
#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */
};
template <typename T, std::size_t N>
struct bt_iterator_traits< T [N], true > {
typedef typename boost::add_const<T>::type T_const;
typedef typename boost::add_pointer<T_const>::type const_iterator;
typedef T value_type;
static const_iterator begin(T_const (&array)[N]) {
return &array[0];
}
static const_iterator end(T_const (&array)[N]) {
return &array[N];
}
static std::size_t size(T_const (&)[N]) {
return N;
}
};
} // namespace unit_test
} // namespace boost

View File

@@ -28,11 +28,11 @@
namespace boost {
namespace unit_test {
class lazy_ostream {
class BOOST_TEST_DECL lazy_ostream {
public:
virtual ~lazy_ostream() {}
static lazy_ostream& instance() { static lazy_ostream inst; return inst; }
static lazy_ostream& instance() { return inst; }
friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); }
@@ -47,6 +47,7 @@ protected:
private:
// Data members
bool m_empty;
static lazy_ostream inst;
};
//____________________________________________________________________________//

View File

@@ -72,7 +72,7 @@ struct is_named_param_pack<named_parameter_combine<NP,Rest> > : public mpl::true
// ************** param_type ************** //
// ************************************************************************** //
/// param_type<Params,Keyword,Default>::type is is the type of the parameter
/// param_type<Params,Keyword,Default>::type is the type of the parameter
/// corresponding to the Keyword (if parameter is present) or Default
template<typename NP, typename Keyword, typename DefaultType=void>
@@ -91,7 +91,7 @@ struct param_type<named_parameter_combine<NP,Rest>,Keyword,DefaultType>
// ************** has_param ************** //
// ************************************************************************** //
/// has_param<Params,Keyword>::value is true id Params has parameter corresponding
/// has_param<Params,Keyword>::value is true if Params has parameter corresponding
/// to the Keyword
template<typename NP, typename Keyword>

View File

@@ -17,6 +17,7 @@
// C Runtime
#include <cstddef>
#include <boost/test/detail/config.hpp>
namespace boost {
namespace rtti {
@@ -30,7 +31,7 @@ typedef std::ptrdiff_t id_t;
namespace rtti_detail {
template<typename T>
struct rttid_holder {
struct BOOST_TEST_DECL rttid_holder {
static id_t id() { return reinterpret_cast<id_t>( &inst() ); }
private:
@@ -44,7 +45,7 @@ private:
//____________________________________________________________________________//
template<typename T>
inline id_t
BOOST_TEST_DECL inline id_t
type_id()
{
return rtti_detail::rttid_holder<T>::id();

View File

@@ -18,6 +18,7 @@
// Boost.Test Runtime parameters
#include <boost/test/utils/runtime/errors.hpp>
#include <boost/test/utils/runtime/argument.hpp>
#include <boost/test/utils/runtime/modifier.hpp>
// Boost.Test
#include <boost/test/utils/basic_cstring/io.hpp>

View File

@@ -17,6 +17,7 @@
// Boost.Test Runtime parameters
#include <boost/test/utils/runtime/fwd.hpp>
#include <cstring>
#include <boost/test/detail/suppress_warnings.hpp>

View File

@@ -109,12 +109,12 @@ struct parameter_trie {
// ************** runtime::cla::report_foreing_token ************** //
// ************************************************************************** //
static void
static void
report_foreing_token( cstring program_name, cstring token )
{
std::cerr << "Boost.Test WARNING: token \"" << token << "\" does not correspond to the Boost.Test argument \n"
<< " and should be placed after all Boost.Test arguments and the -- separator.\n"
<< " For example: " << program_name << " --random -- " << token << "\n";
<< " For example: " << program_name << " --random -- " << token << "\n";
}
} // namespace rt_cla_detail
@@ -203,7 +203,7 @@ public:
if( negative_form ) {
BOOST_TEST_I_ASSRT( found_id.m_negatable,
format_error( found_param->p_name )
format_error( found_param->p_name )
<< "Parameter tag " << found_id.m_tag << " is not negatable." );
curr_token.trim_left( m_negation_prefix.size() );
@@ -211,13 +211,18 @@ public:
curr_token.trim_left( name.size() );
bool should_go_to_next = true;
cstring value;
// Skip validations if parameter has optional value and we are at the end of token
if( !value_separator.is_empty() || !found_param->p_has_optional_value ) {
// we are given a separator or there is no optional value
// Validate and skip value separator in the input
BOOST_TEST_I_ASSRT( found_id.m_value_separator == value_separator,
format_error( found_param->p_name )
format_error( found_param->p_name )
<< "Invalid separator for the parameter "
<< found_param->p_name
<< " in the argument " << tr.current_token() );
@@ -237,6 +242,40 @@ public:
<< found_param->p_name
<< " in the argument " << tr.current_token() );
}
else if( (value_separator.is_empty() && found_id.m_value_separator.empty()) ) {
// Deduce value source
value = curr_token;
if( value.is_empty() ) {
tr.next_token(); // tokenization broke the value, we check the next one
if(!found_param->p_has_optional_value) {
// there is no separator and there is no optional value
// we look for the value on the next token
// example "-t XXXX" (no default)
// and we commit this value as being the passed value
value = tr.current_token();
}
else {
// there is no separator and the value is optional
// we check the next token
// example "-c" (defaults to true)
// and commit this as the value if this is not a token
cstring value_check = tr.current_token();
cstring prefix_test, name_test, value_separator_test;
bool negative_form_test;
if( validate_token_format( value_check, prefix_test, name_test, value_separator_test, negative_form_test )
&& m_param_trie[prefix_test]) {
// this is a token, we consume what we have
should_go_to_next = false;
}
else {
// this is a value, we commit it
value = value_check;
}
}
}
}
// Validate against argument duplication
BOOST_TEST_I_ASSRT( !res.has( found_param->p_name ) || found_param->p_repeatable,
@@ -248,7 +287,9 @@ public:
// Produce argument value
found_param->produce_argument( value, negative_form, res );
tr.next_token();
if(should_go_to_next) {
tr.next_token();
}
}
// generate the remainder and return it's size
@@ -273,7 +314,7 @@ public:
<< BOOST_VERSION % 100 ;
ostr << " with ";
#if defined(BOOST_TEST_INCLUDED)
ostr << "single header inclusion of";
ostr << "header-only inclusion of";
#elif defined(BOOST_TEST_DYN_LINK)
ostr << "dynamic linking to";
#else
@@ -287,57 +328,119 @@ public:
}
void
usage( std::ostream& ostr, cstring param_name = cstring() )
usage(std::ostream& ostr,
cstring param_name = cstring(),
bool use_color = true)
{
namespace utils = unit_test::utils;
namespace ut_detail = unit_test::ut_detail;
if( !param_name.is_empty() ) {
basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second;
param->usage( ostr, m_negation_prefix );
}
else {
ostr << "Usage: " << m_program_name << " [Boost.Test argument]... ";
if( !m_end_of_param_indicator.empty() )
ostr << m_end_of_param_indicator << " [custom test module argument]...";
ostr << "\n";
ostr << "\n The program '" << m_program_name << "' is a Boost.Test module containing unit tests.";
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL );
ostr << "\n\n Usage\n ";
}
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN );
ostr << m_program_name << " [Boost.Test argument]... ";
}
if( !m_end_of_param_indicator.empty() ) {
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW );
ostr << '[' << m_end_of_param_indicator << " [custom test module argument]...]";
}
}
ostr << "\nFor detailed help on Boost.Test parameters use:\n"
<< " " << m_program_name << " --help\n"
<< "or\n"
<< " " << m_program_name << " --help=<parameter name>\n";
ostr << "\n\n Use\n ";
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN );
ostr << m_program_name << " --help";
}
ostr << "\n or ";
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN );
ostr << m_program_name << " --help=<parameter name>";
}
ostr << "\n for detailed help on Boost.Test parameters.\n";
}
void
help( std::ostream& ostr, parameters_store const& parameters, cstring param_name )
help(std::ostream& ostr,
parameters_store const& parameters,
cstring param_name,
bool use_color = true)
{
namespace utils = unit_test::utils;
namespace ut_detail = unit_test::ut_detail;
if( !param_name.is_empty() ) {
basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second;
param->help( ostr, m_negation_prefix );
param->help( ostr, m_negation_prefix, use_color);
return;
}
ostr << "Usage: " << m_program_name << " [Boost.Test argument]... ";
if( !m_end_of_param_indicator.empty() )
ostr << m_end_of_param_indicator << " [custom test module argument]...";
usage(ostr, cstring(), use_color);
ostr << "\n\nBoost.Test arguments correspond to parameters listed below. "
"All parameters are optional. You can use specify parameter value either "
"as a command line argument or as a value of corresponding environment "
"variable. In case if argument for the same parameter is specified in both "
"places, command line is taking precedence. Command line argument format "
"supports parameter name guessing, so you can use any unambiguous "
"prefix to identify a parameter.";
if( !m_end_of_param_indicator.empty() )
ostr << " All the arguments after the " << m_end_of_param_indicator << " are ignored by the Boost.Test.";
ostr << "\n\n";
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL );
ostr << " Command line flags:\n";
}
runtime::commandline_pretty_print(
ostr,
" ",
"The command line flags of Boost.Test are listed below. "
"All parameters are optional. You can specify parameter value either "
"as a command line argument or as a value of its corresponding environment "
"variable. If a flag is specified as a command line argument and an environment variable "
"at the same time, the command line takes precedence. "
"The command line argument "
"support name guessing, and works with shorter names as long as those are not ambiguous."
);
ostr << "\n\nBoost.Test supports following parameters:\n";
BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, parameters.all() ) {
basic_param_ptr param = v.second;
param->usage( ostr, m_negation_prefix );
if( !m_end_of_param_indicator.empty() ) {
ostr << "\n\n All the arguments after the '";
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW );
ostr << m_end_of_param_indicator;
}
ostr << "' are ignored by Boost.Test.";
}
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL );
ostr << "\n\n Environment variables:\n";
}
runtime::commandline_pretty_print(
ostr,
" ",
"Every argument listed below may also be set by a corresponding environment"
"variable. For an argument '--argument_x=<value>', the corresponding "
"environment variable is 'BOOST_TEST_ARGUMENT_X=value"
);
ostr << "\n\n The following parameters are supported:\n";
BOOST_TEST_FOREACH(
parameters_store::storage_type::value_type const&,
v,
parameters.all() )
{
basic_param_ptr param = v.second;
ostr << "\n";
param->usage( ostr, m_negation_prefix, use_color);
}
ostr << "\nUse --help=<parameter name> to display detailed help for specific parameter.\n";
}
private:

View File

@@ -37,7 +37,7 @@ namespace runtime {
// ************** runtime::param_error ************** //
// ************************************************************************** //
class param_error : public std::exception {
class BOOST_SYMBOL_VISIBLE param_error : public std::exception {
public:
~param_error() BOOST_NOEXCEPT_OR_NOTHROW {}
@@ -55,13 +55,13 @@ protected:
//____________________________________________________________________________//
class init_error : public param_error {
class BOOST_SYMBOL_VISIBLE init_error : public param_error {
protected:
explicit init_error( cstring param_name ) : param_error( param_name ) {}
~init_error() BOOST_NOEXCEPT_OR_NOTHROW {}
};
class input_error : public param_error {
class BOOST_SYMBOL_VISIBLE input_error : public param_error {
protected:
explicit input_error( cstring param_name ) : param_error( param_name ) {}
~input_error() BOOST_NOEXCEPT_OR_NOTHROW {}
@@ -70,7 +70,7 @@ protected:
//____________________________________________________________________________//
template<typename Derived, typename Base>
class specific_param_error : public Base {
class BOOST_SYMBOL_VISIBLE specific_param_error : public Base {
protected:
explicit specific_param_error( cstring param_name ) : Base( param_name ) {}
~specific_param_error() BOOST_NOEXCEPT_OR_NOTHROW {}
@@ -86,7 +86,7 @@ public:
{
this->msg.append( val );
return reinterpret_cast<Derived&&>(*this);
return static_cast<Derived&&>(*this);
}
//____________________________________________________________________________//
@@ -96,7 +96,7 @@ public:
{
this->msg.append( unit_test::utils::string_cast( val ) );
return reinterpret_cast<Derived&&>(*this);
return static_cast<Derived&&>(*this);
}
//____________________________________________________________________________//
@@ -133,7 +133,7 @@ public:
// ************************************************************************** //
#define SPECIFIC_EX_TYPE( type, base ) \
class type : public specific_param_error<type,base> { \
class BOOST_SYMBOL_VISIBLE type : public specific_param_error<type,base> { \
public: \
explicit type( cstring param_name = cstring() ) \
: specific_param_error<type,base>( param_name ) \
@@ -155,7 +155,7 @@ SPECIFIC_EX_TYPE( missing_req_arg, input_error );
#undef SPECIFIC_EX_TYPE
class ambiguous_param : public specific_param_error<ambiguous_param, input_error> {
class BOOST_SYMBOL_VISIBLE ambiguous_param : public specific_param_error<ambiguous_param, input_error> {
public:
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
explicit ambiguous_param( std::vector<cstring>&& amb_candidates )
@@ -171,7 +171,7 @@ public:
std::vector<cstring> m_amb_candidates;
};
class unrecognized_param : public specific_param_error<unrecognized_param, input_error> {
class BOOST_SYMBOL_VISIBLE unrecognized_param : public specific_param_error<unrecognized_param, input_error> {
public:
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
explicit unrecognized_param( std::vector<cstring>&& type_candidates )

View File

@@ -20,6 +20,7 @@
// Boost.Test
#include <boost/test/utils/named_params.hpp>
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/detail/suppress_warnings.hpp>

View File

@@ -24,9 +24,10 @@
// Boost.Test
#include <boost/test/utils/class_properties.hpp>
#include <boost/test/utils/foreach.hpp>
#include <boost/test/utils/setcolor.hpp>
// Boost
#include <boost/function/function2.hpp>
#include <boost/function.hpp>
#include <boost/algorithm/cxx11/all_of.hpp>
// STL
@@ -37,6 +38,40 @@
namespace boost {
namespace runtime {
inline
std::ostream& commandline_pretty_print(
std::ostream& ostr,
std::string const& prefix,
std::string const& to_print) {
const int split_at = 80;
std::string::size_type current = 0;
while(current < to_print.size()) {
// discards spaces at the beginning
std::string::size_type startpos = to_print.find_first_not_of(" \t\n", current);
current += startpos - current;
bool has_more_lines = (current + split_at) < to_print.size();
if(has_more_lines) {
std::string::size_type endpos = to_print.find_last_of(" \t\n", current + split_at);
std::string sub(to_print.substr(current, endpos - current));
ostr << prefix << sub;
ostr << "\n";
current += endpos - current;
}
else
{
ostr << prefix << to_print.substr(current, split_at);
current += split_at;
}
}
return ostr;
}
// ************************************************************************** //
// ************** runtime::parameter_cla_id ************** //
// ************************************************************************** //
@@ -142,23 +177,37 @@ public:
virtual void produce_default( arguments_store& store ) const = 0;
/// interfaces for help message reporting
virtual void usage( std::ostream& ostr, cstring negation_prefix_ )
virtual void usage( std::ostream& ostr, cstring negation_prefix_, bool use_color = true )
{
ostr << "Parameter: " << p_name << '\n';
if( !p_description.empty() )
ostr << ' ' << p_description << '\n';
namespace utils = unit_test::utils;
namespace ut_detail = unit_test::ut_detail;
//
ostr << " ";
{
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN );
ostr << p_name;
}
ostr << '\n';
if( !p_description.empty() ) {
commandline_pretty_print(ostr, " ", p_description) << '\n';
}
ostr << " Command line formats:\n";
BOOST_TEST_FOREACH( parameter_cla_id const&, id, cla_ids() ) {
if( id.m_prefix == help_prefix )
continue;
ostr << " " << id.m_prefix;
if( id.m_negatable )
cla_name_help( ostr, id.m_tag, negation_prefix_ );
else
cla_name_help( ostr, id.m_tag, "" );
ostr << " " << id.m_prefix;
if( id.m_negatable )
cla_name_help( ostr, id.m_tag, negation_prefix_, use_color );
else
cla_name_help( ostr, id.m_tag, "", use_color );
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW );
bool optional_value_ = false;
if( p_has_optional_value ) {
@@ -166,6 +215,7 @@ public:
ostr << '[';
}
if( id.m_value_separator.empty() )
ostr << ' ';
else {
@@ -179,16 +229,16 @@ public:
ostr << '\n';
}
if( !p_env_var.empty() )
ostr << " Environment variable: " << p_env_var << '\n';
}
virtual void help( std::ostream& ostr, cstring negation_prefix_ )
virtual void help( std::ostream& ostr, cstring negation_prefix_, bool use_color = true )
{
usage( ostr, negation_prefix_ );
usage( ostr, negation_prefix_, use_color );
if( !p_help.empty() )
ostr << '\n' << p_help << '\n';
if( !p_help.empty() ) {
ostr << '\n';
commandline_pretty_print(ostr, " ", p_help);
}
}
protected:
@@ -220,7 +270,7 @@ protected:
private:
/// interface for usage/help customization
virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring /* negation_prefix_ */) const
virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring /*negation_prefix_*/, bool /*use_color*/ = true) const
{
ostr << cla_tag;
}
@@ -337,12 +387,16 @@ private:
{
m_arg_factory.produce_default( p_name, store );
}
virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring negation_prefix_ ) const
virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring negation_prefix_, bool use_color = true ) const
{
if( negation_prefix_.is_empty() )
ostr << cla_tag;
else
ostr << '[' << negation_prefix_ << ']' << cla_tag;
namespace utils = unit_test::utils;
namespace ut_detail = unit_test::ut_detail;
if( !negation_prefix_.is_empty() ) {
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW );
ostr << '[' << negation_prefix_ << ']';
}
ostr << cla_tag;
}
virtual void value_help( std::ostream& ostr ) const
{

View File

@@ -18,12 +18,23 @@
// Boost.Test
#include <boost/test/detail/config.hpp>
#include <boost/core/ignore_unused.hpp>
// STL
#include <iostream>
#include <cstdio>
#include <boost/test/detail/suppress_warnings.hpp>
#ifdef _WIN32
#include <windows.h>
#if defined(__MINGW32__) && !defined(COMMON_LVB_UNDERSCORE)
// mingw badly mimicking windows.h
#define COMMON_LVB_UNDERSCORE 0x8000
#endif
#endif
//____________________________________________________________________________//
namespace boost {
@@ -64,57 +75,244 @@ struct term_color { enum _ {
// ************** setcolor ************** //
// ************************************************************************** //
#ifndef _WIN32
class setcolor {
public:
// Constructor
explicit setcolor( term_attr::_ attr = term_attr::NORMAL,
explicit setcolor( bool is_color_output = false,
term_attr::_ attr = term_attr::NORMAL,
term_color::_ fg = term_color::ORIGINAL,
term_color::_ bg = term_color::ORIGINAL )
: m_is_color_output(is_color_output)
{
m_command_size = std::sprintf( m_control_command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40 );
m_command_size = std::sprintf( m_control_command, "%c[%c;3%c;4%cm",
0x1B,
static_cast<char>(attr + '0'),
static_cast<char>(fg + '0'),
static_cast<char>(bg + '0'));
}
friend std::ostream&
operator<<( std::ostream& os, setcolor const& sc )
{
return os.write( sc.m_control_command, sc.m_command_size );
if (sc.m_is_color_output && (&os == &std::cout || &os == &std::cerr)) {
return os.write( sc.m_control_command, sc.m_command_size );
}
return os;
}
private:
// Data members
bool m_is_color_output;
char m_control_command[13];
int m_command_size;
};
#else
class setcolor {
protected:
void set_console_color(std::ostream& os, WORD *attributes = NULL) const {
if (!m_is_color_output) {
return;
}
DWORD console_type;
if (&os == &std::cout) {
console_type = STD_OUTPUT_HANDLE;
}
else if (&os == &std::cerr) {
console_type = STD_ERROR_HANDLE;
}
else {
return;
}
HANDLE hConsole = GetStdHandle(console_type);
if(hConsole == INVALID_HANDLE_VALUE || hConsole == NULL )
return;
if(attributes != NULL) {
SetConsoleTextAttribute(hConsole, *attributes);
return;
}
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
GetConsoleScreenBufferInfo(hConsole, &consoleInfo);
saved_attributes = consoleInfo.wAttributes;
WORD fg_attr = 0;
switch(m_fg)
{
case term_color::WHITE:
fg_attr = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
break;
case term_color::BLACK:
fg_attr = 0;
break;
case term_color::RED:
fg_attr = FOREGROUND_RED;
break;
case term_color::GREEN:
fg_attr = FOREGROUND_GREEN;
break;
case term_color::CYAN:
fg_attr = FOREGROUND_GREEN | FOREGROUND_BLUE;
break;
case term_color::MAGENTA:
fg_attr = FOREGROUND_RED | FOREGROUND_BLUE;
break;
case term_color::BLUE:
fg_attr = FOREGROUND_BLUE;
break;
case term_color::YELLOW:
fg_attr = FOREGROUND_RED | FOREGROUND_GREEN;
break;
case term_color::ORIGINAL:
default:
fg_attr = saved_attributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
break;
}
WORD bg_attr = 0;
switch(m_bg)
{
case term_color::BLACK:
bg_attr = 0;
break;
case term_color::WHITE:
bg_attr = BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE;
break;
case term_color::RED:
bg_attr = BACKGROUND_RED;
break;
case term_color::GREEN:
bg_attr = BACKGROUND_GREEN;
break;
case term_color::BLUE:
bg_attr = BACKGROUND_BLUE;
break;
case term_color::ORIGINAL:
default:
bg_attr = saved_attributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE);
break;
}
WORD text_attr = 0;
switch(m_attr)
{
case term_attr::BRIGHT:
text_attr = FOREGROUND_INTENSITY;
break;
case term_attr::UNDERLINE:
text_attr = COMMON_LVB_UNDERSCORE;
break;
default:
break;
}
SetConsoleTextAttribute(hConsole, fg_attr | bg_attr | text_attr);
return;
}
public:
// Constructor
explicit setcolor(
bool is_color_output = false,
term_attr::_ attr = term_attr::NORMAL,
term_color::_ fg = term_color::ORIGINAL,
term_color::_ bg = term_color::ORIGINAL )
: m_is_color_output(is_color_output)
, m_attr(attr)
, m_fg(fg)
, m_bg(bg)
{}
friend std::ostream&
operator<<( std::ostream& os, setcolor const& sc )
{
sc.set_console_color(os);
return os;
}
private:
bool m_is_color_output;
term_attr::_ m_attr;
term_color::_ m_fg;
term_color::_ m_bg;
protected:
// Data members
mutable WORD saved_attributes;
};
#endif
// ************************************************************************** //
// ************** scope_setcolor ************** //
// ************************************************************************** //
#ifndef _WIN32
struct scope_setcolor {
scope_setcolor() : m_os( 0 ) {}
explicit scope_setcolor( std::ostream& os,
explicit scope_setcolor( bool is_color_output,
std::ostream& os,
term_attr::_ attr = term_attr::NORMAL,
term_color::_ fg = term_color::ORIGINAL,
term_color::_ bg = term_color::ORIGINAL )
: m_os( &os )
, m_is_color_output( is_color_output )
{
os << setcolor( attr, fg, bg );
os << setcolor( is_color_output, attr, fg, bg );
}
~scope_setcolor()
{
if( m_os )
*m_os << setcolor();
*m_os << setcolor( m_is_color_output );
}
private:
scope_setcolor(const scope_setcolor& r);
scope_setcolor& operator=(const scope_setcolor& r);
// Data members
std::ostream* m_os;
bool m_is_color_output;
};
#define BOOST_TEST_SCOPE_SETCOLOR( is_color_output, os, attr, color ) \
utils::scope_setcolor const& sc = is_color_output \
? utils::scope_setcolor( os, utils::attr, utils::color ) \
: utils::scope_setcolor(); \
ut_detail::ignore_unused_variable_warning( sc ) \
#else
struct scope_setcolor : setcolor {
scope_setcolor() : m_os( 0 ) {}
explicit scope_setcolor(
bool is_color_output,
std::ostream& os,
term_attr::_ attr = term_attr::NORMAL,
term_color::_ fg = term_color::ORIGINAL,
term_color::_ bg = term_color::ORIGINAL )
: setcolor(is_color_output, attr, fg, bg)
, m_os( &os )
{
os << *this;
}
~scope_setcolor()
{
if (m_os) {
set_console_color(*m_os, &this->saved_attributes);
}
}
private:
scope_setcolor(const scope_setcolor& r);
scope_setcolor& operator=(const scope_setcolor& r);
// Data members
std::ostream* m_os;
};
#endif
#define BOOST_TEST_SCOPE_SETCOLOR( is_color_output, os, attr, color ) \
utils::scope_setcolor const sc(is_color_output, os, utils::attr, utils::color); \
boost::ignore_unused( sc ) \
/**/
} // namespace utils

View File

@@ -0,0 +1,164 @@
// (C) Copyright Raffi Enficiaud 2019.
// 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.
//
// Description : timer and elapsed types
// ***************************************************************************
#ifndef BOOST_TEST_UTILS_TIMER_HPP
#define BOOST_TEST_UTILS_TIMER_HPP
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <utility>
#include <ctime>
# if defined(_WIN32) || defined(__CYGWIN__)
# define BOOST_TEST_TIMER_WINDOWS_API
# elif defined(__MACH__)// && !defined(CLOCK_MONOTONIC)
# // we compile for all macs the same, CLOCK_MONOTONIC introduced in 10.12
# define BOOST_TEST_TIMER_MACH_API
# else
# define BOOST_TEST_TIMER_POSIX_API
# if !defined(CLOCK_MONOTONIC)
# error "CLOCK_MONOTONIC not defined"
# endif
# endif
# if defined(BOOST_TEST_TIMER_WINDOWS_API)
# include <windows.h>
# elif defined(BOOST_TEST_TIMER_MACH_API)
# include <mach/mach_time.h>
//# include <mach/mach.h> /* host_get_clock_service, mach_... */
# else
# include <sys/time.h>
# endif
# ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::clock_t; using ::clock; }
# endif
namespace boost {
namespace unit_test {
namespace timer {
struct elapsed_time
{
typedef boost::int_least64_t nanosecond_type;
nanosecond_type wall;
nanosecond_type system;
void clear() {
wall = 0;
system = 0;
}
};
inline double
microsecond_wall_time( elapsed_time const& elapsed )
{
return elapsed.wall / 1E3;
}
inline double
second_wall_time( elapsed_time const& elapsed )
{
return elapsed.wall / 1E9;
}
namespace details {
#if defined(BOOST_TEST_TIMER_WINDOWS_API)
elapsed_time::nanosecond_type get_tick_freq() {
LARGE_INTEGER freq;
::QueryPerformanceFrequency( &freq );
return static_cast<elapsed_time::nanosecond_type>(freq.QuadPart);
}
#elif defined(BOOST_TEST_TIMER_MACH_API)
std::pair<elapsed_time::nanosecond_type, elapsed_time::nanosecond_type> get_time_base() {
mach_timebase_info_data_t timebase;
if(mach_timebase_info(&timebase) == 0)
return std::pair<elapsed_time::nanosecond_type, elapsed_time::nanosecond_type>(timebase.numer, timebase.denom);
return std::pair<elapsed_time::nanosecond_type, elapsed_time::nanosecond_type>(0, 1);
}
#endif
}
//! Simple timing class
//!
//! This class measures the wall clock time.
class timer
{
public:
timer()
{
restart();
}
void restart()
{
_start_time_clock = std::clock();
#if defined(BOOST_TEST_TIMER_WINDOWS_API)
::QueryPerformanceCounter(&_start_time_wall);
#elif defined(BOOST_TEST_TIMER_MACH_API)
_start_time_wall = mach_absolute_time();
#else
if( ::clock_gettime( CLOCK_MONOTONIC, &_start_time_wall ) != 0 )
{
_start_time_wall.tv_nsec = -1;
_start_time_wall.tv_sec = -1;
}
#endif
}
// return elapsed time in seconds
elapsed_time elapsed() const
{
typedef elapsed_time::nanosecond_type nanosecond_type;
static const double clock_to_nano_seconds = 1E9 / CLOCKS_PER_SEC;
elapsed_time return_value;
// processor / system time
return_value.system = static_cast<nanosecond_type>(double(std::clock() - _start_time_clock) * clock_to_nano_seconds);
#if defined(BOOST_TEST_TIMER_WINDOWS_API)
static const nanosecond_type tick_per_sec = details::get_tick_freq();
LARGE_INTEGER end_time;
::QueryPerformanceCounter(&end_time);
return_value.wall = static_cast<nanosecond_type>(((end_time.QuadPart - _start_time_wall.QuadPart) * 1E9) / tick_per_sec);
#elif defined(BOOST_TEST_TIMER_MACH_API)
static std::pair<nanosecond_type, nanosecond_type> timebase = details::get_time_base();
nanosecond_type clock = mach_absolute_time() - _start_time_wall;
return_value.wall = static_cast<nanosecond_type>((clock * timebase.first) / timebase.second);
#else
struct timespec end_time;
if( ::clock_gettime( CLOCK_MONOTONIC, &end_time ) == 0 )
{
return_value.wall = static_cast<nanosecond_type>((end_time.tv_sec - _start_time_wall.tv_sec) * 1E9 + (end_time.tv_nsec - _start_time_wall.tv_nsec));
}
#endif
return return_value;
}
private:
std::clock_t _start_time_clock;
#if defined(BOOST_TEST_TIMER_WINDOWS_API)
LARGE_INTEGER _start_time_wall;
#elif defined(BOOST_TEST_TIMER_MACH_API)
elapsed_time::nanosecond_type _start_time_wall;
#else
struct timespec _start_time_wall;
#endif
};
//____________________________________________________________________________//
} // namespace timer
} // namespace unit_test
} // namespace boost
#endif // BOOST_TEST_UTILS_TIMER_HPP

View File

@@ -1,79 +0,0 @@
// (C) Copyright Gennadiy Rozental 2001.
// 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 : simple helpers for creating cusom output manipulators
// ***************************************************************************
#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>
// Boost
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
// ************************************************************************** //
// ************** singleton ************** //
// ************************************************************************** //
template<typename Derived>
class singleton {
public:
static Derived& instance() { static Derived the_inst; return the_inst; }
BOOST_DELETED_FUNCTION(singleton(singleton const&))
BOOST_DELETED_FUNCTION(singleton& operator=(singleton const&))
protected:
BOOST_DEFAULTED_FUNCTION(singleton(), {})
BOOST_DEFAULTED_FUNCTION(~singleton(), {})
};
//____________________________________________________________________________//
#define BOOST_TEST_SINGLETON_CONS( type ) \
friend class boost::unit_test::singleton<type>; \
type() {} \
/**/
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
#define BOOST_TEST_SINGLETON_INST( inst ) \
template class unit_test::singleton< BOOST_JOIN( inst, _t ) > ; \
namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); }
#elif defined(__APPLE_CC__) && defined(__GNUC__) && __GNUC__ < 4
#define BOOST_TEST_SINGLETON_INST( inst ) \
static BOOST_JOIN( inst, _t)& inst = BOOST_JOIN (inst, _t)::instance();
#else
#define BOOST_TEST_SINGLETON_INST( inst ) \
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_UTILS_TRIVIAL_SIGNLETON_HPP

View File

@@ -16,6 +16,7 @@
#define BOOST_TEST_UTILS_XML_PRINTER_HPP
// Boost.Test
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <boost/test/utils/custom_manip.hpp>
#include <boost/test/utils/foreach.hpp>
@@ -26,6 +27,7 @@
// STL
#include <iostream>
#include <map>
#include <boost/test/detail/suppress_warnings.hpp>