40 using LERR_(ITER_EXHAUST);
74 throw error::Fatal(
"simulated error", LUMIERA_ERROR_PROVOKED_FAILURE);
88 Num (
int i=0,
int j=0,
int k=0)
117 uint current = num->getVal();
118 if (maxNum_ <= current)
121 num =
new Nummy(current+1);
132 :
public NummyGenerator::iterator
235 for (
uint i=1; i<=NUM_ELEMENTS; ++i)
240 int check=NUM_ELEMENTS;
241 List::iterator ii =
elements.begin();
244 CHECK (check == ii->getVal());
245 CHECK (check == ii->calc(+5) - 5);
254 check = NUM_ELEMENTS;
255 List::const_iterator cii = const_elm.begin();
258 CHECK (check == cii->getVal());
273 CHECK (ii == List::iterator());
275 CHECK (cii == List::const_iterator());
290 CHECK (isnil (list));
292 CHECK (isnil (list));
295 list.emplace<Nummy>(1);
296 CHECK (not isnil (list));
297 CHECK (1 == list[0].getVal());
301 CHECK (1 == list[0].getVal());
302 CHECK (not isnil (list));
304 list.emplace<Nummy>(2);
305 CHECK (not isnil (list));
306 CHECK (2 == list.size());
307 CHECK (2 == list[0].getVal());
311 CHECK (1 == list[0].getVal());
312 CHECK (2 == list.size());
314 list.emplace<Nummy>(3);
315 CHECK (3 == list.size());
316 CHECK (3 == list.top().getVal());
319 CHECK (2 == list[0].getVal());
320 CHECK (1 == list[1].getVal());
321 CHECK (3 == list[2].getVal());
322 List::iterator ii = list.begin();
323 CHECK (2 == ii->getVal());
325 CHECK (1 == ii->getVal());
327 CHECK (3 == ii->getVal());
332 list.emplace<Nummy>(4);
333 CHECK (4 == list.top().getVal());
334 CHECK (3 == list[3].getVal());
336 CHECK (3 == list[0].getVal());
337 CHECK (1 == list[1].getVal());
338 CHECK (2 == list[2].getVal());
339 CHECK (4 == list[3].getVal());
377 CHECK (isSameObject(n2,
elements[2]));
378 CHECK (isSameObject(n4,
elements[1]));
379 CHECK (isSameObject(n6,
elements[0]));
412 __triggerError_reset();
423 Populator yieldSomeElements(NUM_ELEMENTS);
427 CHECK (NUM_ELEMENTS ==
elements.size());
430 int check=NUM_ELEMENTS;
431 List::iterator ii =
elements.begin();
434 CHECK (check == ii->getVal());
456 Populator yieldSomeElements(NUM_ELEMENTS);
460 __triggerError_reset();
477 template<
class TY,
typename...ARGS>
511 const size_t EXPECT =
sizeof(Num<1>) +
sizeof(Num<3>) +
sizeof(Num<6>)
517 CHECK (1+2 ==
elements[2].getVal());
518 CHECK (3+4+5 ==
elements[1].getVal());
519 CHECK (6+7+8+9 ==
elements[0].getVal());
539 const size_t EXPECT =
sizeof(Num<1>) +
sizeof(Num<3>);
544 CHECK (1+2 ==
elements[1].getVal());
545 CHECK (3+4+5 ==
elements[0].getVal());
Memory management for the low-level model (render nodes network).
A pile of objects sharing common allocation and lifecycle.
Allocator< X > getAllocator()
Iteration source interface to abstract a data source, which then can be accessed through IterAdapter ...
Intrusive single linked list, possibly taking ownership of node elements.
A Dummy object for tests.
void verify_customAllocator()
void verify_ExceptionSafety()
void verify_RAII_safety()
void populate_by_iterator()
void verify_nonOwnership()
Helper to produce a pre-determined series of objects to populate a LinkedElements list.
virtual void nextResult(Pos &num)
iteration step: switch on to the next element.
NummyGenerator(uint maxElms)
virtual Pos firstResult()
iteration start: prepare the first element.
Iterator-Frontend to generate this series of objects.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.
Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.
Intrusive single linked list with optional ownership.
void __triggerErrorAt(int i)
void __triggerError_reset()
LinkedElements< Nummy, linked_elements::NoOwnership > ListNotOwner
managing existing node elements without taking ownership
LinkedElements< Nummy > List
default case: ownership for heap allocated nodes
Implementation namespace for support and library code.
IterQueue< T > elements(T const &elm)
convenience free function to build an iterable sequence
LumieraError< LERR_(FATAL), Logic > Fatal
Test runner and basic definitions for tests.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Policy to use an Allocation cluster, but also to invoke all object destructors.
TY * create(ARGS &&...args)
UseAllocationCluster(CustomAllocator clu)
AllocationCluster & CustomAllocator
to demonstrate holding subclasses
Num(int i=0, int j=0, int k=0)
Test-Element, supporting intrusive linked list storage.
A collection of frequently used helper functions to support unit testing.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
unittest helper code: test dummy objects to track instances.
#define EXPECT(_TY_, RENDERED_STRUCTURE)
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...