mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Require qualifiers for MOCK_METHOD_EXT
This commit is contained in:
parent
a8f0253753
commit
f6200f9024
2 changed files with 3 additions and 12 deletions
|
|
@ -16,8 +16,6 @@
|
|||
#include "signature.hpp"
|
||||
#include "signature_traits.hpp"
|
||||
#include "type_name.hpp"
|
||||
#include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
|
@ -77,19 +75,11 @@ namespace mock { namespace detail {
|
|||
BOOST_PP_TUPLE_ELEM(3, M_n_S_t), \
|
||||
qualifier)
|
||||
|
||||
#define MOCK_METHOD_EXT_IMPL(name, arity, signature, identifier, qualifiers) \
|
||||
#define MOCK_METHOD_EXT(name, arity, signature, identifier, qualifiers) \
|
||||
static_assert(arity == mock::detail::function_arity_t<signature>::value, "Arity mismatch"); \
|
||||
MOCK_PP_TUPLE_FOR_EACH(MOCK_METHOD_ITER, (name, arity, signature, identifier), qualifiers) \
|
||||
MOCK_METHOD_HELPER(signature, identifier)
|
||||
|
||||
/// MOCK_METHOD_EXT( name, arity, signature, identifier [ , qualifiers] )
|
||||
/// If qualifiers is not given, defaults to (const, ), i.e. const and non-const
|
||||
#define MOCK_METHOD_EXT(name, arity, signature, ...) \
|
||||
MOCK_METHOD_EXT_IMPL \
|
||||
BOOST_PP_IF(BOOST_PP_LESS_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), 1), \
|
||||
(name, arity, signature, __VA_ARGS__, (const, )), \
|
||||
(name, arity, signature, __VA_ARGS__))
|
||||
|
||||
#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, ())
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@
|
|||
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, ))
|
||||
BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__, M, M, ), \
|
||||
(const, ))
|
||||
/// MOCK_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] )
|
||||
/// generates only the const version of the method
|
||||
/// The 'signature' can be omitted if it can be uniquely identified from the base class
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue