39 using std::this_thread::sleep_for;
40 using std::chrono_literals::operator
""us;
53 const uint NUM_THREADS = 75;
54 const uint MAX_RAND = 100*1000;
56 auto isOdd = [](
auto val) {
return bool (val % 2); };
71 typedef std::vector<uint> VecI;
94 verify_simpleAccess();
95 verify_heavilyParallelUsage();
138 CHECK (3 == loggedValues.size());
139 CHECK (2 == loggedValues[0]);
140 CHECK (1 == loggedValues[1]);
141 CHECK (0 == loggedValues[2]);
165 auto verifyResult = [](VecI sequence)
168 for (uint val : sequence)
170 CHECK (isOdd(val) and val > prev);
175 std::array<TestThread, NUM_THREADS> testcases;
181 for (
auto& res : results)
192 ,&verifyDiagnosticStack)
204 uint seed (1 + rand() % MAX_RAND);
205 return descend (seed);
209 descend (uint current)
218 Marker remember(current);
219 return descend (current+1);
222 return descend (current/2);
Variant of the standard case, requiring to wait and join() on the termination of this thread...
build a call stack within separate thread and capture diagnostics
static VecI verifyDiagnosticStack()
the actual test operation running in a separate thread produces a descending number sequence...
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
Facility for collecting diagnostic context information explicitly.
void verify_simpleAccess()
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Implementation namespace for support and library code.
ThreadJoinable(string const &, FUN &&, ARGS &&...) -> ThreadJoinable< std::invoke_result_t< FUN, ARGS... >>
deduction guide: find out about result value to capture from a generic callable.
Simple test class runner.
lib::Result< RES > join()
put the caller into a blocking wait until this thread has terminated
Convenience front-end to simplify and codify basic thread handling.
A collection of frequently used helper functions to support unit testing.
Diagnostic data frame to collect specific information concerning a scope.
ExampleStrategy::Qualifier two(string additionalArg)
definition of another qualifier two(arg), accepting an additional argument
static DiagnosticContext & access()
accessing the innermost diagnostic context created
Building tree expanding and backtracking evaluations within hierarchical scopes.
ExampleStrategy::Qualifier one()
definition of a qualifier one()
void verify_heavilyParallelUsage()
static ValSequence extractStack()
snapshot of the current stack of diagnostic frames