Added move support in actions

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@681 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2013-08-13 21:43:14 +00:00
parent fc74b61817
commit 392240a87c
7 changed files with 126 additions and 18 deletions

View file

@ -555,6 +555,57 @@ BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_auto_ptr_valu
}
}
#ifdef MOCK_RVALUE_REFERENCES
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_moves_the_set_lvalue, error_fixture )
{
mock::detail::function< int() > f;
int i = 3;
f.expect().moves( i );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
}
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_moves_the_set_const_lvalue, error_fixture )
{
mock::detail::function< int() > f;
const int i = 3;
f.expect().moves( i );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
}
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_moves_the_set_rvalue, error_fixture )
{
mock::detail::function< int() > f;
f.expect().moves( 3 );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
}
#endif
#ifdef MOCK_SMART_PTR
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_moves_the_set_unique_ptr_lvalue, error_fixture )
{
mock::detail::function< std::unique_ptr< int >() > f;
std::unique_ptr< int > p( new int );
f.expect().moves( std::move( p ) );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
}
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_moves_the_set_unique_ptr_rvalue, error_fixture )
{
mock::detail::function< std::unique_ptr< int >() > f;
f.expect().moves( std::unique_ptr< int >( new int ) );
BOOST_CHECK_NO_THROW( f() );
CHECK_CALLS( 1 );
}
#endif // MOCK_SMART_PTR
BOOST_FIXTURE_TEST_CASE( triggering_an_expectation_returns_the_set_shared_ptr_value, error_fixture )
{
mock::detail::function< boost::shared_ptr< A >() > f;