50 return getVal() + trigger_;
60 if (trigger == getVal())
61 throw error::Fatal (
"Subversive Bomb", LUMIERA_ERROR_SUBVERSIVE);
83 using LERR_(ITER_EXHAUST);
103 building_RAII_Style();
104 building_StackStyle();
106 verify_defaultPopulator();
107 verify_iteratorPopulator();
108 verify_embeddedCollection();
115 CHECK (0 == Dummy::checksum());
118 CHECK (isnil (container));
119 CHECK (0 == container.size());
120 CHECK (0 == Dummy::checksum());
123 CHECK (!isnil (container));
124 CHECK (5 == container.size());
125 CHECK (0 != Dummy::checksum());
128 CHECK (isnil (container));
129 CHECK (0 == container.size());
130 CHECK (0 == Dummy::checksum());
133 CHECK (Dummy::checksum() == container[0].getVal()
134 + container[1].getVal()
135 + container[2].getVal()
136 + container[3].getVal()
137 + container[4].getVal());
139 CHECK (0 == Dummy::checksum());
146 CHECK (0 == Dummy::checksum());
149 for (uint i=0; i<coll.capacity(); ++i)
156 CHECK (check == ii->getVal());
157 CHECK (check == ii->calc(+5) - 5);
164 CollD
const& const_coll (coll);
169 CHECK (check == cii->getVal());
177 for (
auto&
entry : coll)
179 CHECK (check ==
entry.getVal());
183 for (
auto const&
entry : const_coll)
185 CHECK (check ==
entry.getVal());
191 CHECK (! (coll.end()));
192 CHECK (isnil (coll.end()));
197 CHECK (ii == coll.end());
198 CHECK (cii == coll.end());
203 CHECK (0 == Dummy::checksum());
219 CHECK (0 == Dummy::checksum());
225 CHECK (0 == coll.size());
226 CHECK (0 == Dummy::checksum());
229 CHECK (1 == coll.size());
232 CHECK (2 == coll.size());
234 int sum = Dummy::checksum();
239 CHECK ( 2 == coll.size());
240 CHECK (sum == Dummy::checksum());
243 CHECK (3 == coll.size());
245 CHECK (sum + rr == Dummy::checksum());
251 CHECK (3 == coll.size());
252 CHECK (sum + rr == Dummy::checksum());
255 CHECK (d0.
calc(11) == coll[0].getVal() + 11 );
256 CHECK (d1.calc(22) == rr + 22);
257 CHECK (d2.
calc(33) == rr + 33);
258 CHECK (d2.
calc(0) == rr + (rr+1) );
262 coll.
emplace<SubDummy> (11,22);
264 CHECK ( 1 == coll.size());
265 CHECK (11 == Dummy::checksum());
270 CHECK (d0.
calc(0) == 11 + 22);
273 CHECK (d1.calc(44) == rr + 44);
276 CHECK (0 == Dummy::checksum());
299 CHECK (0 == Dummy::checksum());
302 int trigger = 100 + 5 + 1;
306 CHECK (!isnil (coll));
307 CHECK (6 == coll.size());
308 CHECK (0 != Dummy::checksum());
310 CHECK (coll[0].calc(0) == 0 + rr);
311 CHECK (coll[1].calc(0) == 1 + rr + trigger);
312 CHECK (coll[2].calc(0) == 2 + rr);
313 CHECK (coll[3].calc(0) == 3 + rr + trigger);
314 CHECK (coll[4].calc(0) == 4 + rr);
315 CHECK (coll[5].calc(0) == 5 + rr + trigger);
325 CHECK (0 == Dummy::checksum());
333 CHECK (0 == Dummy::checksum());
336 CHECK (0 == Dummy::checksum());
347 Populator (
int baseOffset,
int triggerCode)
350 , trigg_(triggerCode)
363 storage.
create<SubDummy> (i_+off_, trigg_);
380 CHECK (0 == Dummy::checksum());
384 CHECK (!isnil (coll));
385 CHECK (25 == coll.size());
386 CHECK (0 != Dummy::checksum());
397 verify_subclassPopulator()
399 CHECK (0 == Dummy::checksum());
403 CHECK (!isnil (coll));
404 CHECK (25 == coll.size());
405 CHECK (0 != Dummy::checksum());
413 verify_iteratorPopulator()
418 for (uint i=0; i < source.capacity(); ++i)
419 source.emplace<uint>(i);
421 CollI coll (20, CollI::pull(source.begin()));
423 CHECK (!isnil (coll));
424 CHECK (20 == coll.size());
425 CHECK (25 == source.size());
427 for (uint i=0; i < coll.size(); ++i)
429 CHECK (coll[i] == i );
430 CHECK (coll[i] == source[i]);
434 VERIFY_ERROR (ITER_EXHAUST, CollI (50, CollI::pull (source.begin())));
449 CHECK (sum(50) == object_with_embedded_Collection.useMyNumbers());
457 const CollI my_own_Numbers_;
462 storage.
create<uint>(memberVar_);
469 , my_own_Numbers_(cnt, &ManagerDemo::buildNumbers,
this)
471 CHECK (0 == memberVar_);
472 CHECK (cnt == my_own_Numbers_.size());
void verify_embeddedCollection()
A fixed collection of non-copyable polymorphic objects.
TY & create(ARGS &&...args)
place object of type TY, forwarding ctor arguments
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
#define INSTANCEOF(CLASS, EXPR)
shortcut for subclass test, intended for assertions only.
void building_RAII_Style()
int rani(uint bound=_iBOUND())
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
TY & emplace(ARGS &&...args)
push new entry at the end of this container and build object of type TY in place there ...
virtual long calc(int i)
a dummy API operation
Implementation namespace for support and library code.
Managing a collection of non-copyable polymorphic objects in compact storage.
void building_StackStyle()
Storage Frame to hold one Child object.
Derived specific exceptions within Lumiera's exception hierarchy.
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
unittest helper code: test dummy objects to track instances.
A collection of frequently used helper functions to support unit testing.
A Dummy object for tests.
void populate()
init all elements default constructed
fills the ScopedCollection with default constructed I-instances
void verify_defaultPopulator()
I & emplaceElement()
push a new element of default type to the end of this container
virtual long calc(int i)
special variant of the dummy API operation:
Adapter for building an implementation of the »Lumiera Forward Iterator« concept. ...
Functor to populate the Collection.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.