mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Replace Boost.TypeTraits by std equivalents
This commit is contained in:
parent
9e664b52ab
commit
df5b77af95
13 changed files with 76 additions and 113 deletions
|
|
@ -46,12 +46,6 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_DECLTYPE)
|
|
||||||
# ifndef MOCK_NO_DECLTYPE
|
|
||||||
# define MOCK_DECLTYPE
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS)
|
#if !defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS)
|
||||||
# ifndef MOCK_NO_VARIADIC_MACROS
|
# ifndef MOCK_NO_VARIADIC_MACROS
|
||||||
# define MOCK_VARIADIC_MACROS
|
# define MOCK_VARIADIC_MACROS
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||||
#include <boost/preprocessor/repetition/enum.hpp>
|
#include <boost/preprocessor/repetition/enum.hpp>
|
||||||
#include <boost/preprocessor/array.hpp>
|
#include <boost/preprocessor/array.hpp>
|
||||||
#include <boost/type_traits/decay.hpp>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
@ -158,7 +158,7 @@ namespace detail
|
||||||
Expected_##n expected##n;
|
Expected_##n expected##n;
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_TPL_TYPE(z, n, d) \
|
#define MOCK_CONSTRAINT_TPL_TYPE(z, n, d) \
|
||||||
typename boost::decay< const T##n >::type
|
std::decay_t< const T##n >
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_CREF_PARAM(z, n, Args) \
|
#define MOCK_CONSTRAINT_CREF_PARAM(z, n, Args) \
|
||||||
const typename boost::unwrap_reference< Expected_##n >::type& \
|
const typename boost::unwrap_reference< Expected_##n >::type& \
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,13 @@
|
||||||
#include "detail/move_helper.hpp"
|
#include "detail/move_helper.hpp"
|
||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/type_traits/make_void.hpp>
|
||||||
#include <boost/type_traits/common_type.hpp>
|
|
||||||
#include <boost/type_traits/is_convertible.hpp>
|
|
||||||
#include <boost/type_traits/has_equal_to.hpp>
|
|
||||||
#if BOOST_VERSION >= 107000
|
#if BOOST_VERSION >= 107000
|
||||||
#include <boost/test/tools/floating_point_comparison.hpp>
|
#include <boost/test/tools/floating_point_comparison.hpp>
|
||||||
#else
|
#else
|
||||||
#include <boost/test/floating_point_comparison.hpp>
|
#include <boost/test/floating_point_comparison.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
@ -65,7 +63,7 @@ namespace detail
|
||||||
template< typename T1, typename T2, typename Tolerance >
|
template< typename T1, typename T2, typename Tolerance >
|
||||||
bool is_close( const T1& t1, const T2& t2, const Tolerance& tolerance )
|
bool is_close( const T1& t1, const T2& t2, const Tolerance& tolerance )
|
||||||
{
|
{
|
||||||
typedef typename boost::common_type< T1, T2 >::type common_type;
|
typedef std::common_type_t< T1, T2 > common_type;
|
||||||
return boost::math::fpc::close_at_tolerance< common_type >(
|
return boost::math::fpc::close_at_tolerance< common_type >(
|
||||||
tolerance, boost::math::fpc::FPC_STRONG )( t1, t2 );
|
tolerance, boost::math::fpc::FPC_STRONG )( t1, t2 );
|
||||||
}
|
}
|
||||||
|
|
@ -114,6 +112,14 @@ namespace detail
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
template<class T, class U = T, class = void>
|
||||||
|
struct has_equal_to: std::false_type
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<class T, class U>
|
||||||
|
struct has_equal_to<T, U, boost::void_t<decltype(std::declval<T>() == std::declval<U>())>>: std::true_type
|
||||||
|
{};
|
||||||
|
|
||||||
template< typename Expected >
|
template< typename Expected >
|
||||||
struct equal
|
struct equal
|
||||||
{
|
{
|
||||||
|
|
@ -122,25 +128,25 @@ namespace detail
|
||||||
{}
|
{}
|
||||||
template< typename Actual >
|
template< typename Actual >
|
||||||
bool operator()( const Actual& actual,
|
bool operator()( const Actual& actual,
|
||||||
typename boost::enable_if<
|
std::enable_if_t<
|
||||||
boost::has_equal_to<
|
has_equal_to<
|
||||||
Actual,
|
Actual,
|
||||||
typename
|
typename
|
||||||
boost::unwrap_reference< Expected >::type
|
boost::unwrap_reference< Expected >::type
|
||||||
>
|
>::value
|
||||||
>::type* = 0 ) const
|
>* = 0 ) const
|
||||||
{
|
{
|
||||||
return actual == boost::unwrap_ref( expected_ );
|
return actual == boost::unwrap_ref( expected_ );
|
||||||
}
|
}
|
||||||
template< typename Actual >
|
template< typename Actual >
|
||||||
bool operator()( const Actual& actual,
|
bool operator()( const Actual& actual,
|
||||||
typename boost::disable_if<
|
std::enable_if_t<
|
||||||
boost::has_equal_to<
|
!has_equal_to<
|
||||||
Actual,
|
Actual,
|
||||||
typename
|
typename
|
||||||
boost::unwrap_reference< Expected >::type
|
boost::unwrap_reference< Expected >::type
|
||||||
>
|
>::value
|
||||||
>::type* = 0 ) const
|
>* = 0 ) const
|
||||||
{
|
{
|
||||||
return actual && *actual == boost::unwrap_ref( expected_ );
|
return actual && *actual == boost::unwrap_ref( expected_ );
|
||||||
}
|
}
|
||||||
|
|
@ -178,38 +184,38 @@ namespace detail
|
||||||
{}
|
{}
|
||||||
template< typename Actual >
|
template< typename Actual >
|
||||||
bool operator()( const Actual& actual,
|
bool operator()( const Actual& actual,
|
||||||
typename boost::disable_if<
|
std::enable_if_t<
|
||||||
boost::is_convertible<
|
!std::is_convertible<
|
||||||
const Actual*,
|
const Actual*,
|
||||||
typename
|
typename
|
||||||
boost::unwrap_reference< Expected >::type
|
boost::unwrap_reference< Expected >::type
|
||||||
>
|
>::value
|
||||||
>::type* = 0 ) const
|
>* = 0 ) const
|
||||||
{
|
{
|
||||||
*expected_ = actual;
|
*expected_ = actual;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template< typename Actual >
|
template< typename Actual >
|
||||||
bool operator()( Actual&& actual,
|
bool operator()( Actual&& actual,
|
||||||
typename boost::disable_if<
|
std::enable_if_t<
|
||||||
boost::is_convertible<
|
!std::is_convertible<
|
||||||
const Actual*,
|
const Actual*,
|
||||||
typename
|
typename
|
||||||
boost::unwrap_reference< Expected >::type
|
boost::unwrap_reference< Expected >::type
|
||||||
>
|
>::value
|
||||||
>::type* = 0 ) const
|
>* = 0 ) const
|
||||||
{
|
{
|
||||||
*expected_ = std::move( actual );
|
*expected_ = std::move( actual );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template< typename Actual >
|
template< typename Actual >
|
||||||
bool operator()( Actual& actual,
|
bool operator()( Actual& actual,
|
||||||
typename boost::enable_if<
|
std::enable_if_t<
|
||||||
boost::is_convertible< Actual*,
|
std::is_convertible< Actual*,
|
||||||
typename
|
typename
|
||||||
boost::unwrap_reference< Expected >::type
|
boost::unwrap_reference< Expected >::type
|
||||||
>
|
>::value
|
||||||
>::type* = 0 ) const
|
>* = 0 ) const
|
||||||
{
|
{
|
||||||
*expected_ = detail::addressof( actual );
|
*expected_ = detail::addressof( actual );
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -236,13 +242,13 @@ namespace detail
|
||||||
}
|
}
|
||||||
template< typename Actual >
|
template< typename Actual >
|
||||||
bool operator()( Actual* actual,
|
bool operator()( Actual* actual,
|
||||||
typename boost::enable_if<
|
std::enable_if_t<
|
||||||
boost::is_convertible<
|
std::is_convertible<
|
||||||
typename
|
typename
|
||||||
boost::unwrap_reference< Expected >::type,
|
boost::unwrap_reference< Expected >::type,
|
||||||
Actual
|
Actual
|
||||||
>
|
>::value
|
||||||
>::type* = 0 ) const
|
>* = 0 ) const
|
||||||
{
|
{
|
||||||
if( ! actual )
|
if( ! actual )
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,12 @@
|
||||||
#define MOCK_ACTION_HPP_INCLUDED
|
#define MOCK_ACTION_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include <boost/type_traits/remove_reference.hpp>
|
|
||||||
#include <boost/type_traits/remove_const.hpp>
|
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
@ -108,7 +107,7 @@ namespace detail
|
||||||
{
|
{
|
||||||
this->set(
|
this->set(
|
||||||
boost::bind(
|
boost::bind(
|
||||||
&move< typename boost::remove_reference< Value >::type >,
|
&move< std::remove_reference_t< Value > >,
|
||||||
boost::ref( store( std::move( v ) ) ) ) );
|
boost::ref( store( std::move( v ) ) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,12 +125,7 @@ namespace detail
|
||||||
template< typename T >
|
template< typename T >
|
||||||
struct value_imp : value
|
struct value_imp : value
|
||||||
{
|
{
|
||||||
typedef
|
typedef std::remove_const_t<std::remove_reference_t<T>> value_type;
|
||||||
typename boost::remove_const<
|
|
||||||
typename boost::remove_reference<
|
|
||||||
T
|
|
||||||
>::type
|
|
||||||
>::type value_type;
|
|
||||||
|
|
||||||
value_imp( value_type&& t )
|
value_imp( value_type&& t )
|
||||||
: t_( std::move( t ) )
|
: t_( std::move( t ) )
|
||||||
|
|
@ -159,7 +153,7 @@ namespace detail
|
||||||
return static_cast< value_imp< T >& >( *v_ ).t_;
|
return static_cast< value_imp< T >& >( *v_ ).t_;
|
||||||
}
|
}
|
||||||
template< typename T >
|
template< typename T >
|
||||||
typename boost::remove_reference< Result >::type& store( T* t )
|
std::remove_reference_t< Result >& store( T* t )
|
||||||
{
|
{
|
||||||
v_.reset( new value_imp< Result >( t ) );
|
v_.reset( new value_imp< Result >( t ) );
|
||||||
return static_cast< value_imp< Result >& >( *v_ ).t_;
|
return static_cast< value_imp< Result >& >( *v_ ).t_;
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,11 @@
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include <boost/function_types/is_callable_builtin.hpp>
|
#include <boost/function_types/is_callable_builtin.hpp>
|
||||||
#include <boost/type_traits/detail/yes_no_type.hpp>
|
|
||||||
#include <boost/utility/declval.hpp>
|
#include <boost/utility/declval.hpp>
|
||||||
#include <boost/mpl/has_xxx.hpp>
|
#include <boost/mpl/has_xxx.hpp>
|
||||||
#include <boost/mpl/or.hpp>
|
#include <boost/mpl/or.hpp>
|
||||||
|
#include <boost/type_traits/make_void.hpp>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
@ -24,33 +25,18 @@ namespace detail
|
||||||
BOOST_MPL_HAS_XXX_TEMPLATE_DEF( sig )
|
BOOST_MPL_HAS_XXX_TEMPLATE_DEF( sig )
|
||||||
BOOST_MPL_HAS_XXX_TEMPLATE_DEF( result )
|
BOOST_MPL_HAS_XXX_TEMPLATE_DEF( result )
|
||||||
|
|
||||||
#ifdef MOCK_DECLTYPE
|
template< typename F, typename P, class = void >
|
||||||
|
struct is_callable : std::false_type
|
||||||
|
{};
|
||||||
template< typename F, typename P >
|
template< typename F, typename P >
|
||||||
struct is_callable
|
struct is_callable< F, P, boost::void_t<decltype( std::declval<F>()( std::declval<P>() ) )> >: std::true_type
|
||||||
{
|
{};
|
||||||
typedef boost::type_traits::yes_type yes_type;
|
|
||||||
typedef boost::type_traits::no_type no_type;
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
static yes_type check(
|
|
||||||
decltype( boost::declval< T >()( boost::declval< P >() ) )* );
|
|
||||||
template< typename T >
|
|
||||||
static no_type check( ... );
|
|
||||||
|
|
||||||
typedef boost::mpl::bool_<
|
|
||||||
sizeof( check< F >( 0 ) ) == sizeof( yes_type ) > type;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MOCK_DECLTYPE
|
|
||||||
|
|
||||||
template< typename T, typename P >
|
template< typename T, typename P >
|
||||||
struct is_functor
|
struct is_functor
|
||||||
: boost::mpl::or_<
|
: boost::mpl::or_<
|
||||||
boost::function_types::is_callable_builtin< T >,
|
boost::function_types::is_callable_builtin< T >,
|
||||||
#ifdef MOCK_DECLTYPE
|
|
||||||
is_callable< T, P >,
|
is_callable< T, P >,
|
||||||
#endif
|
|
||||||
has_result_type< T >,
|
has_result_type< T >,
|
||||||
has_result< T >,
|
has_result< T >,
|
||||||
has_sig< T >
|
has_sig< T >
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,18 @@
|
||||||
#ifndef MOCK_MOVE_HELPER_HPP_INCLUDED
|
#ifndef MOCK_MOVE_HELPER_HPP_INCLUDED
|
||||||
#define MOCK_MOVE_HELPER_HPP_INCLUDED
|
#define MOCK_MOVE_HELPER_HPP_INCLUDED
|
||||||
|
|
||||||
#include <boost/type_traits/conditional.hpp>
|
#include <type_traits>
|
||||||
#include <boost/type_traits/is_reference.hpp>
|
|
||||||
#include <boost/type_traits/add_rvalue_reference.hpp>
|
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template< typename T >
|
template< typename T >
|
||||||
struct ref_arg
|
using ref_arg = std::conditional<
|
||||||
{
|
std::is_reference< T >::value,
|
||||||
typedef typename boost::conditional<
|
|
||||||
boost::is_reference< T >::value,
|
|
||||||
T,
|
T,
|
||||||
typename boost::add_rvalue_reference< T >::type >::type type;
|
std::add_rvalue_reference_t< T >
|
||||||
};
|
>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "stream.hpp"
|
#include "stream.hpp"
|
||||||
#include "format.hpp"
|
#include "format.hpp"
|
||||||
#include <boost/utility/enable_if.hpp>
|
|
||||||
#include <boost/detail/container_fwd.hpp>
|
#include <boost/detail/container_fwd.hpp>
|
||||||
#include <boost/function_types/is_callable_builtin.hpp>
|
#include <boost/function_types/is_callable_builtin.hpp>
|
||||||
#include <boost/none.hpp>
|
#include <boost/none.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
@ -181,19 +181,19 @@ namespace detail
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
typename boost::enable_if<
|
std::enable_if_t<
|
||||||
boost::function_types::is_callable_builtin< T >,
|
boost::function_types::is_callable_builtin< T >::value,
|
||||||
stream&
|
stream&
|
||||||
>::type
|
>
|
||||||
operator<<( stream& s, T* )
|
operator<<( stream& s, T* )
|
||||||
{
|
{
|
||||||
return s << '?';
|
return s << '?';
|
||||||
}
|
}
|
||||||
template< typename T >
|
template< typename T >
|
||||||
typename boost::disable_if<
|
std::enable_if_t<
|
||||||
boost::function_types::is_callable_builtin< T >,
|
!boost::function_types::is_callable_builtin< T >::value,
|
||||||
stream&
|
stream&
|
||||||
>::type
|
>
|
||||||
operator<<( stream& s, T* t )
|
operator<<( stream& s, T* t )
|
||||||
{
|
{
|
||||||
*s.s_ << t;
|
*s.s_ << t;
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,9 @@
|
||||||
#include "constraints.hpp"
|
#include "constraints.hpp"
|
||||||
#include "detail/is_functor.hpp"
|
#include "detail/is_functor.hpp"
|
||||||
#include "detail/move_helper.hpp"
|
#include "detail/move_helper.hpp"
|
||||||
#include <boost/utility/enable_if.hpp>
|
|
||||||
#include <boost/type_traits/add_reference.hpp>
|
|
||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
@ -28,7 +27,7 @@ namespace mock
|
||||||
explicit matcher( Expected expected )
|
explicit matcher( Expected expected )
|
||||||
: expected_( expected )
|
: expected_( expected )
|
||||||
{}
|
{}
|
||||||
bool operator()( typename boost::add_reference< const Actual >::type actual )
|
bool operator()( std::add_lvalue_reference_t< const Actual > actual )
|
||||||
{
|
{
|
||||||
return mock::equal(
|
return mock::equal(
|
||||||
boost::unwrap_ref( expected_ ) ).c_( actual );
|
boost::unwrap_ref( expected_ ) ).c_( actual );
|
||||||
|
|
@ -84,9 +83,9 @@ namespace mock
|
||||||
|
|
||||||
template< typename Actual, typename Functor >
|
template< typename Actual, typename Functor >
|
||||||
class matcher< Actual, Functor,
|
class matcher< Actual, Functor,
|
||||||
typename boost::enable_if<
|
std::enable_if_t<
|
||||||
detail::is_functor< Functor, Actual >
|
detail::is_functor< Functor, Actual >::value
|
||||||
>::type
|
>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
struct T : mock::object
|
struct T : mock::object
|
||||||
|
|
||||||
#define MOCK_FUNCTION_TYPE(S, tpn) \
|
#define MOCK_FUNCTION_TYPE(S, tpn) \
|
||||||
tpn boost::remove_pointer< tpn BOOST_IDENTITY_TYPE(S) >::type
|
std::remove_pointer_t< tpn BOOST_IDENTITY_TYPE(S) >
|
||||||
|
|
||||||
#ifdef MOCK_VARIADIC_MACROS
|
#ifdef MOCK_VARIADIC_MACROS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,9 @@
|
||||||
#include "detail/type_name.hpp"
|
#include "detail/type_name.hpp"
|
||||||
#include "detail/object_impl.hpp"
|
#include "detail/object_impl.hpp"
|
||||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||||
#include <boost/type_traits/is_base_of.hpp>
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
|
|
@ -36,9 +35,7 @@ namespace detail
|
||||||
boost::unit_test::const_string instance,
|
boost::unit_test::const_string instance,
|
||||||
boost::optional< type_name > type,
|
boost::optional< type_name > type,
|
||||||
boost::unit_test::const_string name,
|
boost::unit_test::const_string name,
|
||||||
typename boost::disable_if<
|
std::enable_if_t< !std::is_base_of< object, T >::value >* = 0 )
|
||||||
typename boost::is_base_of< object, T >
|
|
||||||
>::type* = 0 )
|
|
||||||
{
|
{
|
||||||
e.configure( detail::root, &t, instance, type, name );
|
e.configure( detail::root, &t, instance, type, name );
|
||||||
return e;
|
return e;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
||||||
|
|
@ -23,14 +24,10 @@ namespace
|
||||||
{
|
{
|
||||||
boost::function< void() > static_f;
|
boost::function< void() > static_f;
|
||||||
|
|
||||||
BOOST_MPL_ASSERT((
|
static_assert( std::is_same< void, boost::result_of< mock::detail::function< void() >() >::type >::value, "!");
|
||||||
boost::is_same< void, boost::result_of< mock::detail::function< void() >() >::type > ));
|
static_assert( std::is_same< int, boost::result_of< mock::detail::function< int() >() >::type >::value, "!");
|
||||||
BOOST_MPL_ASSERT((
|
static_assert( std::is_same< void, boost::result_of< mock::detail::function< void( float ) >( float ) >::type >::value, "!");
|
||||||
boost::is_same< int, boost::result_of< mock::detail::function< int() >() >::type > ));
|
static_assert( std::is_same< int, boost::result_of< mock::detail::function< int( float ) >( float ) >::type >::value, "!");
|
||||||
BOOST_MPL_ASSERT((
|
|
||||||
boost::is_same< void, boost::result_of< mock::detail::function< void( float ) >( float ) >::type > ));
|
|
||||||
BOOST_MPL_ASSERT((
|
|
||||||
boost::is_same< int, boost::result_of< mock::detail::function< int( float ) >( float ) >::type > ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// functor
|
// functor
|
||||||
|
|
|
||||||
|
|
@ -143,11 +143,7 @@ BOOST_AUTO_TEST_CASE( class_with_sig_is_functor )
|
||||||
BOOST_AUTO_TEST_CASE( cxx11_lambda_is_functor )
|
BOOST_AUTO_TEST_CASE( cxx11_lambda_is_functor )
|
||||||
{
|
{
|
||||||
is_not_functor( []() {} );
|
is_not_functor( []() {} );
|
||||||
#ifdef MOCK_DECLTYPE
|
|
||||||
is_functor( []( int ) {} );
|
is_functor( []( int ) {} );
|
||||||
#else
|
|
||||||
is_not_functor( []( int ) {} );
|
|
||||||
#endif
|
|
||||||
is_not_functor( []( const std::string&, int ) {} );
|
is_not_functor( []( const std::string&, int ) {} );
|
||||||
is_not_functor( []( int, const std::string& ) {} );
|
is_not_functor( []( int, const std::string& ) {} );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <turtle/detail/signature.hpp>
|
#include <turtle/detail/signature.hpp>
|
||||||
#include <boost/test/auto_unit_test.hpp>
|
#include <boost/test/auto_unit_test.hpp>
|
||||||
#include <boost/mpl/assert.hpp>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -22,8 +22,6 @@ namespace
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE( mock_signature_generates_signature )
|
BOOST_AUTO_TEST_CASE( mock_signature_generates_signature )
|
||||||
{
|
{
|
||||||
BOOST_MPL_ASSERT((
|
static_assert( std::is_same< void(), MOCK_SIGNATURE(method_1) >::value, "!");
|
||||||
boost::is_same< void(), MOCK_SIGNATURE(method_1) > ));
|
static_assert( std::is_same< float( int ), MOCK_SIGNATURE(method_2) >::value, "!");
|
||||||
BOOST_MPL_ASSERT((
|
|
||||||
boost::is_same< float( int ), MOCK_SIGNATURE(method_2) > ));
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue