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

@@ -75,7 +75,7 @@ struct is_dataset<collection<C>> : mpl::true_ {};
//! @overload boost::unit_test::data::make()
template<typename C>
inline typename std::enable_if<is_forward_iterable<C>::value,monomorphic::collection<C>>::type
inline typename std::enable_if<is_container_forward_iterable<C>::value,monomorphic::collection<C>>::type
make( C&& c )
{
return monomorphic::collection<C>( std::forward<C>(c) );

View File

@@ -0,0 +1,124 @@
// (C) Copyright Raffi Enficiaud 2018.
// 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 a lazy/delayed dataset store
// ***************************************************************************
#ifndef BOOST_TEST_DATA_MONOMORPHIC_DELAYED_HPP_062018GER
#define BOOST_TEST_DATA_MONOMORPHIC_DELAYED_HPP_062018GER
// Boost.Test
#include <boost/test/data/config.hpp>
#include <boost/test/data/monomorphic/fwd.hpp>
#include <boost/test/data/index_sequence.hpp>
#include <boost/core/ref.hpp>
#include <algorithm>
#include <memory>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_NO_CXX11_HDR_TUPLE)
namespace boost {
namespace unit_test {
namespace data {
namespace monomorphic {
// ************************************************************************** //
// ************** delayed_dataset ************** //
// ************************************************************************** //
/// Delayed dataset
///
/// This dataset holds another dataset that is instanciated on demand. It is
/// constructed with the @c data::make_delayed<dataset_t>(arg1,....) instead of the
/// @c data::make.
template <class dataset_t, class ...Args>
class delayed_dataset
{
public:
enum { arity = dataset_t::arity };
using iterator = decltype(std::declval<dataset_t>().begin());
delayed_dataset(Args... args)
: m_args(std::make_tuple(std::forward<Args>(args)...))
{}
// Mostly for VS2013
delayed_dataset(delayed_dataset&& b)
: m_args(std::move(b.m_args))
, m_dataset(std::move(b.m_dataset))
{}
boost::unit_test::data::size_t size() const {
return this->get().size();
}
// iterator
iterator begin() const {
return this->get().begin();
}
private:
dataset_t& get() const {
if(!m_dataset) {
m_dataset = create(boost::unit_test::data::index_sequence_for<Args...>());
}
return *m_dataset;
}
template<std::size_t... I>
std::unique_ptr<dataset_t>
create(boost::unit_test::data::index_sequence<I...>) const
{
return std::unique_ptr<dataset_t>{new dataset_t(std::get<I>(m_args)...)};
}
std::tuple<typename std::decay<Args>::type...> m_args;
mutable std::unique_ptr<dataset_t> m_dataset;
};
//____________________________________________________________________________//
//! A lazy/delayed dataset is a dataset.
template <class dataset_t, class ...Args>
struct is_dataset< delayed_dataset<dataset_t, Args...> > : boost::mpl::true_ {};
//____________________________________________________________________________//
} // namespace monomorphic
//! Delayed dataset instanciation
template<class dataset_t, class ...Args>
inline typename std::enable_if<
monomorphic::is_dataset< dataset_t >::value,
monomorphic::delayed_dataset<dataset_t, Args...>
>::type
make_delayed(Args... args)
{
return monomorphic::delayed_dataset<dataset_t, Args...>( std::forward<Args>(args)... );
}
} // namespace data
} // namespace unit_test
} // namespace boost
#endif
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_DATA_MONOMORPHIC_DELAYED_HPP_062018GER

View File

@@ -43,9 +43,6 @@ namespace monomorphic {
#if !defined(BOOST_TEST_DOXYGEN_DOC__)
template<typename T, typename Specific>
class dataset;
template<typename T>
class singleton;
@@ -58,6 +55,12 @@ class array;
template<typename T>
class init_list;
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_NO_CXX11_HDR_TUPLE)
template<class dataset_t, class ...Args>
class delayed_dataset;
#endif
#endif
// ************************************************************************** //
@@ -73,6 +76,8 @@ struct is_dataset : mpl::false_ {};
//! A reference to a dataset is a dataset
template<typename DataSet>
struct is_dataset<DataSet&> : is_dataset<DataSet> {};
template<typename DataSet>
struct is_dataset<DataSet&&> : is_dataset<DataSet> {};
//____________________________________________________________________________//
@@ -80,6 +85,18 @@ struct is_dataset<DataSet&> : is_dataset<DataSet> {};
template<typename DataSet>
struct is_dataset<DataSet const> : is_dataset<DataSet> {};
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//! Helper to check if a list of types contains a dataset
template<class DataSet, class...>
struct has_dataset : is_dataset<DataSet> {};
template<class DataSet0, class DataSet1, class... DataSetTT>
struct has_dataset<DataSet0, DataSet1, DataSetTT...>
: std::integral_constant<bool, is_dataset<DataSet0>::value || has_dataset<DataSet1, DataSetTT...>::value>
{};
#endif
} // namespace monomorphic
// ************************************************************************** //
@@ -119,7 +136,7 @@ make(DataSet&& ds)
//! @overload boost::unit_test::data::make()
template<typename T>
inline typename std::enable_if<!is_forward_iterable<T>::value &&
inline typename std::enable_if<!is_container_forward_iterable<T>::value &&
!monomorphic::is_dataset<T>::value &&
!is_array<typename remove_reference<T>::type>::value,
monomorphic::singleton<T>>::type
@@ -129,7 +146,7 @@ make( T&& v );
//! @overload boost::unit_test::data::make()
template<typename C>
inline typename std::enable_if<is_forward_iterable<C>::value,monomorphic::collection<C>>::type
inline typename std::enable_if<is_container_forward_iterable<C>::value,monomorphic::collection<C>>::type
make( C&& c );
//____________________________________________________________________________//
@@ -160,6 +177,31 @@ make( std::initializer_list<T>&& );
//____________________________________________________________________________//
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_TEST_ERRONEOUS_INIT_LIST)
//! @overload boost::unit_test::data::make()
template<class T, class ...Args>
inline typename std::enable_if<
!monomorphic::has_dataset<T, Args...>::value,
monomorphic::init_list<T>
>::type
make( T&& arg0, Args&&... args );
#endif
//____________________________________________________________________________//
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_NO_CXX11_HDR_TUPLE)
template<class dataset_t, class ...Args>
inline typename std::enable_if<
monomorphic::is_dataset< dataset_t >::value,
monomorphic::delayed_dataset<dataset_t, Args...>
>::type
make_delayed(Args... args);
#endif
//____________________________________________________________________________//
namespace result_of {
//! Result of the make call.

View File

@@ -16,6 +16,8 @@
#include <boost/test/data/config.hpp>
#include <boost/test/data/monomorphic/fwd.hpp>
#include <boost/core/ref.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//

View File

@@ -25,9 +25,9 @@ namespace unit_test {
namespace data {
namespace {
nfp::keyword<struct begin_t> begin;
nfp::keyword<struct end_t> end;
nfp::keyword<struct step_t> step;
nfp::keyword<struct begin_t> begin BOOST_ATTRIBUTE_UNUSED;
nfp::keyword<struct end_t> end BOOST_ATTRIBUTE_UNUSED;
nfp::keyword<struct step_t> step BOOST_ATTRIBUTE_UNUSED;
} // local namespace
} // namespace data

View File

@@ -22,6 +22,9 @@
#include <boost/test/data/monomorphic/fwd.hpp>
#include <boost/test/data/monomorphic/sample_merge.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
@@ -102,7 +105,10 @@ public:
{}
// dataset interface
data::size_t size() const { return m_ds1.size() * m_ds2.size(); }
data::size_t size() const {
BOOST_TEST_DS_ASSERT( !m_ds1.size().is_inf() && !m_ds2.size().is_inf(), "Grid axes can't have infinite size" );
return m_ds1.size() * m_ds2.size();
}
iterator begin() const { return iterator( m_ds1.begin(), m_ds2 ); }
private:
@@ -138,8 +144,6 @@ inline typename boost::lazy_enable_if_c<is_dataset<DataSet1>::value && is_datase
>::type
operator*( DataSet1&& ds1, DataSet2&& ds2 )
{
BOOST_TEST_DS_ASSERT( !ds1.size().is_inf() && !ds2.size().is_inf(), "Grid axes can't have infinite size" );
return grid<DataSet1,DataSet2>( std::forward<DataSet1>( ds1 ), std::forward<DataSet2>( ds2 ) );
}

View File

@@ -16,6 +16,10 @@
#include <boost/test/data/config.hpp>
#include <boost/test/data/monomorphic/fwd.hpp>
#include <boost/core/ignore_unused.hpp>
#include <vector>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
@@ -26,23 +30,35 @@ namespace data {
namespace monomorphic {
// ************************************************************************** //
// ************** array ************** //
// ************** initializer_list ************** //
// ************************************************************************** //
/// Dataset view of a C array
/// Dataset view from an initializer_list or variadic template arguments
///
/// The data should be stored in the dataset, and since the elements
/// are passed by an @c std::initializer_list , it implies a copy of
/// the elements.
template<typename T>
class init_list {
public:
typedef T sample;
enum { arity = 1 };
typedef T const* iterator;
typedef typename std::vector<T>::const_iterator iterator;
//! Constructor swallows initializer_list
init_list( std::initializer_list<T>&& il )
: m_data( std::forward<std::initializer_list<T>>( il ) )
//! Constructor copies content of initializer_list
init_list( std::initializer_list<T> il )
: m_data( il )
{}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_TEST_ERRONEOUS_INIT_LIST)
//! Variadic template initialization
template <class ...Args>
init_list( Args&& ... args ) {
int dummy[] = { 0, (m_data.emplace_back(std::forward<Args&&>(args)), 0)... };
boost::ignore_unused(dummy);
}
#endif
//! dataset interface
data::size_t size() const { return m_data.size(); }
@@ -50,7 +66,39 @@ public:
private:
// Data members
std::initializer_list<T> m_data;
std::vector<T> m_data;
};
//! Specialization of init_list for type bool
template <>
class init_list<bool> {
public:
typedef bool sample;
enum { arity = 1 };
typedef std::vector<bool>::const_iterator iterator;
//! Constructor copies content of initializer_list
init_list( std::initializer_list<bool>&& il )
: m_data( std::forward<std::initializer_list<bool>>( il ) )
{}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_TEST_ERRONEOUS_INIT_LIST)
//! Variadic template initialization
template <class ...Args>
init_list( Args&& ... args ) : m_data{ args... }
{ }
#endif
//! dataset interface
data::size_t size() const { return m_data.size(); }
iterator begin() const { return m_data.begin(); }
private:
// Data members
std::vector<bool> m_data;
};
//____________________________________________________________________________//
@@ -71,6 +119,20 @@ make( std::initializer_list<T>&& il )
return monomorphic::init_list<T>( std::forward<std::initializer_list<T>>( il ) );
}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_TEST_ERRONEOUS_INIT_LIST)
template<class T, class ...Args>
inline typename std::enable_if<
!monomorphic::has_dataset<T, Args...>::value,
monomorphic::init_list<T>
>::type
make( T&& arg0, Args&&... args )
{
return monomorphic::init_list<T>( std::forward<T>(arg0), std::forward<Args>( args )... );
}
#endif
} // namespace data
} // namespace unit_test
} // namespace boost

