mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Remove support for auto_ptr
This commit is contained in:
parent
c7873cde4b
commit
cf5ac87499
7 changed files with 0 additions and 150 deletions
|
|
@ -13,7 +13,6 @@ else()
|
|||
endif()
|
||||
|
||||
option(TURTLE_INSTALL "Enable to add install target" ${IS_ROOT_PROJECT})
|
||||
option(TURTLE_AUTO_PTR "Enable support for auto_ptr" OFF)
|
||||
|
||||
# Default boost libs are static on windows and dynamic on linux
|
||||
if(WIN32 AND NOT DEFINED Boost_USE_STATIC_LIBS)
|
||||
|
|
@ -30,9 +29,6 @@ target_include_directories(turtle INTERFACE $<BUILD_INTERFACE:include;${CMAKE_CU
|
|||
target_compile_features(turtle INTERFACE cxx_std_14)
|
||||
|
||||
target_link_libraries(turtle INTERFACE Boost::boost Boost::disable_autolinking)
|
||||
if(NOT TURTLE_AUTO_PTR)
|
||||
target_compile_definitions(turtle INTERFACE MOCK_NO_AUTO_PTR)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
|
|
|
|||
|
|
@ -32,12 +32,6 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_AUTO_PTR)
|
||||
# ifndef MOCK_NO_AUTO_PTR
|
||||
# define MOCK_AUTO_PTR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_uncaught_exceptions) || \
|
||||
defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||
# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
||||
|
|
|
|||
|
|
@ -144,34 +144,6 @@ namespace detail
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef MOCK_AUTO_PTR
|
||||
template< typename Result, typename Signature >
|
||||
class action< std::auto_ptr< Result >, Signature >
|
||||
: public action_base< std::auto_ptr< Result >, Signature >
|
||||
{
|
||||
public:
|
||||
template< typename Y >
|
||||
void returns( Y* r )
|
||||
{
|
||||
v_.reset( r );
|
||||
this->set( std::ref( v_ ) );
|
||||
}
|
||||
template< typename Y >
|
||||
void returns( std::auto_ptr< Y > r )
|
||||
{
|
||||
v_ = r;
|
||||
this->set( std::ref( v_ ) );
|
||||
}
|
||||
template< typename Y >
|
||||
void returns( const std::reference_wrapper< Y >& r )
|
||||
{
|
||||
this->set( r );
|
||||
}
|
||||
|
||||
private:
|
||||
mutable std::auto_ptr< Result > v_;
|
||||
};
|
||||
#endif // MOCK_AUTO_PTR
|
||||
}
|
||||
} // mock
|
||||
|
||||
|
|
|
|||
|
|
@ -61,14 +61,6 @@ namespace detail
|
|||
{};
|
||||
}
|
||||
|
||||
#ifdef MOCK_AUTO_PTR
|
||||
template< typename T >
|
||||
stream& operator<<( stream& s, const std::auto_ptr< T >& t )
|
||||
{
|
||||
return s << mock::format( t.get() );
|
||||
}
|
||||
#endif // MOCK_AUTO_PTR
|
||||
|
||||
template< typename T1, typename T2 >
|
||||
stream& operator<<( stream& s, const std::pair< T1, T2 >& p )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -505,78 +505,6 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
#ifdef MOCK_AUTO_PTR
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_auto_ptr_value, mock_error_fixture )
|
||||
{
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< int >() > f;
|
||||
std::auto_ptr< int > ptr( new int( 3 ) );
|
||||
f.expect().returns( std::ref( ptr ) );
|
||||
BOOST_CHECK_EQUAL( 3, *ptr );
|
||||
BOOST_CHECK_EQUAL( 3, *f() );
|
||||
BOOST_CHECK( ! ptr.get() );
|
||||
BOOST_CHECK( ! f().get() );
|
||||
CHECK_CALLS( 2 );
|
||||
}
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< int >() > f;
|
||||
std::auto_ptr< int > ptr( new int( 3 ) );
|
||||
f.expect().returns( ptr );
|
||||
BOOST_CHECK( ! ptr.get() );
|
||||
BOOST_CHECK_EQUAL( 3, *f() );
|
||||
BOOST_CHECK( ! f().get() );
|
||||
CHECK_CALLS( 2 );
|
||||
}
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< int >() > f;
|
||||
f.expect().returns( new int( 3 ) );
|
||||
BOOST_CHECK_EQUAL( 3, *f() );
|
||||
BOOST_CHECK( ! f().get() );
|
||||
CHECK_CALLS( 2 );
|
||||
}
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< int >() > f;
|
||||
f.expect().once().returns( new int( 1 ) );
|
||||
f.expect().once().returns( new int( 2 ) );
|
||||
f.expect().once().returns( new int( 3 ) );
|
||||
f.expect().returns( new int( 4 ) );
|
||||
BOOST_CHECK_EQUAL( 1, *f() );
|
||||
BOOST_CHECK_EQUAL( 2, *f() );
|
||||
BOOST_CHECK_EQUAL( 3, *f() );
|
||||
BOOST_CHECK_EQUAL( 4, *f() );
|
||||
BOOST_CHECK( ! f().get() );
|
||||
CHECK_CALLS( 5 );
|
||||
}
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< int >() > f;
|
||||
f.expect().returns( std::auto_ptr< int >( new int( 3 ) ) );
|
||||
BOOST_CHECK_EQUAL( 3, *f() );
|
||||
BOOST_CHECK( ! f().get() );
|
||||
CHECK_CALLS( 2 );
|
||||
}
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< base >() > f;
|
||||
f.expect().returns( new derived );
|
||||
BOOST_CHECK_NO_THROW( f() );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< base >() > f;
|
||||
f.expect().returns( std::auto_ptr< base >( new derived ) );
|
||||
BOOST_CHECK_NO_THROW( f() );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
{
|
||||
mock::detail::function< std::auto_ptr< base >() > f;
|
||||
f.expect().returns( std::auto_ptr< derived >( new derived ) );
|
||||
BOOST_CHECK_NO_THROW( f() );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MOCK_AUTO_PTR
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_moves_the_set_lvalue, mock_error_fixture )
|
||||
{
|
||||
mock::detail::function< int() > f;
|
||||
|
|
|
|||
|
|
@ -393,16 +393,6 @@ BOOST_AUTO_TEST_CASE( std_pairs_are_serialized )
|
|||
BOOST_CHECK_EQUAL( "(3,42)", to_string( std::make_pair( 3, 42.f ) ) );
|
||||
}
|
||||
|
||||
#ifdef MOCK_AUTO_PTR
|
||||
|
||||
BOOST_AUTO_TEST_CASE( std_auto_ptr_are_serialized )
|
||||
{
|
||||
BOOST_CHECK_NE( "?", to_string( std::auto_ptr< int >() ) );
|
||||
BOOST_CHECK_NE( "?", to_string( std::auto_ptr< int >( new int( 42 ) ) ) );
|
||||
}
|
||||
|
||||
#endif // MOCK_AUTO_PTR
|
||||
|
||||
BOOST_AUTO_TEST_CASE( boost_shared_ptr_are_serialized )
|
||||
{
|
||||
BOOST_CHECK_NE( "?", to_string( boost::shared_ptr< int >() ) );
|
||||
|
|
|
|||
|
|
@ -207,28 +207,6 @@ BOOST_FIXTURE_TEST_CASE( mock_object_is_named, mock_error_fixture )
|
|||
BOOST_CHECK_EQUAL( "m.my_mock::my_method", to_string( MOCK_HELPER( m.my_method ) ) );
|
||||
}
|
||||
|
||||
#ifdef MOCK_AUTO_PTR
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( mock_object_auto_pointer_is_named, mock_error_fixture )
|
||||
{
|
||||
std::auto_ptr< my_mock > m( new my_mock );
|
||||
BOOST_CHECK_EQUAL( "?.my_mock::my_method", to_string( MOCK_ANONYMOUS_HELPER( m->my_method ) ) );
|
||||
BOOST_CHECK_EQUAL( "m->my_mock::my_method", to_string( MOCK_HELPER( m->my_method ) ) );
|
||||
BOOST_CHECK_EQUAL( "m->my_mock::my_method", to_string( MOCK_ANONYMOUS_HELPER( m->my_method ) ) );
|
||||
BOOST_CHECK_EQUAL( "m->my_mock::my_method", to_string( MOCK_HELPER( m->my_method ) ) );
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( mock_object_const_auto_pointer_is_named, mock_error_fixture )
|
||||
{
|
||||
const std::auto_ptr< my_mock > m( new my_mock );
|
||||
BOOST_CHECK_EQUAL( "?.my_mock::my_method", to_string( MOCK_ANONYMOUS_HELPER( m->my_method ) ) );
|
||||
BOOST_CHECK_EQUAL( "m->my_mock::my_method", to_string( MOCK_HELPER( m->my_method ) ) );
|
||||
BOOST_CHECK_EQUAL( "m->my_mock::my_method", to_string( MOCK_ANONYMOUS_HELPER( m->my_method ) ) );
|
||||
BOOST_CHECK_EQUAL( "m->my_mock::my_method", to_string( MOCK_HELPER( m->my_method ) ) );
|
||||
}
|
||||
|
||||
#endif // MOCK_AUTO_PTR
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( mock_object_shared_pointer_is_named, mock_error_fixture )
|
||||
{
|
||||
std::shared_ptr< my_mock > m( new my_mock );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue