Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
LinkedElements_test Class Reference

Description

Test:
cover our custom single linked list template, in combination with Lumiera Forward Iterators and the usage of a custom allocator.

Definition at line 170 of file linked-elements-test.cpp.

Classes

struct  UseAllocationCluster
 Policy to use an Allocation cluster, but also to invoke all object destructors. More...
 

Private Member Functions

virtual void run (Arg)
 
void simpleUsage ()
 
void iterating ()
 
void reverseList ()
 
void verify_nonOwnership ()
 
void verify_ExceptionSafety ()
 
void populate_by_iterator ()
 
void verify_RAII_safety ()
 
void verify_customAllocator ()
 

Member Function Documentation

◆ run()

virtual void run ( Arg  )
inlineprivatevirtual

◆ simpleUsage()

void simpleUsage ( )
inlineprivate

Definition at line 189 of file linked-elements-test.cpp.

References Dummy::checksum(), and lib::elements().

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ iterating()

void iterating ( )
inlineprivate

Definition at line 230 of file linked-elements-test.cpp.

References Dummy::checksum(), lib::elements(), and VERIFY_ERROR.

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reverseList()

void reverseList ( )
inlineprivate

Definition at line 285 of file linked-elements-test.cpp.

References Dummy::checksum().

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verify_nonOwnership()

void verify_nonOwnership ( )
inlineprivate
Test:
add some node elements to the LinkedElements list but without taking ownership or performing any memory management. This usage pattern is helpful when the node elements are already managed elsewhere.
Note
we're still (intrusively) using the next pointer within the node elements. This means, that still a given node can't be member in multiple lists.

Definition at line 355 of file linked-elements-test.cpp.

References Dummy::checksum(), and lib::elements().

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verify_ExceptionSafety()

void verify_ExceptionSafety ( )
inlineprivate

Definition at line 390 of file linked-elements-test.cpp.

References Dummy::checksum(), lib::elements(), and VERIFY_ERROR.

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populate_by_iterator()

void populate_by_iterator ( )
inlineprivate

Definition at line 419 of file linked-elements-test.cpp.

References Dummy::checksum(), and lib::elements().

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verify_RAII_safety()

void verify_RAII_safety ( )
inlineprivate
Test:
to support using LinkedElements within RAII-style components, all the elements might be added in one sway, by pulling them from a Lumiera Forward Iterator. In case this is done in the ctor, any exception while doing so will trigger cleanup of all elements (and then failure of the ctor altogether)

Definition at line 451 of file linked-elements-test.cpp.

References Dummy::checksum(), lib::elements(), and VERIFY_ERROR.

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verify_customAllocator()

void verify_customAllocator ( )
inlineprivate
Test:
use custom allocator to create list elements
  • a dedicated policy allows to refer to an existing AllocationCluster and to arrange for all object destructors to be called when this cluster goes out of scope
  • a C++ standard allocator can also be used; as an example, again an AllocationCluster is used, but this time with the default adapter, which places objects tight and skips invocation of destructors; however, since the LinkedElements destructor is called, it walks all elements and delegates through std::allocator_traits, which will invoke the (virtual) base class destructors.

Definition at line 499 of file linked-elements-test.cpp.

References Dummy::checksum(), lib::elements(), EXPECT, AllocationCluster::getAllocator(), and AllocationCluster::numBytes().

Referenced by LinkedElements_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
+ Inheritance diagram for LinkedElements_test:
+ Collaboration diagram for LinkedElements_test:

The documentation for this class was generated from the following file: