Lumiera  0.pre.03
»edit your freedom«
TypedCounter_test Class Reference

Description

Test:
verify the TypedCounter, which allows to maintain a counter-per-type.

Definition at line 76 of file typed-counter-test.cpp.

Classes

struct  Dummy
 parametrised marker type to designate a counter to be incremented More...
 

Private Member Functions

void run (Arg)
 
void simpleUsageTest ()
 
void tortureTest ()
 

Static Private Member Functions

template<size_t... I>
static auto buildOperatorsTable (std::index_sequence< I... >)
 Helper for tortureTest(): Build a table of functors, where the i-th entry invokes the function increment<i>(), which leads to incrementing the counter for Dummy.
 
template<size_t i>
static void increment (TypedCounter &counter)
 
template<size_t... I>
static size_t sumAllCounters (TypedCounter &counter, std::index_sequence< I... >)
 

Class Documentation

◆ lib::test::TypedCounter_test::Dummy

struct lib::test::TypedCounter_test::Dummy
+ Collaboration diagram for TypedCounter_test::Dummy< i >:

Member Function Documentation

◆ tortureTest()

void tortureTest ( )
inlineprivate
Test:
verify TypedCounter concurrency safety
  • use a set of types Dummy<i> to access a corresponding counter
  • run a large number of threads in parallel, each incrementing a randomly picked counter; this is achieved by using a table of »increment operators«, where each one is tied to a specific Dummy.

Definition at line 177 of file typed-counter-test.cpp.

+ Inheritance diagram for TypedCounter_test:
+ Collaboration diagram for TypedCounter_test:

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