This commit is contained in:
Sebastian Krämer 2020-08-02 20:27:48 +02:00 committed by GitHub
commit 5e81b17319
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 356 additions and 16 deletions

View file

@ -9,6 +9,7 @@
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp>
#include "../../include/turtle/mock.hpp"
namespace class_example_1
{
@ -251,6 +252,38 @@ MOCK_CLASS( mock_class )
}
#endif
namespace member_function_example_11
{
//[ member_function_example_11
struct base_class
{
virtual ~base_class() = default;
virtual void method( float ) = 0;
};
MOCK_BASE_CLASS( mock_class, base_class )
{
MOCK_OVERRIDE_METHOD( method, 1 )
};
//]
}
namespace member_function_example_12
{
//[ member_function_example_12
struct base_class
{
virtual ~base_class() = default;
virtual void method( float ) noexcept = 0;
};
MOCK_BASE_CLASS( mock_class, base_class )
{
MOCK_NOEXCEPT_OVERRIDE_METHOD(method, 1 )
};
//]
}
namespace static_member_function_example_1
{
//[ static_member_function_example_1
@ -289,7 +322,7 @@ namespace constructor_example_1
//[ constructor_example_1
MOCK_CLASS( mock_class )
{
MOCK_CONSTRUCTOR( mock_class, 2, ( int, const std::string& ), identifier )
MOCK_CONSTRUCTOR( mock_class, 1, ( int, const std::string& ), identifier )
};
//]
}

View file

