54 virtual int probe() =0;
64 Dummy() { checksum += N; }
65 ~
Dummy() { checksum -= N; }
75 using LERR_(LIFECYCLE);
108 verify_SubclassSingleton();
109 verify_expose_Service_with_Lifecycle();
110 verify_automaticReplacement();
111 verify_customFactory();
113 CHECK (9+7+5+1 == checksum);
125 CHECK (1 ==
sizeof(dep11));
126 CHECK (1 ==
sizeof(dep12));
127 CHECK (1 ==
sizeof(dep5));
130 CHECK ( 0 == checksum );
132 CHECK ( 1*1 == dep11().probe() );
133 CHECK ( 1 == checksum );
134 CHECK ((1+5)*5 == dep5().probe() );
135 CHECK ((1+5) == checksum );
136 CHECK ((1+5)*1 == dep12().probe() );
137 CHECK ((1+5) == checksum );
139 CHECK (not isSameObject (dep11, dep12));
140 CHECK ( isSameObject (dep11(), dep12()));
151 CHECK ((1+5) == checksum );
155 CHECK ((1+5) == checksum );
157 CHECK ((1+5+7)*7 == dumm().probe() );
158 CHECK ((1+5+7) == checksum );
162 CHECK ((1+5+7)*7 == dumm().probe() );
163 CHECK ((1+5+7) == checksum );
171 CHECK ((1+5+7) == checksum );
179 return offset - checksum;
186 CHECK ((1+5+7) == checksum );
190 CHECK ((1+5+7+3) == checksum );
191 CHECK (-(1+5+7+3) == dep3().probe() );
192 CHECK ((1+5+7+3) == checksum );
193 service->offset = (1+5+7);
194 CHECK ( -3 == dep3().probe() );
195 CHECK ((1+5+7+3) == checksum );
197 CHECK ((1+5+7) == checksum );
200 CHECK ((1+5+7) == checksum );
211 CHECK ((1+5+7) == checksum );
212 CHECK ((1+5+7)*7 == dumm().probe() );
230 CHECK ((1+5+7) == checksum );
234 CHECK (-1 == dumm().probe() );
237 CHECK ((1+5+7+3) == checksum );
238 CHECK (-1 == mockDumm->probe() );
239 CHECK ((1+5+7+3) == checksum );
241 mockDumm->response = 11;
242 CHECK (11 == dumm().probe() );
245 CHECK ((1+5+7+3) == checksum );
246 CHECK (-1 == depp().probe() );
247 CHECK ((1+5+7+3+3) == checksum );
249 CHECK (-1 == mockDummy3->probe() );
250 CHECK ((1+5+7+3+3) == checksum );
251 mockDummy3->response = 22;
252 CHECK (22 == depp().probe() );
253 mockDumm->response = 12;
254 CHECK (22 == depp().probe() );
255 CHECK (12 == dumm().probe() );
256 CHECK ((1+5+7+3+3) == checksum );
260 CHECK ((1+5+7) == checksum );
261 CHECK ((1+5+7)*7 == dumm().probe() );
263 CHECK ((1+5+7) == checksum );
267 CHECK ((1+5+7+3) == checksum );
268 CHECK (-1 == depp().probe() );
269 service->response = 33;
270 CHECK (33 == depp().probe() );
271 CHECK ((1+5+7+3) == checksum );
275 CHECK (!mockDummy31);
276 CHECK ((1+5+7+3) == checksum );
277 CHECK (-1 == depp().probe() );
278 CHECK ((1+5+7+3+3) == checksum );
279 mockDummy31->response = 44;
280 CHECK (44 == depp().probe() );
281 CHECK (44 == mockDummy31->probe() );
282 CHECK (33 == service->probe() );
283 CHECK (mockDummy31->response != service->response);
284 service->response = 34;
285 CHECK (44 == depp().probe() );
286 CHECK (44 == mockDummy31->probe() );
287 CHECK (34 == service->probe() );
288 CHECK ((1+5+7+3+3) == checksum );
292 CHECK ((1+5+7+3) == checksum );
293 CHECK (34 == depp().probe() );
294 CHECK ((1+5+7+3) == checksum );
298 CHECK ((1+5+7) == checksum );
300 CHECK ((1+5+7)*7 == dumm().probe() );
301 CHECK ((1+5+7) == checksum );
318 CHECK ((1+5+7) == checksum );
323 Veryspecial(
int& ref)
345 CHECK ((1+5+7) == checksum );
346 CHECK ( 22 == backdoor );
349 CHECK ((1+5+7) == checksum );
350 CHECK (22 == backdoor );
352 CHECK (22 == tricky().probe());
353 CHECK (23 == backdoor );
354 CHECK ((1+5+7+9) == checksum );
357 CHECK (41 == tricky().probe());
358 CHECK (42 == backdoor );
362 CHECK ((1+5+7+9)*7 == dumm().probe() );
373 CHECK ((1+5+7+9) == checksum );
374 CHECK (not insidious);
376 CHECK (42 == dumm().probe() );
377 CHECK (43 == backdoor );
378 CHECK ((1+5+7+9+9) == checksum );
380 CHECK (isSameObject (dumm(), *insidious));
382 CHECK (43 == tricky().probe());
383 CHECK (44 == backdoor );
386 CHECK (-1 == dumm().probe() );
387 CHECK ( 0 == backdoor );
389 CHECK ((1+5+7+9+9) == checksum );
392 CHECK ((1+5+7+9) == checksum );
393 CHECK ((1+5+7+9)*7 == dumm().probe() );
394 CHECK ( 0 == tricky().probe());
395 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.
Simple 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, bypassing any custom comparison operators.