45 virtual int probe() =0;
55 Dummy() { checksum += N; }
56 ~
Dummy() { checksum -= N; }
66 using LERR_(LIFECYCLE);
99 verify_SubclassSingleton();
100 verify_expose_Service_with_Lifecycle();
101 verify_automaticReplacement();
102 verify_customFactory();
104 CHECK (9+7+5+1 == checksum);
116 CHECK (1 ==
sizeof(dep11));
117 CHECK (1 ==
sizeof(dep12));
118 CHECK (1 ==
sizeof(dep5));
121 CHECK ( 0 == checksum );
123 CHECK ( 1*1 == dep11().probe() );
124 CHECK ( 1 == checksum );
125 CHECK ((1+5)*5 == dep5().probe() );
126 CHECK ((1+5) == checksum );
127 CHECK ((1+5)*1 == dep12().probe() );
128 CHECK ((1+5) == checksum );
130 CHECK (not isSameObject (dep11, dep12));
131 CHECK ( isSameObject (dep11(), dep12()));
142 CHECK ((1+5) == checksum );
146 CHECK ((1+5) == checksum );
148 CHECK ((1+5+7)*7 == dumm().probe() );
149 CHECK ((1+5+7) == checksum );
153 CHECK ((1+5+7)*7 == dumm().probe() );
154 CHECK ((1+5+7) == checksum );
162 CHECK ((1+5+7) == checksum );
170 return offset - checksum;
177 CHECK ((1+5+7) == checksum );
181 CHECK ((1+5+7+3) == checksum );
182 CHECK (-(1+5+7+3) == dep3().probe() );
183 CHECK ((1+5+7+3) == checksum );
184 service->offset = (1+5+7);
185 CHECK ( -3 == dep3().probe() );
186 CHECK ((1+5+7+3) == checksum );
188 CHECK ((1+5+7) == checksum );
191 CHECK ((1+5+7) == checksum );
202 CHECK ((1+5+7) == checksum );
203 CHECK ((1+5+7)*7 == dumm().probe() );
221 CHECK ((1+5+7) == checksum );
225 CHECK (-1 == dumm().probe() );
228 CHECK ((1+5+7+3) == checksum );
229 CHECK (-1 == mockDumm->probe() );
230 CHECK ((1+5+7+3) == checksum );
232 mockDumm->response = 11;
233 CHECK (11 == dumm().probe() );
236 CHECK ((1+5+7+3) == checksum );
237 CHECK (-1 == depp().probe() );
238 CHECK ((1+5+7+3+3) == checksum );
240 CHECK (-1 == mockDummy3->probe() );
241 CHECK ((1+5+7+3+3) == checksum );
242 mockDummy3->response = 22;
243 CHECK (22 == depp().probe() );
244 mockDumm->response = 12;
245 CHECK (22 == depp().probe() );
246 CHECK (12 == dumm().probe() );
247 CHECK ((1+5+7+3+3) == checksum );
251 CHECK ((1+5+7) == checksum );
252 CHECK ((1+5+7)*7 == dumm().probe() );
254 CHECK ((1+5+7) == checksum );
258 CHECK ((1+5+7+3) == checksum );
259 CHECK (-1 == depp().probe() );
260 service->response = 33;
261 CHECK (33 == depp().probe() );
262 CHECK ((1+5+7+3) == checksum );
266 CHECK (!mockDummy31);
267 CHECK ((1+5+7+3) == checksum );
268 CHECK (-1 == depp().probe() );
269 CHECK ((1+5+7+3+3) == checksum );
270 mockDummy31->response = 44;
271 CHECK (44 == depp().probe() );
272 CHECK (44 == mockDummy31->probe() );
273 CHECK (33 == service->probe() );
274 CHECK (mockDummy31->response != service->response);
275 service->response = 34;
276 CHECK (44 == depp().probe() );
277 CHECK (44 == mockDummy31->probe() );
278 CHECK (34 == service->probe() );
279 CHECK ((1+5+7+3+3) == checksum );
283 CHECK ((1+5+7+3) == checksum );
284 CHECK (34 == depp().probe() );
285 CHECK ((1+5+7+3) == checksum );
289 CHECK ((1+5+7) == checksum );
291 CHECK ((1+5+7)*7 == dumm().probe() );
292 CHECK ((1+5+7) == checksum );
309 CHECK ((1+5+7) == checksum );
314 Veryspecial(
int& ref)
336 CHECK ((1+5+7) == checksum );
337 CHECK ( 22 == backdoor );
340 CHECK ((1+5+7) == checksum );
341 CHECK (22 == backdoor );
343 CHECK (22 == tricky().probe());
344 CHECK (23 == backdoor );
345 CHECK ((1+5+7+9) == checksum );
348 CHECK (41 == tricky().probe());
349 CHECK (42 == backdoor );
353 CHECK ((1+5+7+9)*7 == dumm().probe() );
364 CHECK ((1+5+7+9) == checksum );
365 CHECK (not insidious);
367 CHECK (42 == dumm().probe() );
368 CHECK (43 == backdoor );
369 CHECK ((1+5+7+9+9) == checksum );
371 CHECK (isSameObject (dumm(), *insidious));
373 CHECK (43 == tricky().probe());
374 CHECK (44 == backdoor );
377 CHECK (-1 == dumm().probe() );
378 CHECK ( 0 == backdoor );
380 CHECK ((1+5+7+9+9) == checksum );
383 CHECK ((1+5+7+9) == checksum );
384 CHECK ((1+5+7+9)*7 == dumm().probe() );
385 CHECK ( 0 == tricky().probe());
386 CHECK (+1 == backdoor );
Any copy and copy construction prohibited.
Per type specific configuration of instances created as service dependencies.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
void verify_SubclassSingleton()
Access point to singletons and other kinds of dependencies designated by type.
void verify_automaticReplacement()
Implementation namespace for support and library code.
void verify_expose_Service_with_Lifecycle()
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
void verify_customFactory()
A collection of frequently used helper functions to support unit testing.
A Dummy object for tests.
Singleton services and Dependency Injection.
Configuration handle for temporarily shadowing a dependency by a test mock instance.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...