updated boost on windows

This commit is contained in:
Bassem Girgis
2019-08-13 21:48:48 -05:00
parent 7d77d485fd
commit b40a3bee82
5162 changed files with 473027 additions and 116452 deletions

View File

@@ -37,9 +37,10 @@ namespace ut_detail {
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 );
auto_test_unit_registrar( test_case* tc, decorator::collector_t& 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_t& decorators );
explicit auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector_t& decorators );
explicit auto_test_unit_registrar( boost::shared_ptr<test_unit_generator> tc_gen, decorator::collector_t& decorators );
explicit auto_test_unit_registrar( int );
};

View File

@@ -22,9 +22,7 @@
#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>
@@ -46,35 +44,45 @@ class test_unit;
namespace decorator {
// ************************************************************************** //
// ************** decorator::collector ************** //
// ************** decorator::collector_t ************** //
// ************************************************************************** //
class base;
typedef boost::shared_ptr<base> base_ptr;
class BOOST_TEST_DECL collector : public singleton<collector> {
class BOOST_TEST_DECL collector_t {
public:
collector& operator*( base const& d );
collector_t& operator*( base const& d );
void store_in( test_unit& tu );
void reset();
void stack();
std::vector<base_ptr> get_lazy_decorators() const;
// singleton pattern without ctor
BOOST_TEST_SINGLETON_CONS_NO_CTOR( collector_t )
private:
BOOST_TEST_SINGLETON_CONS( collector )
// Class invariant: minimal size is 1.
collector_t() : m_tu_decorators_stack(1) {}
// Data members
std::vector<base_ptr> m_tu_decorators;
std::vector< std::vector<base_ptr> > m_tu_decorators_stack;
};
// ************************************************************************** //
// ************** decorator::base ************** //
// ************** decorator::base ************** //
// ************************************************************************** //
class BOOST_TEST_DECL base {
public:
// composition interface
collector& operator*() const;
virtual collector_t& operator*() const;
// application interface
virtual void apply( test_unit& tu ) = 0;
@@ -86,6 +94,30 @@ protected:
virtual ~base() {}
};
// ************************************************************************** //
// ************** decorator::stack_decorator ************** //
// ************************************************************************** //
//!@ A decorator that creates a new stack in the collector
//!
//! This decorator may be used in places where the currently accumulated decorators
//! in the collector should be applied to lower levels of the hierarchy rather
//! than the current one. This is for instance for dataset test cases, where the
//! macro does not let the user specify decorators for the underlying generated tests
//! (but rather on the main generator function), applying the stack_decorator at the
//! parent level lets us consume the decorator at the underlying test cases level.
class BOOST_TEST_DECL stack_decorator : public decorator::base {
public:
explicit stack_decorator() {}
virtual collector_t& operator*() const;
private:
// decorator::base interface
virtual void apply( test_unit& tu );
virtual base_ptr clone() const { return base_ptr(new stack_decorator()); }
};
// ************************************************************************** //
// ************** decorator::label ************** //
// ************************************************************************** //

View File

@@ -5,11 +5,8 @@
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision: 74640 $
//
// Description : defines fixture interface and object makers
/// @file
/// Defines fixture interface and object makers
// ***************************************************************************
#ifndef BOOST_TEST_TREE_FIXTURE_HPP_100311GER
@@ -22,6 +19,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/function/function0.hpp>
#include <boost/utility/declval.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -45,6 +43,83 @@ public:
typedef shared_ptr<test_unit_fixture> test_unit_fixture_ptr;
// ************************************************************************** //
// ************** fixture helper functions ************** //
// ************************************************************************** //
namespace impl_fixture {
#if defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES)
template<typename U, void (U::*)()> struct fixture_detect {};
template<typename T>
struct has_setup {
private:
template<typename U> static char Test(fixture_detect<U, &U::setup>*);
template<typename U> static int Test(...);
public:
static const bool value = sizeof(Test<T>(0)) == sizeof(char);
};
template<typename T>
struct has_teardown {
private:
template<typename U> static char Test(fixture_detect<U, &U::teardown>*);
template<typename U> static int Test(...);
public:
static const bool value = sizeof(Test<T>(0)) == sizeof(char);
};
#else
template<typename U> struct fixture_detect { typedef char type; };
template<typename T>
struct has_setup {
private:
template<typename U> static auto Test(U*) -> typename fixture_detect<decltype(boost::declval<U>().setup())>::type;
template<typename U> static int Test(...);
public:
static const bool value = sizeof(Test<T>(0)) == sizeof(char);
};
template<typename T>
struct has_teardown {
private:
template<typename U> static auto Test(U*) -> typename fixture_detect<decltype(boost::declval<U>().teardown())>::type;
template<typename U> static int Test(...);
public:
static const bool value = sizeof(Test<T>(0)) == sizeof(char);
};
#endif
template <bool has_setup = false>
struct call_setup { template <class U> void operator()(U& ) { } };
template <>
struct call_setup<true> { template <class U> void operator()(U& u) { u.setup(); } };
template <bool has_teardown = false>
struct call_teardown { template <class U> void operator()(U& ) { } };
template <>
struct call_teardown<true> { template <class U> void operator()(U& u) { u.teardown(); } };
}
//! Calls the fixture "setup" if detected by the compiler, otherwise does nothing.
template <class U>
void setup_conditional(U& u) {
return impl_fixture::call_setup<impl_fixture::has_setup<U>::value>()(u);
}
//! Calls the fixture "teardown" if detected by the compiler, otherwise does nothing.
template <class U>
void teardown_conditional(U& u) {
return impl_fixture::call_teardown<impl_fixture::has_teardown<U>::value>()(u);
}
// ************************************************************************** //
// ************** class_based_fixture ************** //
// ************************************************************************** //
@@ -57,8 +132,8 @@ public:
private:
// Fixture interface
virtual void setup() { m_inst.reset( new F( m_arg ) ); }
virtual void teardown() { m_inst.reset(); }
virtual void setup() { m_inst.reset( new F( m_arg ) ); setup_conditional(*m_inst); }
virtual void teardown() { teardown_conditional(*m_inst); m_inst.reset(); }
// Data members
scoped_ptr<F> m_inst;
@@ -75,8 +150,8 @@ public:
private:
// Fixture interface
virtual void setup() { m_inst.reset( new F ); }
virtual void teardown() { m_inst.reset(); }
virtual void setup() { m_inst.reset( new F ); setup_conditional(*m_inst); }
virtual void teardown() { teardown_conditional(*m_inst); m_inst.reset(); }
// Data members
scoped_ptr<F> m_inst;

View File

@@ -17,6 +17,7 @@
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/tree/observer.hpp>
#include <boost/test/tree/fixture.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -26,14 +27,53 @@
namespace boost {
namespace unit_test {
// ************************************************************************** //
// ************** global_configuration ************** //
// ************************************************************************** //
class BOOST_TEST_DECL global_configuration : public test_observer {
public:
// Constructor
global_configuration();
/// Unregisters the global fixture from the framework
///
/// This is called by the framework at shutdown time
void unregister_from_framework();
// Dtor
virtual ~global_configuration();
// Happens after the framework global observer init has been done
virtual int priority() { return 1; }
private:
bool registered;
};
// ************************************************************************** //
// ************** global_fixture ************** //
// ************************************************************************** //
class BOOST_TEST_DECL global_fixture : public test_observer {
class BOOST_TEST_DECL global_fixture : public test_unit_fixture {
public:
// Constructor
global_fixture();
/// Unregisters the global fixture from the framework
///
/// This is called by the framework at shutdown time
void unregister_from_framework();
// Dtor
virtual ~global_fixture();
private:
bool registered;
};
//____________________________________________________________________________//
@@ -41,14 +81,48 @@ public:
namespace ut_detail {
template<typename F>
struct global_fixture_impl : public global_fixture {
struct global_configuration_impl : public global_configuration {
// Constructor
global_fixture_impl() : m_fixture( 0 ) {}
global_configuration_impl() : m_configuration_observer( 0 ) {
}
// test observer interface
virtual void test_start( counter_t ) { m_fixture = new F; }
virtual void test_finish() { delete m_fixture; m_fixture = 0; }
virtual void test_aborted() { delete m_fixture; m_fixture = 0; }
virtual void test_start( counter_t ) {
m_configuration_observer = new F;
}
// test observer interface
virtual void test_finish() {
if(m_configuration_observer) {
delete m_configuration_observer;
m_configuration_observer = 0;
}
}
private:
// Data members
F* m_configuration_observer;
};
template<typename F>
struct global_fixture_impl : public global_fixture {
// Constructor
global_fixture_impl() : m_fixture( 0 ) {
}
// test fixture interface
virtual void setup() {
m_fixture = new F;
setup_conditional(*m_fixture);
}
// test fixture interface
virtual void teardown() {
if(m_fixture) {
teardown_conditional(*m_fixture);
}
delete m_fixture;
m_fixture = 0;
}
private:
// Data members

View File

@@ -34,7 +34,7 @@ namespace unit_test {
/// Boost.Test framework on the current execution state.
///
/// Several observers can be running at the same time, and it is not unusual to
/// have interactions among them. The test_observer#priority member function allows the specification
/// have interactions among them. The @ref test_observer::priority member function allows the specification
/// of a particular order among them (lowest priority executed first, except specified otherwise).
///
class BOOST_TEST_DECL test_observer {
@@ -44,10 +44,8 @@ public:
//!
//! @param[in] number_of_test_cases indicates the number of test cases. Only active
//! test cases are taken into account.
//!
virtual void test_start( counter_t /* number_of_test_cases */ ) {}
//! Called after the framework ends executing the test cases
//!
//! @note The call is made with a reversed priority order.
@@ -74,6 +72,12 @@ public:
virtual void test_unit_skipped( test_unit const& tu, const_string ) { test_unit_skipped( tu ); }
virtual void test_unit_skipped( test_unit const& ) {} ///< backward compatibility
//! Called when the test timed out
//!
//! This function is called to signal that a test unit (case or suite) timed out.
//! A valid test unit is available through boost::unit_test::framework::current_test_unit
virtual void test_unit_timed_out( test_unit const& ) {}
//! Called when a test unit indicates a fatal error.
//!
//! A fatal error happens when
@@ -81,14 +85,8 @@ public:
//! - an unexpected exception is caught by the Boost.Test framework
virtual void test_unit_aborted( test_unit const& ) {}
virtual void assertion_result( unit_test::assertion_result ar )
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;
}
}
//! Called when an exception is intercepted
@@ -98,11 +96,11 @@ public:
//! additional data about the exception.
virtual void exception_caught( execution_exception const& ) {}
//! The priority indicates the order at which this observer is initialized
//! and tore down in the UTF framework. The order is lowest to highest priority.
virtual int priority() { return 0; }
protected:
//! Deprecated
virtual void assertion_result( bool /* passed */ ) {}
BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {}
};

View File

@@ -16,7 +16,7 @@
#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/tree/test_unit.hpp>
#include <boost/test/utils/class_properties.hpp>
@@ -29,6 +29,10 @@
#include <boost/mpl/identity.hpp>
#include <boost/type.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/type_traits/is_rvalue_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/function/function0.hpp>
#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI)
@@ -41,6 +45,12 @@
#include <string> // for std::string
#include <list> // for std::list
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
#include <type_traits>
#include <boost/mpl/is_sequence.hpp>
#endif
#include <boost/test/detail/suppress_warnings.hpp>
@@ -64,7 +74,7 @@ public:
// ************** generate_test_case_4_type ************** //
// ************************************************************************** //
template<typename Generator,typename TestCaseTemplate>
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 )
@@ -84,8 +94,16 @@ struct generate_test_case_4_type {
#else
full_name += BOOST_CURRENT_FUNCTION;
#endif
if( boost::is_const<TestType>::value )
typedef typename boost::remove_reference<TestType>::type TestTypewoRef;
if( boost::is_const<TestTypewoRef>::value )
full_name += "_const";
if( boost::is_volatile<TestTypewoRef>::value )
full_name += "_volatile";
if( boost::is_rvalue_reference<TestType>::value )
full_name += "_refref";
else if( boost::is_lvalue_reference<TestType>::value )
full_name += "_ref";
full_name += '>';
m_holder.m_test_cases.push_back( new test_case( ut_detail::normalize_test_case_name( full_name ),
@@ -106,17 +124,8 @@ private:
// ************** test_case_template ************** //
// ************************************************************************** //
template<typename TestCaseTemplate,typename TestTypesList>
class template_test_case_gen : public test_unit_generator {
class template_test_case_gen_base : 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() )
@@ -132,6 +141,57 @@ public:
mutable std::list<test_unit*> m_test_cases;
};
template<typename TestCaseTemplate,typename TestTypesList, typename enabler = void>
class template_test_case_gen : public template_test_case_gen_base {
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 ) );
}
};
// Describing template test cases with tuples
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && \
!defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<typename TestCaseTemplate,
template <class ...> class C,
typename... parameter_pack>
class template_test_case_gen<
TestCaseTemplate,
C<parameter_pack...>,
typename std::enable_if<!boost::mpl::is_sequence<C<parameter_pack...>>::value>::type >
: public template_test_case_gen_base {
template<typename F>
void for_each(F &f)
{
auto l = { (f(mpl::identity<parameter_pack>()), 0)... };
(void)l; // silence warning
}
public:
// Constructor
template_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line )
{
using this_type = template_test_case_gen<
TestCaseTemplate,
C<parameter_pack...>,
typename std::enable_if<!boost::mpl::is_sequence<C<parameter_pack...>>::value>::type>;
using single_test_gen = generate_test_case_4_type<this_type, TestCaseTemplate>;
single_test_gen op( tc_name, tc_file, tc_line, *this );
this->for_each(op);
}
};
#endif /* C++11 variadic, type alias */
} // namespace ut_detail
} // unit_test
} // namespace boost

View File

@@ -20,6 +20,7 @@
#include <boost/test/tree/decorator.hpp>
#include <boost/test/tree/fixture.hpp>
#include <boost/test/framework.hpp>
#include <boost/test/tools/assertion_result.hpp>
@@ -42,7 +43,7 @@ namespace boost {
namespace unit_test {
namespace framework {
class state;
class state;
}
// ************************************************************************** //
@@ -175,11 +176,21 @@ public:
void add( test_unit_generator const& gen, unsigned timeout = 0 );
/// @overload
void add( test_unit_generator const& gen, decorator::collector& decorators );
void add( test_unit_generator const& gen, decorator::collector_t& decorators );
/// @overload
void add( boost::shared_ptr<test_unit_generator> gen_ptr, decorator::collector_t& decorators );
//! Removes a test from the test suite.
void remove( test_unit_id id );
//! Generates all the delayed test_units from the generators
void generate( );
//! Check for duplicates name in test cases
//!
//! Raises a setup_error if there are duplicates
void check_for_duplicate_test_cases();
// access methods
test_unit_id get( const_string tu_name ) const;
@@ -199,6 +210,8 @@ protected:
test_unit_id_list m_children;
children_per_rank m_ranked_children; ///< maps child sibling rank to list of children with that rank
std::vector< std::pair<boost::shared_ptr<test_unit_generator>, std::vector<decorator::base_ptr> > > m_generators; /// lazy evaluation
};
// ************************************************************************** //
@@ -206,12 +219,17 @@ protected:
// ************************************************************************** //
class BOOST_TEST_DECL master_test_suite_t : public test_suite {
public:
private:
master_test_suite_t();
master_test_suite_t(const master_test_suite_t&); // undefined
master_test_suite_t& operator=(master_test_suite_t const &); // undefined
public:
// Data members
int argc;
char** argv;
friend BOOST_TEST_DECL master_test_suite_t& boost::unit_test::framework::master_test_suite();
};
// ************************************************************************** //