@ -87,13 +87,31 @@ Deriving from mock::object is optional but provides the additional following ben
Synopsis :
MOCK_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates both const and non-const methods
MOCK_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the const version of the method
MOCK_NON_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the non-const version of the method
MOCK_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods
MOCK_CONST_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method
MOCK_NON_CONST_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method
MOCK_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates both const and non-const methods
MOCK_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the const version of the method
MOCK_NON_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the non-const version of the method
MOCK_OVERRIDE_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates both const and non-const methods with override specifier
MOCK_CONST_OVERRIDE_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the const version of the method with override specifier
MOCK_NON_CONST_OVERRIDE_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the non-const version of the method with override specifier
MOCK_NOEXCEPT_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates both const and non-const methods with noexcept specifier
MOCK_CONST_NOEXCEPT_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the const version of the method with noexcept specifier
MOCK_NON_CONST_NOEXCEPT_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the non-const version of the method with noexcept specifier
MOCK_NOEXCEPT_OVERRID_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates both const and non-const methods with noexcept and override specifier
MOCK_CONST_NOEXCEPT_OVERRID_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the const version of the method with noexcept and override specifier
MOCK_NON_CONST_NOEXCEPT_OVERRID_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the non-const version of the method with noexcept and override specifier
MOCK_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods
MOCK_CONST_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method
MOCK_NON_CONST_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method
MOCK_OVERRIDE_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods with override specifier
MOCK_CONST_OVERRIDE_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method with override specifier
MOCK_NON_CONST_OVERRIDE_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method with override specifier
MOCK_NOEXCEPT_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods with noexcept specifier
MOCK_CONST_NOEXCEPT_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method with noexcept specifier
MOCK_NON_CONST_NOEXCEPT_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method with noexcept specifier
MOCK_NOEXCEPT_OVERRID_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods with noexcept and override specifier
MOCK_CONST_NOEXCEPT_OVERRID_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method with noexcept and override specifier
MOCK_NON_CONST_NOEXCEPT_OVERRID_METHOD_TPL( [calling convention] name, arity[, signature[, identifier]] ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method with noexcept and override specifier
[note If the identifier is omitted it will default to the method name.]
@ -109,13 +127,31 @@ Synopsis :
Synopsis :
MOCK_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods
MOCK_CONST_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the const version of the method
MOCK_NON_CONST_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the non-const version of the method
MOCK_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods
MOCK_CONST_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the const version of the method
MOCK_NON_CONST_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the non-const version of the method
MOCK_OVERRIDE_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods with override specifier
MOCK_CONST_OVERRIDE_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the const version of the method with override specifier
MOCK_NON_CONST_OVERRIDE_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the non-const version of the method with override specifier
MOCK_NOEXCEPT_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods with noexcept specifier
MOCK_CONST_NOEXCEPT_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the const version of the method with noexcept specifier
MOCK_NON_CONST_NOEXCEPT_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the non-const version of the method with noexcept specifier
MOCK_NOEXCEPT_OVERRID_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods with noexcept and override specifier
MOCK_CONST_NOEXCEPT_OVERRID_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the const version of the method with noexcept and override specifier
MOCK_NON_CONST_NOEXCEPT_OVERRID_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the non-const version of the method with noexcept and override specifier
MOCK_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods
MOCK_CONST_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method
MOCK_NON_CONST_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method
MOCK_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods
MOCK_CONST_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method
MOCK_NON_CONST_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method
MOCK_OVERRIDE_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods with override specifier
MOCK_CONST_OVERRIDE_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method with override specifier
MOCK_NON_CONST_OVERRIDE_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method with override specifier
MOCK_NOEXCEPT_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods with noexcept specifier
MOCK_CONST_NOEXCEPT_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method with noexcept specifier
MOCK_NON_CONST_NOEXCEPT_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method with noexcept specifier
MOCK_NOEXCEPT_OVERRID_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods with noexcept and override specifier
MOCK_CONST_NOEXCEPT_OVERRID_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method with noexcept and override specifier
MOCK_NON_CONST_NOEXCEPT_OVERRID_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method with noexcept and override specifier
Example :
@ -145,6 +181,14 @@ Example :
[member_function_example_8]
Example :
[member_function_example_11]
Example :
[member_function_example_12]
Example for msvc :
[member_function_example_9]
@ -159,9 +203,11 @@ Example for gcc :
Synopsis :
MOCK_STATIC_METHOD( [calling convention] name, arity, signature[, identifier] ) // if 'identifier' is omitted it will default to 'name'
MOCK_STATIC_METHOD( [calling convention] name, arity, signature[, identifier] ) // if 'identifier' is omitted it will default to 'name'
MOCK_STATIC_NOEXCEPT_METHOD( [calling convention] name, arity, signature[, identifier] ) // method is genereted with noexcept specifier, if 'identifier' is omitted it will default to 'name'
MOCK_STATIC_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, if 'identifier' is omitted it will default to 'name'
MOCK_STATIC_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, if 'identifier' is omitted it will default to 'name'
MOCK_STATIC_NOEXCEPT_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, method is generetet with noexcept specifier, if 'identifier' is omitted it will default to 'name'
[note A static object is used behind the scene in order to keep track of the expectations of a mock static method, therefore to ensure all tests run in isolation it is strongly suggested to manually [link turtle.reference.verification verify] and [link turtle.reference.reset reset] the static method at the end of each test, see the related [link turtle.patterns.managing_static_mock_objects pattern section].]
@ -272,6 +318,7 @@ Example for gcc :
Synopsis :
MOCK_FUNCTION( [calling convention] name, arity, signature[, identifier] ) // if 'identifier' is omitted it will default to 'name'
MOCK_NOEXCEPT_FUNCTION( [calling convention] name, arity, signature[, identifier] ) // function is genereted with noexcept specifier,if 'identifier' is omitted it will default to 'name'
[note A static object is used behind the scene in order to keep track of the expectations of a mock function, therefore to ensure all tests run in isolation it is strongly suggested to manually [link turtle.reference.verification verify] and [link turtle.reference.reset reset] the mock function at the end of each test, see the related [link turtle.patterns.managing_static_mock_objects pattern section].]

View file

@ -120,6 +120,83 @@
MOCK_METHOD_AUX(M, n, S, t,, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, override, typename) \
MOCK_METHOD_AUX(M, n, S, t, const override, typename) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_CONST_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, const override, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_NON_CONST_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, override, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_OVERRIDE_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, override,) \
MOCK_METHOD_AUX(M, n, S, t, const override,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_CONST_OVERRIDE_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, const override,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_NON_CONST_OVERRIDE_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, override,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, override, typename) \
MOCK_METHOD_AUX(M, n, S, t, const override, typename) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_CONST_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, const override, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_NON_CONST_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, override, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_NOEXCEPT_OVERRIDE_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept override,) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept override,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept override,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept override,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_NOEXCEPT_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept override, typename) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept override, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept override, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept override, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_NOEXCEPT_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept,) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_CONST_NOEXCEPT_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_NON_CONST_NOEXCEPT_METHOD_EXT(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept,) \
MOCK_METHOD_HELPER(S, t,)
#define MOCK_NOEXCEPT_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept, typename) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_CONST_NOEXCEPT_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, const noexcept, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_NON_CONST_NOEXCEPT_METHOD_EXT_TPL(M, n, S, t) \
MOCK_METHOD_AUX(M, n, S, t, noexcept, typename) \
MOCK_METHOD_HELPER(S, t, typename)
#define MOCK_CONVERSION_OPERATOR(M, T, t) \
M T() const { return MOCK_ANONYMOUS_HELPER(t)(); } \
M T() { return MOCK_ANONYMOUS_HELPER(t)(); } \
@ -177,6 +254,15 @@
return MOCK_HELPER(t)( MOCK_FORWARD_PARAMS(n, S, tpn) ); \
}
#define MOCK_FUNCTION_NOEXCEPT_AUX(F, n, S, t, s, tpn) \
MOCK_FUNCTION_HELPER(S, t, s, tpn) \
s MOCK_DECL(F, n, S, noexcept,tpn) \
{ \
BOOST_MPL_ASSERT_RELATION( n, ==, \
boost::function_types::function_arity< \
MOCK_FUNCTION_TYPE((S), tpn) >::value ); \
return MOCK_HELPER(t)( MOCK_FORWARD_PARAMS(n, S, tpn) ); \
}
#ifdef MOCK_VARIADIC_MACROS
#define MOCK_VARIADIC_ELEM_0(e0, ...) e0
@ -197,6 +283,48 @@
MOCK_VARIADIC_ELEM_0(__VA_ARGS__, ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M, ))
#define MOCK_NOEXCEPT_METHOD(M, ...) \
MOCK_NOEXCEPT_METHOD_EXT(M, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__ ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, MOCK_SIGNATURE(M)), \
MOCK_VARIADIC_ELEM_2(__VA_ARGS__, M, M))
#define MOCK_CONST_NOEXCEPT_METHOD(M, n, ...) \
MOCK_CONST_NOEXCEPT_METHOD_EXT(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NON_CONST_NOEXCEPT_METHOD(M, n, ...) \
MOCK_NON_CONST_NOEXCEPT_METHOD_EXT(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NOEXCEPT_OVERRIDE_METHOD(M, ...) \
MOCK_NOEXCEPT_OVERRIDE_METHOD_EXT(M, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__ ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, MOCK_SIGNATURE(M)), \
MOCK_VARIADIC_ELEM_2(__VA_ARGS__, M, M))
#define MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD(M, n, ...) \
MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD(M, n, ...) \
MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_OVERRIDE_METHOD(M, ...) \
MOCK_OVERRIDE_METHOD_EXT(M, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__ ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, MOCK_SIGNATURE(M)), \
MOCK_VARIADIC_ELEM_2(__VA_ARGS__, M, M))
#define MOCK_CONST_OVERRIDE_METHOD(M, n, ...) \
MOCK_CONST_OVERRIDE_METHOD_EXT(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NON_CONST_OVERRIDE_METHOD(M, n, ...) \
MOCK_NON_CONST_OVERRIDE_METHOD_EXT(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_METHOD_TPL(M, n, ...) \
MOCK_METHOD_EXT_TPL(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__, ), \
@ -210,12 +338,60 @@
MOCK_VARIADIC_ELEM_0(__VA_ARGS__, ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M, ))
#define MOCK_NOEXCEPT_METHOD_TPL(M, ...) \
MOCK_NOEXCEPT_METHOD_EXT_TPL(M, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__ ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, MOCK_SIGNATURE(M)), \
MOCK_VARIADIC_ELEM_2(__VA_ARGS__, M, M))
#define MOCK_CONST_NOEXCEPT_METHOD_TPL(M, n, ...) \
MOCK_CONST_NOEXCEPT_METHOD_EXT_TPL(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NON_CONST_NOEXCEPT_METHOD_TPL(M, n, ...) \
MOCK_NON_CONST_NOEXCEPT_METHOD_EXT_TPL(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NOEXCEPT_OVERRIDE_METHOD_TPL(M, ...) \
MOCK_NOEXCEPT_OVERRIDE_METHOD_EXT_TPL(M, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__ ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, MOCK_SIGNATURE(M)), \
MOCK_VARIADIC_ELEM_2(__VA_ARGS__, M, M))
#define MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD_TPL(M, n, ...) \
MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT_TPL(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD_TPL(M, n, ...) \
MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD_EXT_TPL(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_OVERRIDE_METHOD_TPL(M, ...) \
MOCK_OVERRIDE_METHOD_EXT_TPL(M, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__ ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, MOCK_SIGNATURE(M)), \
MOCK_VARIADIC_ELEM_2(__VA_ARGS__, M, M))
#define MOCK_CONST_OVERRIDE_METHOD_TPL(M, n, ...) \
MOCK_CONST_OVERRIDE_METHOD_EXT_TPL(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_NON_CONST_OVERRIDE_METHOD_TPL(M, n, ...) \
MOCK_NON_CONST_OVERRIDE_METHOD_EXT_TPL(M, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, M))
#define MOCK_FUNCTION(F, n, ...) \
MOCK_FUNCTION_AUX(F, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__, ), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, F, ), \
inline,)
#define MOCK_NOEXCEPT_FUNCTION(F, n, ...) \
MOCK_FUNCTION_NOEXCEPT_AUX(F, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, F), \
inline,)
#define MOCK_STATIC_METHOD(F, n, ...) \
MOCK_FUNCTION_AUX(F, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__, ), \
@ -228,6 +404,17 @@
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, F, ), \
static, typename)
#define MOCK_STATIC_NOEXCEPT_METHOD(F, n, ...) \
MOCK_FUNCTION_NOEXCEPT_AUX(F, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, F), \
static,)
#define MOCK_STATIC_NOEXCEPT_METHOD_TPL(F, n, ...) \
MOCK_FUNCTION_NOEXCEPT_AUX(F, n, \
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, F), \
static, typename)
#else // MOCK_VARIADIC_MACROS
#define MOCK_METHOD(M, n) \

