Remove MOCK_(CONST_)_METHOD_EXT detail macros

This commit is contained in:
Alexander Grund 2025-04-20 18:32:46 +02:00
parent f6200f9024
commit dd5f7552b3
2 changed files with 12 additions and 13 deletions

View file

@ -80,9 +80,6 @@ namespace mock { namespace detail {
MOCK_PP_TUPLE_FOR_EACH(MOCK_METHOD_ITER, (name, arity, signature, identifier), qualifiers) \ MOCK_PP_TUPLE_FOR_EACH(MOCK_METHOD_ITER, (name, arity, signature, identifier), qualifiers) \
MOCK_METHOD_HELPER(signature, identifier) MOCK_METHOD_HELPER(signature, identifier)
#define MOCK_CONST_METHOD_EXT(M, n, S, t) MOCK_METHOD_EXT(M, n, S, t, (const))
#define MOCK_NON_CONST_METHOD_EXT(M, n, S, t) MOCK_METHOD_EXT(M, n, S, t, ())
#define MOCK_FUNCTION_HELPER(signature, identifier, prefix) \ #define MOCK_FUNCTION_HELPER(signature, identifier, prefix) \
prefix mock::detail::function<signature>& identifier##_mock(mock::detail::context& context, \ prefix mock::detail::function<signature>& identifier##_mock(mock::detail::context& context, \
boost::unit_test::const_string instance) \ boost::unit_test::const_string instance) \

View file

@ -87,19 +87,21 @@
/// The 'signature' can be omitted if it can be uniquely identified from the base class /// The 'signature' can be omitted if it can be uniquely identified from the base class
/// if 'identifier' is omitted it will default to 'name' /// if 'identifier' is omitted it will default to 'name'
#define MOCK_CONST_METHOD(M, ...) \ #define MOCK_CONST_METHOD(M, ...) \
MOCK_CONST_METHOD_EXT(M, \ MOCK_METHOD_EXT(M, \
BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \ BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \
BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \ BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \
BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, )) BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, ), \
(const))
/// MOCK_NON_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) /// MOCK_NON_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] )
/// generates only the non-const version of the method /// generates only the non-const version of the method
/// The 'signature' can be omitted if it can be uniquely identified from the base class /// The 'signature' can be omitted if it can be uniquely identified from the base class
/// if 'identifier' is omitted it will default to 'name' /// if 'identifier' is omitted it will default to 'name'
#define MOCK_NON_CONST_METHOD(M, ...) \ #define MOCK_NON_CONST_METHOD(M, ...) \
MOCK_NON_CONST_METHOD_EXT(M, \ MOCK_METHOD_EXT(M, \
BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \ BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \
BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \ BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \
BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, )) BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, ), \
())
/// MOCK_FUNCTION( [calling convention] name, arity, signature[, identifier] ) /// MOCK_FUNCTION( [calling convention] name, arity, signature[, identifier] )
/// if 'identifier' is omitted it will default to 'name' /// if 'identifier' is omitted it will default to 'name'