diff --git a/src/core_test/utility/exposer.h b/src/core_test/utility/exposer.h index 875ee1b..865dd6e 100644 --- a/src/core_test/utility/exposer.h +++ b/src/core_test/utility/exposer.h @@ -69,6 +69,32 @@ struct Exposer { return (std::forward(c).*fetch(HELPER(Tag){}))(std::forward(args)...); \ } +#define FORCE_ACCESS_STATIC_VAR_IMPL(Class, Type, Member, Tag) \ + struct HELPER(Tag) {}; \ + template struct Exposer; \ + constexpr Type* fetch(HELPER(Tag)); \ + constexpr Type& Class##_##Member() { \ + return *fetch(HELPER(Tag){}); \ + } + +#define FORCE_ACCESS_STATIC_CONST_VAR_IMPL(Class, Type, Member, Tag) \ + struct HELPER(Tag) {}; \ + template struct Exposer; \ + constexpr const Type* fetch(HELPER(Tag)); \ + constexpr const Type& Class##_##Member() { \ + return *fetch(HELPER(Tag){}); \ + } + +#define FORCE_ACCESS_STATIC_FUNC_IMPL(Class, Proto, Member, Tag) \ + struct HELPER(Tag) {}; \ + using PROTO(Tag) = Proto; \ + template struct Exposer; \ + constexpr PROTO(Tag)* fetch(HELPER(Tag)); \ + template \ + constexpr decltype(auto) sfunc(Args &&...args) { \ + return fetch(HELPER(Tag){})(std::forward(args)...); \ + } + #define FORCE_ACCESS_VAR(Class, Type, Member) \ namespace exposer { \ FORCE_ACCESS_VAR_IMPL(Class, Type, Member, __COUNTER__) \ @@ -88,3 +114,18 @@ struct Exposer { namespace exposer { \ FORCE_ACCESS_CONST_FUNC_IMPL(Class, Proto, Member, __COUNTER__) \ } + +#define FORCE_ACCESS_STATIC_VAR(Class, Type, Member) \ + namespace exposer { \ + FORCE_ACCESS_STATIC_VAR_IMPL(Class, Type, Member, __COUNTER__) \ + } + +#define FORCE_ACCESS_STATIC_CONST_VAR(Class, Type, Member) \ + namespace exposer { \ + FORCE_ACCESS_STATIC_CONST_VAR_IMPL(Class, Type, Member, __COUNTER__) \ + } + +#define FORCE_ACCESS_STATIC_FUNC(Class, Proto, Member) \ + namespace exposer { \ + FORCE_ACCESS_STATIC_FUNC_IMPL(Class, Proto, Member, __COUNTER__) \ + }