View file

@ -366,6 +366,20 @@ namespace
{}
virtual void m1() = 0;
virtual void m10() = 0;
virtual void m10() const = 0;
virtual void m11() = 0;
virtual void m11() const = 0;
virtual void m12() = 0;
virtual void m12() const= 0;
virtual void m30() noexcept = 0;
virtual void m30() const noexcept = 0;
virtual void m31() noexcept = 0;
virtual void m31() const noexcept = 0;
virtual void m32() noexcept = 0;
virtual void m32() const noexcept = 0;
};
MOCK_BASE_CLASS( variadic, base )
@ -379,6 +393,36 @@ namespace
MOCK_NON_CONST_METHOD( m7, 0, void(), m7 )
MOCK_STATIC_METHOD( m8, 0, void() )
MOCK_STATIC_METHOD( m9, 0, void(), m9 )
MOCK_STATIC_NOEXCEPT_METHOD( mA 0, void() )
MOCK_STATIC_NOEXCEPT_METHOD( mB, 0, void(), mB )
MOCK_OVERRIDE_METHOD( m11, 0 )
MOCK_OVERRIDE_METHOD( m12, 0, void() )
MOCK_OVERRIDE_METHOD( m13, 0, void(), m13 )
MOCK_CONST_OVERRIDE_METHOD( m14, 0, void() )
MOCK_CONST_OVERRIDE_METHOD( m15, 0, void(), m15 )
MOCK_NON_CONST_OVERRIDE_METHOD( m16, 0, void() )
MOCK_NON_CONST_OVERRIDE_METHOD( m17, 0, void(), m17 )
MOCK_NOEXCEPT_METHOD( m21, 0 )
MOCK_NOEXCEPT_METHOD( m22, 0, void() )
MOCK_NOEXCEPT_METHOD( m23, 0, void(), m23 )
MOCK_CONST_NOEXCEPT_METHOD( m24, 0, void() )
MOCK_CONST_NOEXCEPT_METHOD( m25, 0, void(), m25 )
MOCK_NON_CONST_NOEXCEPT_METHOD( m26, 0, void() )
MOCK_NON_CONST_NOEXCEPT_METHOD( m27, 0, void(), m27 )
MOCK_STATIC_METHOD( m28, 0, void() )
MOCK_STATIC_METHOD( m29, 0, void(), m9 )
MOCK_STATIC_NOEXCEPT_METHOD( m2A 0, void() )
MOCK_STATIC_NOEXCEPT_METHOD( m2B, 0, void(), m2B )
MOCK_NOEXCEPT_OVERRIDE_METHOD( m31, 0 )
MOCK_NOEXCEPT_OVERRIDE_METHOD( m32, 0, void() )
MOCK_NOEXCEPT_OVERRIDE_METHOD( m33, 0, void(), m33 )
MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD( m34, 0, void() )
MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD( m35, 0, void(), m35 )
MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD( m36, 0, void() )
MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD( m37, 0, void(), m37 )
};
template< typename T >
@ -393,6 +437,32 @@ namespace
MOCK_NON_CONST_METHOD_TPL( m7, 0, T(), m7 )
MOCK_STATIC_METHOD_TPL( m8, 0, T() )
MOCK_STATIC_METHOD_TPL( m9, 0, T(), m9 )
MOCK_OVERRIDE_METHOD_TPL( m11, 0 )
MOCK_OVERRIDE_METHOD_TPL( m12, 0, void() )
MOCK_OVERRIDE_METHOD_TPL( m13, 0, void(), m13 )
MOCK_CONST_OVERRIDE_METHOD_TPL( m14, 0, void() )
MOCK_CONST_OVERRIDE_METHOD_TPL( m15, 0, void(), m15 )
MOCK_NON_CONST_OVERRIDE_METHOD_TPL( m16, 0, void() )
MOCK_NON_CONST_OVERRIDE_METHOD_TPL( m17, 0, void(), m17 )
MOCK_NOEXCEPT_METHOD_TPL( m21, 0 )
MOCK_NOEXCEPT_METHOD_TPL( m22, 0, void() )
MOCK_NOEXCEPT_METHOD_TPL( m23, 0, void(), m23 )
MOCK_CONST_NOEXCEPT_METHOD_TPL( m24, 0, void() )
MOCK_CONST_NOEXCEPT_METHOD_TPL( m25, 0, void(), m25 )
MOCK_NON_CONST_NOEXCEPT_METHOD_TPL( m26, 0, void() )
MOCK_NON_CONST_NOEXCEPT_METHOD_TPL( m27, 0, void(), m27 )
MOCK_STATIC_NOEXCEPT_METHOD_TPL( m28, 0, void() )
MOCK_STATIC_NOEXCEPT_METHOD_TPL( m29, 0, void(), m9 )
MOCK_NOEXCEPT_OVERRIDE_METHOD_TPL( m31, 0 )
MOCK_NOEXCEPT_OVERRIDE_METHOD_TPL( m32, 0, void() )
MOCK_NOEXCEPT_OVERRIDE_METHOD_TPL( m33, 0, void(), m33 )
MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD_TPL( m34, 0, void() )
MOCK_CONST_NOEXCEPT_OVERRIDE_METHOD_TPL( m35, 0, void(), m35 )
MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD_TPL( m36, 0, void() )
MOCK_NON_CONST_NOEXCEPT_OVERRIDE_METHOD_TPL( m37, 0, void(), m37 )
};
MOCK_BASE_CLASS( comma_base, std::map< int, int > )
@ -401,6 +471,9 @@ namespace
MOCK_FUNCTION( fun1, 0, void() )
MOCK_FUNCTION( fun2, 0, void(), fun2 )
MOCK_FUNCTION( fun3, 0, BOOST_IDENTITY_TYPE((std::map< int, int >())) )
MOCK_NOEXCEPT_FUNCTION( fun4, 0, void() )
MOCK_NOEXCEPT_FUNCTION( fun5, 0, void(), fun2 )
MOCK_NOEXCEPT_FUNCTION( fun6, 0, BOOST_IDENTITY_TYPE((std::map< int, int >())) )
MOCK_FUNCTOR( f_variadic, std::map< int, int >() );
}