6#ifndef MIMICPP_INTERFACE_MOCK_HPP
7#define MIMICPP_INTERFACE_MOCK_HPP
62#define MIMICPP_DETAIL_STRIP_PARENS(x) MIMICPP_DETAIL_STRIP_PARENS_OUTER(MIMICPP_DETAIL_STRIP_PARENS_INNER x)
68#define MIMICPP_DETAIL_STRIP_PARENS_INNER(...) MIMICPP_DETAIL_STRIP_PARENS_INNER __VA_ARGS__
74#define MIMICPP_DETAIL_STRIP_PARENS_OUTER(...) MIMICPP_DETAIL_STRIP_PARENS_OUTER_(__VA_ARGS__)
80#define MIMICPP_DETAIL_STRIP_PARENS_OUTER_(...) MIMICPP_DETAIL_STRIP_PARENS_STRIPPED_ ## __VA_ARGS__
86#define MIMICPP_DETAIL_STRIP_PARENS_STRIPPED_MIMICPP_DETAIL_STRIP_PARENS_INNER
106#define MIMICPP_DETAIL_PARENS ()
112#define MIMICPP_DETAIL_COMMA_DELIMITER() ,
118#define MIMICPP_DETAIL_NO_DELIMITER()
124#define MIMICPP_DETAIL_IDENTITY(...) __VA_ARGS__
130#define MIMICPP_DETAIL_EXPAND(...) MIMICPP_DETAIL_EXPAND3(MIMICPP_DETAIL_EXPAND3(MIMICPP_DETAIL_EXPAND3(MIMICPP_DETAIL_EXPAND3(__VA_ARGS__))))
136#define MIMICPP_DETAIL_EXPAND3(...) MIMICPP_DETAIL_EXPAND2(MIMICPP_DETAIL_EXPAND2(MIMICPP_DETAIL_EXPAND2(MIMICPP_DETAIL_EXPAND2(__VA_ARGS__))))
142#define MIMICPP_DETAIL_EXPAND2(...) MIMICPP_DETAIL_EXPAND1(MIMICPP_DETAIL_EXPAND1(MIMICPP_DETAIL_EXPAND1(MIMICPP_DETAIL_EXPAND1(__VA_ARGS__))))
148#define MIMICPP_DETAIL_EXPAND1(...) __VA_ARGS__
157#define MIMICPP_DETAIL_FOR_EACH_EXT_INDIRECT(macro, sequence, ...) macro(sequence, __VA_ARGS__)
174#define MIMICPP_DETAIL_FOR_EACH_EXT(macro, token, delimiter, projection_macro, bound, ...) \
175 __VA_OPT__(MIMICPP_DETAIL_EXPAND(MIMICPP_DETAIL_FOR_EACH_EXT_HELPER(macro, token, token, delimiter, projection_macro, bound, __VA_ARGS__)))
181#define MIMICPP_DETAIL_FOR_EACH_EXT_HELPER(macro, token, sequence, delimiter, projection_macro, bound, a1, ...) \
182 MIMICPP_DETAIL_FOR_EACH_EXT_INDIRECT(macro, sequence, MIMICPP_DETAIL_STRIP_PARENS(bound), projection_macro(a1)) \
183 __VA_OPT__(delimiter() MIMICPP_FOR_EACH_EXT_AGAIN MIMICPP_DETAIL_PARENS (macro, token, sequence##token, delimiter, projection_macro, bound, __VA_ARGS__))
189#define MIMICPP_FOR_EACH_EXT_AGAIN() MIMICPP_DETAIL_FOR_EACH_EXT_HELPER
209#define MIMICPP_DETAIL_MAKE_SIGNATURE(sequence, bound_data, ret, param_type_list, specs, ...) ret param_type_list specs
215#define MIMICPP_DETAIL_MAKE_SIGNATURE_LIST(...) \
216 MIMICPP_DETAIL_FOR_EACH_EXT( \
217 MIMICPP_DETAIL_MAKE_SIGNATURE, \
219 MIMICPP_DETAIL_COMMA_DELIMITER, \
220 MIMICPP_DETAIL_STRIP_PARENS, \
230#define MIMICPP_DETAIL_MAKE_OVERLOADED_MOCK(mock_name, signatures) \
231 ::mimicpp::Mock< MIMICPP_DETAIL_STRIP_PARENS(signatures) > mock_name{}
249#define MIMICPP_DETAIL_MAKE_PARAM(sequence, bound_data, type) MIMICPP_DETAIL_STRIP_PARENS(type) arg_##sequence
255#define MIMICPP_DETAIL_MAKE_PARAM_LIST(...) \
256 MIMICPP_DETAIL_FOR_EACH_EXT( \
257 MIMICPP_DETAIL_MAKE_PARAM, \
259 MIMICPP_DETAIL_COMMA_DELIMITER, \
260 MIMICPP_DETAIL_IDENTITY, \
280#define MIMICPP_DETAIL_FORWARD_ARG(sequence, bound_data, type) \
281 ::std::forward<::std::add_rvalue_reference_t<MIMICPP_DETAIL_STRIP_PARENS(type)>>(arg_##sequence)
287#define MIMICPP_DETAIL_FORWARD_ARGS(...) \
288 MIMICPP_DETAIL_FOR_EACH_EXT( \
289 MIMICPP_DETAIL_FORWARD_ARG, \
291 MIMICPP_DETAIL_COMMA_DELIMITER, \
292 MIMICPP_DETAIL_IDENTITY, \
312#define MIMICPP_DETAIL_MAKE_OVERLOAD_INFOS_SPECS(ret, param_type_list, specs, ...) \
313 (ret, param_type_list, specs, \
314 (MIMICPP_DETAIL_MAKE_PARAM_LIST(MIMICPP_DETAIL_STRIP_PARENS(param_type_list))), \
315 (MIMICPP_DETAIL_FORWARD_ARGS(MIMICPP_DETAIL_STRIP_PARENS(param_type_list))))
323#define MIMICPP_DETAIL_MAKE_OVERLOAD_INFOS_BASIC(ret, param_type_list, ...) \
324 MIMICPP_DETAIL_MAKE_OVERLOAD_INFOS_SPECS(ret, param_type_list, )
331#define MIMICPP_DETAIL_SELECT_MAKE_OVERLOAD_INFOS(_1, N, ...) N
340#define MIMICPP_ADD_OVERLOAD(ret, param_type_list, ...) \
341 MIMICPP_DETAIL_SELECT_MAKE_OVERLOAD_INFOS( \
343 MIMICPP_DETAIL_MAKE_OVERLOAD_INFOS_SPECS, \
344 MIMICPP_DETAIL_MAKE_OVERLOAD_INFOS_BASIC)(ret, param_type_list, __VA_ARGS__,)
367#define MIMICPP_DETAIL_MAKE_METHOD_OVERRIDE(ignore, mock_name, fn_name, ret, param_type_list, specs, param_list, forward_list, ...) \
368 inline MIMICPP_DETAIL_STRIP_PARENS(ret) fn_name param_list MIMICPP_DETAIL_STRIP_PARENS(specs) override \
370 return mock_name (MIMICPP_DETAIL_STRIP_PARENS(forward_list)); \
379#define MIMICPP_DETAIL_MAKE_METHOD_OVERRIDES(mock_name, fn_name, ...) \
380 MIMICPP_DETAIL_FOR_EACH_EXT( \
381 MIMICPP_DETAIL_MAKE_METHOD_OVERRIDE, \
383 MIMICPP_DETAIL_NO_DELIMITER, \
384 MIMICPP_DETAIL_STRIP_PARENS, \
385 (mock_name, fn_name), \
398#define MIMICPP_MOCK_OVERLOADED_METHOD(fn_name, ...) \
399 MIMICPP_DETAIL_MAKE_METHOD_OVERRIDES(fn_name##_, fn_name, __VA_ARGS__) \
400 MIMICPP_DETAIL_MAKE_OVERLOADED_MOCK( \
402 (MIMICPP_DETAIL_MAKE_SIGNATURE_LIST(__VA_ARGS__)))
414#define MIMICPP_MOCK_METHOD(fn_name, ret, param_type_list, ...) \
415 MIMICPP_MOCK_OVERLOADED_METHOD( \
417 MIMICPP_ADD_OVERLOAD(ret, param_type_list __VA_OPT__(,) __VA_ARGS__ ))
419#ifndef MIMICPP_CONFIG_ONLY_PREFIXED_MACROS
425#define MOCK_METHOD MIMICPP_MOCK_METHOD
431#define MOCK_OVERLOADED_METHOD MIMICPP_MOCK_OVERLOADED_METHOD
437#define ADD_OVERLOAD MIMICPP_ADD_OVERLOAD
Definition BoostTest.hpp:20