48 const size_t TEST_MAX_SIZE = 1024 * 1024;
50 const size_t SIZE_A = 1 + rand() % TEST_MAX_SIZE;
51 const size_t SIZE_B = 1 + rand() % TEST_MAX_SIZE;
67 typedef char Pattern[siz];
73 for (
size_t i=0; i<siz; ++i)
74 pattern_[i] = i % CHAR_MAX;
79 for (
size_t i=0; i<siz; ++i)
87 verifyFilled (
const void* buff)
90 const Pattern& patt = *
reinterpret_cast<const Pattern*
> (buff);
92 for (
size_t i=0; i<siz; ++i)
93 if (patt[i] !=
char(i % CHAR_MAX))
100 verifyCleared (
const void* buff)
103 const Pattern& patt = *
reinterpret_cast<const Pattern*
> (buff);
105 for (
size_t i=0; i<siz; ++i)
121 size_t const& investigateSize()
const {
return this->storageSize_; }
122 TypeHandler const& investigateHandler()
const {
return this->instanceFunc_; }
123 LocalKey const& investigateSpecifics()
const {
return this->specifics_; }
132 verifySize (
Key const& subject)
138 verifyHandler (
Key const& subject)
144 verifySpecifics (
Key const& subject)
173 CHECK (ensure_proper_fixture());
175 verifyChainedHashes();
176 verifyTypeHandler<500>();
177 verifyTypeSpecialisation();
182 ensure_proper_fixture()
184 return (SIZE_A != SIZE_B);
192 Key k1(family, SIZE_A);
203 verifyChainedHashes()
208 Key k1(family, SIZE_A);
209 Key k1o(otherFamily, SIZE_A);
217 Key k121(k12, SIZE_A);
218 Key k2(family, SIZE_B);
233 memset (buff,
'\0', SIZ);
235 typedef PlacedNumbers<SIZ> Pattern;
237 TypeHandler attachPattern = TypeHandler::create<Pattern>();
239 CHECK (attachPattern.isValid());
240 CHECK (0 != hash_value(attachPattern));
242 CHECK (Pattern::verifyCleared (buff));
243 attachPattern.createAttached (buff);
244 CHECK (Pattern::verifyFilled (buff));
245 attachPattern.destroyAttached (buff);
246 CHECK (Pattern::verifyCleared (buff));
251 verifyTypeSpecialisation()
254 Key kb (family, SIZE_A);
256 typedef PlacedNumbers<45> Marker;
257 TypeHandler placeMarker = TypeHandler::create<Marker>();
261 LocalKey opaque2 (1000 + rand() % 1000);
263 Key k_siz (kb, SIZE_B);
264 Key k_han0(kb, noHandler);
265 Key k_han1(kb, placeMarker);
266 Key k_loc1(kb, opaque1);
267 Key k_loc2(kb, opaque2);
269 CHECK (kb != k_siz );
270 CHECK (kb != k_han0);
271 CHECK (kb != k_han1);
272 CHECK (kb != k_loc1);
273 CHECK (kb != k_loc2);
274 CHECK (k_siz != k_han0);
275 CHECK (k_siz != k_han1);
276 CHECK (k_siz != k_loc1);
277 CHECK (k_siz != k_loc2);
278 CHECK (k_han0 != k_han1);
279 CHECK (k_han0 != k_loc1);
280 CHECK (k_han0 != k_loc2);
281 CHECK (k_han1 != k_loc1);
282 CHECK (k_han1 != k_loc2);
283 CHECK (k_loc1 != k_loc2);
301 CHECK (SIZE_A == verifySize(kb ));
302 CHECK (SIZE_B == verifySize(k_siz ));
303 CHECK (SIZE_A == verifySize(k_han0));
304 CHECK (SIZE_A == verifySize(k_han1));
305 CHECK (SIZE_A == verifySize(k_loc1));
306 CHECK (SIZE_A == verifySize(k_loc2));
308 CHECK (RAW_BUFFER == verifyHandler(kb ));
309 CHECK (RAW_BUFFER == verifyHandler(k_siz ));
310 CHECK (noHandler == verifyHandler(k_han0));
311 CHECK (placeMarker == verifyHandler(k_han1));
312 CHECK (RAW_BUFFER == verifyHandler(k_loc1));
313 CHECK (RAW_BUFFER == verifyHandler(k_loc2));
315 CHECK (UNSPECIFIC == verifySpecifics(kb ));
316 CHECK (UNSPECIFIC == verifySpecifics(k_siz ));
317 CHECK (UNSPECIFIC == verifySpecifics(k_han0));
318 CHECK (UNSPECIFIC == verifySpecifics(k_han1));
319 CHECK (opaque1 == verifySpecifics(k_loc1));
320 CHECK (opaque2 == verifySpecifics(k_loc2));
324 Key k_han1_siz (k_han1, SIZE_B);
325 Key k_siz_han1 (k_siz, placeMarker);
328 Key k_han1_siz_loc2 (k_han1_siz, opaque2);
329 Key k_loc2_han1_siz (
Key(k_loc2,placeMarker), SIZE_B);
331 CHECK (SIZE_B == verifySize(k_han1_siz ));
332 CHECK (SIZE_B == verifySize(k_siz_han1 ));
333 CHECK (SIZE_B == verifySize(k_han1_siz_loc2));
334 CHECK (SIZE_B == verifySize(k_loc2_han1_siz));
336 CHECK (placeMarker == verifyHandler(k_han1_siz ));
337 CHECK (placeMarker == verifyHandler(k_siz_han1 ));
338 CHECK (placeMarker == verifyHandler(k_han1_siz_loc2));
339 CHECK (placeMarker == verifyHandler(k_loc2_han1_siz));
341 CHECK (UNSPECIFIC == verifySpecifics(k_han1_siz ));
342 CHECK (UNSPECIFIC == verifySpecifics(k_siz_han1 ));
343 CHECK (opaque2 == verifySpecifics(k_han1_siz_loc2));
344 CHECK (opaque2 == verifySpecifics(k_loc2_han1_siz));
347 CHECK (k_han1_siz != k_siz_han1 );
348 CHECK (k_han1_siz_loc2 != k_loc2_han1_siz);
354 Key k_again (
Key(k_han1,SIZE_B), opaque2);
355 CHECK (k_again == k_han1_siz_loc2);
359 CHECK (kb != k_han1_siz );
360 CHECK (kb != k_siz_han1 );
361 CHECK (kb != k_han1_siz_loc2);
362 CHECK (kb != k_loc2_han1_siz);
363 CHECK (k_han1 != k_han1_siz );
364 CHECK (k_han1 != k_siz_han1 );
365 CHECK (k_han1 != k_han1_siz_loc2);
366 CHECK (k_han1 != k_loc2_han1_siz);
367 CHECK (k_siz != k_han1_siz );
368 CHECK (k_siz != k_siz_han1 );
369 CHECK (k_siz != k_han1_siz_loc2);
370 CHECK (k_siz != k_loc2_han1_siz);
371 CHECK (k_loc2 != k_han1_siz );
372 CHECK (k_loc2 != k_siz_han1 );
373 CHECK (k_loc2 != k_han1_siz_loc2);
374 CHECK (k_loc2 != k_loc2_han1_siz);
Steam-Layer implementation namespace root.
an opaque ID to be used by the BufferProvider implementation.
Simple test class runner.
A collection of frequently used helper functions to support unit testing.
Lumiera error handling (C++ interface).
size_t HashVal
a STL compatible hash value
A pair of functors to maintain a datastructure within a buffer.
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.