Added support for mock::verify and mock::reset for functors

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@408 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2012-01-16 11:02:34 +00:00
parent 7fb0b814b3
commit 96ad4b068b
2 changed files with 25 additions and 0 deletions

View file

@ -280,6 +280,17 @@ namespace mock
boost::shared_ptr< function_impl > impl_; boost::shared_ptr< function_impl > impl_;
}; };
template< typename Signature >
bool verify( const function< Signature >& f )
{
return f.verify();
}
template< typename Signature >
void reset( function< Signature >& f )
{
f.reset();
}
} }
#endif // MOCK_FUNCTION_HPP_INCLUDED #endif // MOCK_FUNCTION_HPP_INCLUDED

View file

@ -253,6 +253,20 @@ BOOST_AUTO_TEST_CASE( mock_functor )
MOCK_FUNCTOR( f2, int( const std::string& ) ); MOCK_FUNCTOR( f2, int( const std::string& ) );
} }
BOOST_AUTO_TEST_CASE( mock_functor_reset )
{
MOCK_FUNCTOR( f, void() );
MOCK_RESET( f );
mock::reset( f );
}
BOOST_AUTO_TEST_CASE( mock_functor_verify )
{
MOCK_FUNCTOR( f, void() );
MOCK_VERIFY( f );
mock::verify( f );
}
BOOST_AUTO_TEST_CASE( mock_functor_is_named ) BOOST_AUTO_TEST_CASE( mock_functor_is_named )
{ {
MOCK_FUNCTOR( f, void() ); MOCK_FUNCTOR( f, void() );