From dd5f7552b361ace401d9f6f0b897843dcfb77cfe Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 20 Apr 2025 18:32:46 +0200 Subject: [PATCH] Remove MOCK_(CONST_)_METHOD_EXT detail macros --- include/turtle/detail/mock_impl.hpp | 3 --- include/turtle/mock.hpp | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/turtle/detail/mock_impl.hpp b/include/turtle/detail/mock_impl.hpp index 81cc955..1d57c54 100644 --- a/include/turtle/detail/mock_impl.hpp +++ b/include/turtle/detail/mock_impl.hpp @@ -80,9 +80,6 @@ namespace mock { namespace detail { MOCK_PP_TUPLE_FOR_EACH(MOCK_METHOD_ITER, (name, arity, signature, identifier), qualifiers) \ 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) \ prefix mock::detail::function& identifier##_mock(mock::detail::context& context, \ boost::unit_test::const_string instance) \ diff --git a/include/turtle/mock.hpp b/include/turtle/mock.hpp index 4e543df..0fc7fbc 100644 --- a/include/turtle/mock.hpp +++ b/include/turtle/mock.hpp @@ -86,20 +86,22 @@ /// generates only the const version of the method /// The 'signature' can be omitted if it can be uniquely identified from the base class /// if 'identifier' is omitted it will default to 'name' -#define MOCK_CONST_METHOD(M, ...) \ - MOCK_CONST_METHOD_EXT(M, \ - BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \ - BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \ - BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, )) +#define MOCK_CONST_METHOD(M, ...) \ + MOCK_METHOD_EXT(M, \ + BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \ + BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \ + BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, ), \ + (const)) /// MOCK_NON_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) /// generates only the non-const version of the method /// The 'signature' can be omitted if it can be uniquely identified from the base class /// if 'identifier' is omitted it will default to 'name' -#define MOCK_NON_CONST_METHOD(M, ...) \ - MOCK_NON_CONST_METHOD_EXT(M, \ - BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \ - BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \ - BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, )) +#define MOCK_NON_CONST_METHOD(M, ...) \ + MOCK_METHOD_EXT(M, \ + BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__, ), \ + BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__, MOCK_SIGNATURE(M), ), \ + BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, ), \ + ()) /// MOCK_FUNCTION( [calling convention] name, arity, signature[, identifier] ) /// if 'identifier' is omitted it will default to 'name'