View File

@@ -16,6 +16,9 @@
#include <boost/test/data/config.hpp>
#include <boost/test/data/monomorphic/fwd.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
@@ -40,22 +43,33 @@ class join {
typedef typename dataset1_decay::iterator dataset1_iter;
typedef typename dataset2_decay::iterator dataset2_iter;
using iter1_ret = decltype(*std::declval<DataSet1>().begin());
using iter2_ret = decltype(*std::declval<DataSet2>().begin());
public:
typedef typename dataset1_decay::sample sample;
enum { arity = dataset1_decay::arity };
using sample_t = typename std::conditional<
std::is_reference<iter1_ret>::value && std::is_reference<iter2_ret>::value && std::is_same<iter1_ret, iter2_ret>::value,
iter1_ret,
typename std::remove_reference<iter1_ret>::type
>::type
;
struct iterator {
// Constructor
explicit iterator( dataset1_iter it1, dataset2_iter it2, data::size_t first_size )
explicit iterator( dataset1_iter&& it1, dataset2_iter&& it2, data::size_t first_size )
: m_it1( std::move( it1 ) )
, m_it2( std::move( it2 ) )
, m_first_size( first_size )
{}
// forward iterator interface
sample const& operator*() const { return m_first_size > 0 ? *m_it1 : *m_it2; }
void operator++() { if( m_first_size > 0 ) { --m_first_size; ++m_it1; } else ++m_it2; }
// The returned sample should be by value, as the operator* may return a temporary object
sample_t operator*() const { return m_first_size > 0 ? *m_it1 : *m_it2; }
void operator++() { if( m_first_size > 0 ) { --m_first_size; ++m_it1; } else ++m_it2; }
private:
// Data members

View File

@@ -32,9 +32,11 @@ namespace monomorphic {
/// Models a single element data set
template<typename T>
class singleton {
public:
private:
typedef typename boost::decay<T>::type sample;
public:
enum { arity = 1 };
struct iterator {
@@ -81,7 +83,7 @@ struct is_dataset<singleton<T>> : mpl::true_ {};
/// @overload boost::unit_test::data::make()
template<typename T>
inline typename std::enable_if<!is_forward_iterable<T>::value &&
inline typename std::enable_if<!is_container_forward_iterable<T>::value &&
!monomorphic::is_dataset<T>::value &&
!boost::is_array<typename boost::remove_reference<T>::type>::value,
monomorphic::singleton<T>

View File

@@ -20,6 +20,9 @@
#include <boost/test/data/monomorphic/fwd.hpp>
#include <boost/test/data/monomorphic/sample_merge.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -70,33 +73,50 @@ public:
dataset2_iter m_iter2;
};
typedef typename iterator::iterator_sample sample;
//! Constructor
//!
//! The datasets are moved and not copied.
zip( DataSet1&& ds1, DataSet2&& ds2, data::size_t size )
zip( DataSet1&& ds1, DataSet2&& ds2/*, data::size_t size*/ )
: m_ds1( std::forward<DataSet1>( ds1 ) )
, m_ds2( std::forward<DataSet2>( ds2 ) )
, m_size( size )
//, m_size( size )
{}
//! Move constructor
zip( zip&& j )
: m_ds1( std::forward<DataSet1>( j.m_ds1 ) )
, m_ds2( std::forward<DataSet2>( j.m_ds2 ) )
, m_size( j.m_size )
//, m_size( j.m_size )
{}
// dataset interface
data::size_t size() const { return m_size; }
data::size_t size() const { return zip_size(); }
iterator begin() const { return iterator( m_ds1.begin(), m_ds2.begin() ); }
private:
// Data members
DataSet1 m_ds1;
DataSet2 m_ds2;
data::size_t m_size;
//data::size_t m_size;
//! Handles the sise of the resulting zipped dataset.
data::size_t zip_size() const
{
data::size_t ds1_size = m_ds1.size();
data::size_t ds2_size = m_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" );
}
};
//____________________________________________________________________________//
@@ -107,32 +127,6 @@ struct is_dataset<zip<DataSet1,DataSet2>> : mpl::true_ {};
//____________________________________________________________________________//
namespace ds_detail {
//! Handles the sise of the resulting zipped dataset.
template<typename DataSet1, typename DataSet2>
inline data::size_t
zip_size( DataSet1&& ds1, DataSet2&& 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.
@@ -153,8 +147,8 @@ inline typename boost::lazy_enable_if_c<is_dataset<DataSet1>::value && is_datase
operator^( DataSet1&& ds1, DataSet2&& ds2 )
{
return zip<DataSet1,DataSet2>( std::forward<DataSet1>( ds1 ),
std::forward<DataSet2>( ds2 ),
ds_detail::zip_size( ds1, ds2 ) );
std::forward<DataSet2>( ds2 )/*,
ds_detail::zip_size( ds1, ds2 )*/ );
}
//____________________________________________________________________________//