87 uint randomLimit = 2 + rand() % 98;
95 Test& instanceRef = *
this;
100 uint res = std::apply (&LateBindInstance_test::theMember, preparedArgs);
101 CHECK (res < randomLimit);
105 theMember (uint limit)
107 return rand() % limit;
117 auto& log = Tracker::log;
123 log.event(
"construct tuple");
124 tuple tup(t1, marker,
Tracker{23}, 55);
126 Test& instanceRef = *
this;
128 log.event(
"invoke lateBindInstance");
130 log.event(
"got result");
133 CHECK (log.verifyCall(
"ctor").arg(11)
134 .beforeCall(
"ctor-copy").arg(
"Track{11}")
135 .beforeEvent(
"invoke lateBindInstance"));
136 CHECK (log.verifyCall(
"ctor").arg(23)
137 .beforeCall(
"ctor-move").arg(
"Track{23}")
138 .beforeCall(
"dtor").arg(Tracker::DEFUNCT)
139 .beforeEvent(
"invoke lateBindInstance"));
142 CHECK (log.ensureNot(
"ctor-copy")
143 .afterEvent(
"invoke lateBindInstance"));
149 CHECK (log.verifyEvent(
"invoke lateBindInstance")
150 .beforeCall(
"ctor-move").arg(
"Track{11}")
151 .beforeCall(
"ctor-move").arg(
"Track{11}")
152 .beforeCall(
"dtor").arg(Tracker::DEFUNCT)
153 .beforeEvent(
"got result"));
154 CHECK (log.verifyEvent(
"invoke lateBindInstance")
155 .beforeCall(
"ctor-move").arg(
"Track{23}")
156 .beforeCall(
"ctor-move").arg(
"Track{23}")
157 .beforeCall(
"dtor").arg(Tracker::DEFUNCT)
158 .beforeEvent(
"got result"));
160 cout <<
"____Tracker-Log_______________\n" 161 << util::join(Tracker::log,
"\n")
162 <<
"\n───╼━━━━━━━━━━━╾──────────────"<<endl;
185 })) ==
"(1,2,↗555,«tuple<int, int>»──(2,3),5.5)"_expect);
constexpr auto lateBindInstance(W &instance, TUP &&invocation)
Fix-up the arguments for a member-function invocation, allowing to inject the actual this instance in...
Implementation namespace for support and library code.
unittest helper code: test dummy objects to track instances.
Metaprogramming with tuples-of-types and the std::tuple record.
Metaprogramming tools for transforming functor types.
A tracking Dummy object for tests.
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
std::string dump(std::tuple< TYPES... > const &tuple)
convenience function to dump a given tuple's contents.