39 const size_t TEST_MAX_SIZE = 1024 * 1024;
55 typedef char Pattern[siz];
61 for (
size_t i=0; i<siz; ++i)
62 pattern_[i] = i % CHAR_MAX;
67 for (
size_t i=0; i<siz; ++i)
75 verifyFilled (
const void* buff)
78 const Pattern& patt = *
reinterpret_cast<const Pattern*
> (buff);
80 for (
size_t i=0; i<siz; ++i)
81 if (patt[i] !=
char(i % CHAR_MAX))
88 verifyCleared (
const void* buff)
91 const Pattern& patt = *
reinterpret_cast<const Pattern*
> (buff);
93 for (
size_t i=0; i<siz; ++i)
109 size_t const& investigateSize()
const {
return this->storageSize_; }
110 TypeHandler const& investigateHandler()
const {
return this->instanceFunc_; }
111 LocalTag const& investigateSpecifics()
const {
return this->specifics_; }
120 verifySize (
Key const& subject)
126 verifyHandler (
Key const& subject)
132 verifySpecifics (
Key const& subject)
165 SIZE_A = 1 +
rani(TEST_MAX_SIZE);
166 SIZE_B = 1 +
rani(TEST_MAX_SIZE);
168 CHECK (ensure_proper_fixture());
170 verifyChainedHashes();
171 verifyTypeHandler<500>();
172 verifyTypeSpecialisation();
177 ensure_proper_fixture()
179 return (SIZE_A != SIZE_B);
187 Key k1(family, SIZE_A);
198 verifyChainedHashes()
203 Key k1(family, SIZE_A);
204 Key k1o(otherFamily, SIZE_A);
212 Key k121(k12, SIZE_A);
213 Key k2(family, SIZE_B);
228 memset (buff,
'\0', SIZ);
230 typedef PlacedNumbers<SIZ> Pattern;
232 TypeHandler attachPattern = TypeHandler::create<Pattern>();
234 CHECK (attachPattern.isValid());
237 CHECK (Pattern::verifyCleared (buff));
238 attachPattern.createAttached (buff);
239 CHECK (Pattern::verifyFilled (buff));
240 attachPattern.destroyAttached (buff);
241 CHECK (Pattern::verifyCleared (buff));
246 verifyTypeSpecialisation()
249 Key kb (family, SIZE_A);
251 typedef PlacedNumbers<45> Marker;
252 TypeHandler placeMarker = TypeHandler::create<Marker>();
258 Key k_siz (kb, SIZE_B);
259 Key k_han0(kb, noHandler);
260 Key k_han1(kb, placeMarker);
261 Key k_loc1(kb, opaque1);
262 Key k_loc2(kb, opaque2);
264 CHECK (kb != k_siz );
265 CHECK (kb != k_han0);
266 CHECK (kb != k_han1);
267 CHECK (kb != k_loc1);
268 CHECK (kb != k_loc2);
269 CHECK (k_siz != k_han0);
270 CHECK (k_siz != k_han1);
271 CHECK (k_siz != k_loc1);
272 CHECK (k_siz != k_loc2);
273 CHECK (k_han0 != k_han1);
274 CHECK (k_han0 != k_loc1);
275 CHECK (k_han0 != k_loc2);
276 CHECK (k_han1 != k_loc1);
277 CHECK (k_han1 != k_loc2);
278 CHECK (k_loc1 != k_loc2);
296 CHECK (SIZE_A == verifySize(kb ));
297 CHECK (SIZE_B == verifySize(k_siz ));
298 CHECK (SIZE_A == verifySize(k_han0));
299 CHECK (SIZE_A == verifySize(k_han1));
300 CHECK (SIZE_A == verifySize(k_loc1));
301 CHECK (SIZE_A == verifySize(k_loc2));
305 CHECK ( noHandler == verifyHandler(k_han0));
306 CHECK ( placeMarker == verifyHandler(k_han1));
314 CHECK ( opaque1 == verifySpecifics(k_loc1));
315 CHECK ( opaque2 == verifySpecifics(k_loc2));
319 Key k_han1_siz (k_han1, SIZE_B);
320 Key k_siz_han1 (k_siz, placeMarker);
323 Key k_han1_siz_loc2 (k_han1_siz, opaque2);
324 Key k_loc2_han1_siz (
Key(k_loc2,placeMarker), SIZE_B);
326 CHECK (SIZE_B == verifySize(k_han1_siz ));
327 CHECK (SIZE_B == verifySize(k_siz_han1 ));
328 CHECK (SIZE_B == verifySize(k_han1_siz_loc2));
329 CHECK (SIZE_B == verifySize(k_loc2_han1_siz));
331 CHECK (placeMarker == verifyHandler(k_han1_siz ));
332 CHECK (placeMarker == verifyHandler(k_siz_han1 ));
333 CHECK (placeMarker == verifyHandler(k_han1_siz_loc2));
334 CHECK (placeMarker == verifyHandler(k_loc2_han1_siz));
338 CHECK (opaque2 == verifySpecifics(k_han1_siz_loc2));
339 CHECK (opaque2 == verifySpecifics(k_loc2_han1_siz));
342 CHECK (k_han1_siz != k_siz_han1 );
343 CHECK (k_han1_siz_loc2 != k_loc2_han1_siz);
349 Key k_again (
Key(k_han1,SIZE_B), opaque2);
350 CHECK (k_again == k_han1_siz_loc2);
354 CHECK (kb != k_han1_siz );
355 CHECK (kb != k_siz_han1 );
356 CHECK (kb != k_han1_siz_loc2);
357 CHECK (kb != k_loc2_han1_siz);
358 CHECK (k_han1 != k_han1_siz );
359 CHECK (k_han1 != k_siz_han1 );
360 CHECK (k_han1 != k_han1_siz_loc2);
361 CHECK (k_han1 != k_loc2_han1_siz);
362 CHECK (k_siz != k_han1_siz );
363 CHECK (k_siz != k_siz_han1 );
364 CHECK (k_siz != k_han1_siz_loc2);
365 CHECK (k_siz != k_loc2_han1_siz);
366 CHECK (k_loc2 != k_han1_siz );
367 CHECK (k_loc2 != k_siz_han1 );
368 CHECK (k_loc2 != k_han1_siz_loc2);
369 CHECK (k_loc2 != k_loc2_han1_siz);
int rani(uint bound=_iBOUND())
an opaque mark to be used by the BufferProvider implementation.
Steam-Layer implementation namespace root.
Simplistic test class runner.
static const TypeHandler RAW
Marker for the default case: raw buffer without type handling.
A collection of frequently used helper functions to support unit testing.
Lumiera error handling (C++ interface).
static const LocalTag UNKNOWN
Marker when no distinct local key is given.
size_t HashVal
a STL compatible hash value
A pair of functors to maintain a datastructure within a buffer.
HashVal hash_value(ProcID const &procID)
generate registry hash value based on the distinct data in ProcID.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...