mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Assume nullptr existance
This commit is contained in:
parent
cf330e8c86
commit
f678f4d91f
9 changed files with 7 additions and 65 deletions
|
|
@ -35,9 +35,7 @@ BOOST_AUTO_TEST_CASE( literal_zero )
|
|||
//[ limitations_literal_zero_solution_2
|
||||
MOCK_EXPECT( m.method ).with( mock::negate );
|
||||
//]
|
||||
#ifdef MOCK_NULLPTR
|
||||
//[ limitations_literal_zero_solution_3
|
||||
MOCK_EXPECT( m.method ).with( nullptr );
|
||||
//]
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,12 +40,6 @@
|
|||
# error BOOST_FT_MAX_ARITY must be set to MOCK_MAX_ARGS + 1 or higher
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR)
|
||||
# ifndef MOCK_NO_NULLPTR
|
||||
# define MOCK_NULLPTR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS)
|
||||
# ifndef MOCK_NO_VARIADIC_MACROS
|
||||
# define MOCK_VARIADIC_MACROS
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "config.hpp"
|
||||
#include "constraint.hpp"
|
||||
#include "detail/addressof.hpp"
|
||||
#include "detail/move_helper.hpp"
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
|
@ -21,6 +20,7 @@
|
|||
#else
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
#endif
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
namespace mock
|
||||
|
|
@ -161,12 +161,12 @@ namespace detail
|
|||
struct same
|
||||
{
|
||||
explicit same( const Expected& expected )
|
||||
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) )
|
||||
: expected_( std::addressof( boost::unwrap_ref( expected ) ) )
|
||||
{}
|
||||
template< typename Actual >
|
||||
bool operator()( const Actual& actual ) const
|
||||
{
|
||||
return detail::addressof( actual ) == expected_;
|
||||
return std::addressof( actual ) == expected_;
|
||||
}
|
||||
friend std::ostream& operator<<( std::ostream& os, const same& s )
|
||||
{
|
||||
|
|
@ -180,7 +180,7 @@ namespace detail
|
|||
struct retrieve
|
||||
{
|
||||
explicit retrieve( Expected& expected )
|
||||
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) )
|
||||
: expected_( std::addressof( boost::unwrap_ref( expected ) ) )
|
||||
{}
|
||||
template< typename Actual >
|
||||
bool operator()( const Actual& actual,
|
||||
|
|
@ -217,7 +217,7 @@ namespace detail
|
|||
>::value
|
||||
>* = 0 ) const
|
||||
{
|
||||
*expected_ = detail::addressof( actual );
|
||||
*expected_ = std::addressof( actual );
|
||||
return true;
|
||||
}
|
||||
friend std::ostream& operator<<( std::ostream& s, const retrieve& r )
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2013
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef MOCK_ADDRESSOF_HPP_INCLUDED
|
||||
#define MOCK_ADDRESSOF_HPP_INCLUDED
|
||||
|
||||
#include "../config.hpp"
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
using boost::addressof;
|
||||
|
||||
#ifdef MOCK_NULLPTR
|
||||
|
||||
inline const std::nullptr_t* addressof( const std::nullptr_t& p )
|
||||
{
|
||||
return &p;
|
||||
}
|
||||
inline std::nullptr_t* addressof( std::nullptr_t& p )
|
||||
{
|
||||
return &p;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_ADDRESSOF_HPP_INCLUDED
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "../config.hpp"
|
||||
#include "../stream.hpp"
|
||||
#include "addressof.hpp"
|
||||
#include <memory.h>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
|
|
@ -21,7 +21,7 @@ namespace detail
|
|||
struct formatter
|
||||
{
|
||||
explicit formatter( const T& t )
|
||||
: t_( detail::addressof( t ) )
|
||||
: t_( std::addressof( t ) )
|
||||
{}
|
||||
void serialize( stream& s ) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -173,12 +173,10 @@ namespace detail
|
|||
return s << '?';
|
||||
}
|
||||
|
||||
#ifdef MOCK_NULLPTR
|
||||
inline stream& operator<<( stream& s, std::nullptr_t )
|
||||
{
|
||||
return s << "nullptr";
|
||||
}
|
||||
#endif
|
||||
|
||||
template< typename T >
|
||||
std::enable_if_t<
|
||||
|
|
|
|||
|
|
@ -350,8 +350,6 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_with_failing_custom_constrain
|
|||
// CHECK_CALLS( 1 );
|
||||
//}
|
||||
|
||||
#ifdef MOCK_NULLPTR
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( nullptr_can_be_used_in_place_of_null_pointers_in_constraints, mock_error_fixture )
|
||||
{
|
||||
mock::detail::function< void( int* ) > f;
|
||||
|
|
@ -360,8 +358,6 @@ BOOST_FIXTURE_TEST_CASE( nullptr_can_be_used_in_place_of_null_pointers_in_constr
|
|||
CHECK_CALLS( 1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MOCK_SMART_PTR
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( unique_ptr_is_supported_as_parameter, mock_error_fixture )
|
||||
|
|
|
|||
|
|
@ -106,12 +106,10 @@ BOOST_AUTO_TEST_CASE( same_constraint )
|
|||
BOOST_CHECK( ! c.c_( j ) );
|
||||
BOOST_CHECK( c.c_( i ) );
|
||||
}
|
||||
#ifdef MOCK_NULLPTR
|
||||
{
|
||||
std::nullptr_t p;
|
||||
BOOST_CHECK( mock::same( p ).c_( p ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( assign_constraint )
|
||||
|
|
@ -245,14 +243,12 @@ BOOST_AUTO_TEST_CASE( retrieve_constraint )
|
|||
BOOST_CHECK( mock::retrieve( boost::ref( i ) ).c_( j ) );
|
||||
BOOST_CHECK_EQUAL( i, &j );
|
||||
}
|
||||
#ifdef MOCK_NULLPTR
|
||||
{
|
||||
std::nullptr_t* i = 0;
|
||||
std::nullptr_t j;
|
||||
BOOST_CHECK( mock::retrieve( i ).c_( j ) );
|
||||
BOOST_CHECK_EQUAL( i, &j );
|
||||
}
|
||||
#endif
|
||||
#ifdef MOCK_SMART_PTR
|
||||
{
|
||||
std::unique_ptr< int > i;
|
||||
|
|
|
|||
|
|
@ -665,15 +665,11 @@ BOOST_AUTO_TEST_CASE( boost_lambda_functor_yields_question_mark_when_serialized
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef MOCK_NULLPTR
|
||||
|
||||
BOOST_AUTO_TEST_CASE( nullptr_is_serialized )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( "nullptr", to_string( nullptr ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_AUTO_TEST_CASE( mock_boost_optional_yields_its_value_when_serialized )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( "7", to_string( boost::optional< int >( 7 ) ) );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue