mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added MOCK_FUNCTOR_TPL
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@608 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
3f9e9a78a7
commit
200e293b7f
4 changed files with 42 additions and 5 deletions
|
|
@ -3,10 +3,11 @@
|
|||
[section trunk]
|
||||
Not yet released
|
||||
|
||||
* Added variadic macro support for MOCK_FUNCTION and the MOCK_METHOD family
|
||||
* Added variadic macro support for MOCK_BASE_CLASS and MOCK_FUNCTOR
|
||||
* Added variadic macro support for MOCK_BASE_CLASS
|
||||
* Added variadic macro support for MOCK_FUNCTION, MOCK_FUNCTOR and the MOCK_METHOD family
|
||||
* Added round parenthesis support for signatures for MOCK_FUNCTION, MOCK_FUNCTOR and the MOCK_METHOD family
|
||||
* Added MOCK_CONVERSION_OPERATOR_TPL, MOCK_CONST_CONVERSION_OPERATOR_TPL and MOCK_NON_CONST_CONVERSION_OPERATOR_TPL
|
||||
* Added MOCK_FUNCTOR_TPL
|
||||
|
||||
[endsect]
|
||||
|
||||
|
|
|
|||
|
|
@ -343,6 +343,8 @@ Synopsis :
|
|||
|
||||
MOCK_FUNCTOR( name, signature );
|
||||
|
||||
MOCK_FUNCTOR_TPL( name, signature ); // must be used if the signature uses a template parameter
|
||||
|
||||
Example :
|
||||
|
||||
BOOST_AUTO_TEST_CASE( demonstrates_instantiating_a_mock_functor )
|
||||
|
|
@ -350,6 +352,23 @@ Example :
|
|||
MOCK_FUNCTOR( f, void( int ) );
|
||||
}
|
||||
|
||||
Example :
|
||||
|
||||
namespace
|
||||
{
|
||||
template< typename T >
|
||||
struct template_class
|
||||
{
|
||||
MOCK_FUNCTOR_TPL( f, void( T ) );
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( demonstrates_instantiating_a_mock_template_functor )
|
||||
{
|
||||
template_class< int > c;
|
||||
c.f( 3 );
|
||||
}
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Function]
|
||||
|
|
|
|||
|
|
@ -280,6 +280,15 @@ BOOST_AUTO_TEST_CASE( mock_functor )
|
|||
MOCK_FUNCTOR( f2, int( const std::string& ) );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template< typename T >
|
||||
struct tpl_functor_class
|
||||
{
|
||||
MOCK_FUNCTOR_TPL( f, void( T ) );
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( mock_functor_reset )
|
||||
{
|
||||
MOCK_FUNCTOR( f, void() );
|
||||
|
|
|
|||
|
|
@ -34,15 +34,23 @@
|
|||
|
||||
#define MOCK_BASE_CLASS(T, I) \
|
||||
struct T : I, mock::object, mock::detail::base< I >
|
||||
|
||||
#define MOCK_FUNCTOR(f, S) \
|
||||
mock::detail::functor< MOCK_FUNCTION_TYPE(S,) > f, f##_mock
|
||||
#define MOCK_FUNCTOR_TPL(f, S) \
|
||||
mock::detail::functor< \
|
||||
MOCK_FUNCTION_TYPE(S, BOOST_DEDUCED_TYPENAME) > f, f##_mock
|
||||
|
||||
#else // BOOST_NO_VARIADIC_MACROS
|
||||
|
||||
#define MOCK_BASE_CLASS(T, ...) \
|
||||
struct T : __VA_ARGS__, mock::object, mock::detail::base< __VA_ARGS__ >
|
||||
|
||||
#define MOCK_FUNCTOR(f, ...) \
|
||||
mock::detail::functor< MOCK_FUNCTION_TYPE((__VA_ARGS__),) > f, f##_mock
|
||||
#define MOCK_FUNCTOR_TPL(f, ...) \
|
||||
mock::detail::functor< \
|
||||
MOCK_FUNCTION_TYPE((__VA_ARGS__), BOOST_DEDUCED_TYPENAME) > f, f##_mock
|
||||
|
||||
#endif // BOOST_NO_VARIADIC_MACROS
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue