mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Merge pull request #35 from mat007/support-move-only-types-as-arguments
Support move only types as arguments
This commit is contained in:
commit
176b9bdc01
16 changed files with 250 additions and 62 deletions
|
|
@ -704,3 +704,56 @@ BOOST_FIXTURE_TEST_CASE( mock_method_accepts_polymorphic_multi_constraint, mock_
|
|||
m.m2( 1, 2 );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
|
||||
#ifdef MOCK_SMART_PTR
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( std_unique_ptr_argument_is_supported_in_action, mock_error_fixture )
|
||||
{
|
||||
MOCK_FUNCTOR( f, void( std::unique_ptr< int > ) );
|
||||
std::unique_ptr< int > p;
|
||||
MOCK_EXPECT( f ).once().calls(
|
||||
[]( std::unique_ptr< int > )
|
||||
{
|
||||
} );
|
||||
f( std::unique_ptr< int >( new int( 7 ) ) );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( std_unique_ptr_argument_is_supported_in_equal_constraint, mock_error_fixture )
|
||||
{
|
||||
{
|
||||
MOCK_FUNCTOR( f, void( std::unique_ptr< int > ) );
|
||||
MOCK_EXPECT( f ).once().with( mock::equal( 7 ) );
|
||||
f( std::unique_ptr< int >( new int( 7 ) ) );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
{
|
||||
MOCK_FUNCTOR( f, void( std::unique_ptr< int > ) );
|
||||
MOCK_EXPECT( f ).once().with( 7 );
|
||||
f( std::unique_ptr< int >( new int( 7 ) ) );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( std_unique_ptr_argument_is_supported_in_retrieve_constraint, mock_error_fixture )
|
||||
{
|
||||
{
|
||||
MOCK_FUNCTOR( f, void( std::unique_ptr< int > ) );
|
||||
MOCK_EXPECT( f ).once().with( nullptr );
|
||||
f( 0 );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
{
|
||||
std::unique_ptr< int > i;
|
||||
MOCK_FUNCTOR( f, void( std::unique_ptr< int > ) );
|
||||
MOCK_EXPECT( f ).once().with( mock::retrieve( i ) );
|
||||
std::unique_ptr< int > j( new int( 7 ) );
|
||||
f( std::move( j ) );
|
||||
BOOST_CHECK( !j );
|
||||
BOOST_REQUIRE( i );
|
||||
BOOST_CHECK_EQUAL( 7, *i );
|
||||
CHECK_CALLS( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue