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

#include "/Werk/devel/lumi/tests/vault/gear/activity-detector.hpp"

Description

Diagnostic context to record and evaluate activations within the Scheduler.

The provided tools and detectors are wired back internally, such as to record any observations into an lib::test::EventLog instance. Thus, after performing rigged functionality, the expected activities and their order can be verified.

See also
ActivityDetector_test

Definition at line 227 of file activity-detector.hpp.

Public Types

using SIG_done = void(Time, size_t)
 
using SIG_post = activity::Proc(Time, Time, Activity *, FakeExecutionCtx &)
 
using SIG_tick = activity::Proc(Time)
 
using SIG_work = void(Time, size_t)
 

Public Member Functions

 ActivityDetector (string id="")
 
ActivitybuildActivationProbe (string id)
 build a rigged HOOK-Activity to record each invocation
 
ActivitybuildActivationTap (Activity const &subject, string id="")
 build ActivationProbe to record each activation before passing it to the subject
 
template<typename SIG >
auto buildDiagnosticFun (string id)
 Generic testing helper: build a λ-mock, logging all invocations. More...
 
ActivitybuildGateWatcher (Activity &gate, string id="")
 
Job buildMockJob (string id="", Time nominal=lib::test::randTime(), size_t extra=rand())
 
JobClosurebuildMockJobFunctor (string id)
 
void clear (string newID)
 
uint currSeq () const
 
ActivityMatch ensureNoInvocation (string fun)
 
uint incrementSeq ()
 increment the internal invocation sequence number
 
ActivityinsertActivationTap (Activity *&wiring, string id="")
 build ActivationProbe to record each activation before passing it to the subject
 
Time invokeTime (Activity const *hook)
 
Time invokeTime (Activity const &hook)
 
 operator string () const
 
string showLog () const
 
ActivityMatch verifyInvocation (string fun)
 
ActivityMatch verifySeqIncrement (uint seqNr)
 
bool wasInvoked (Activity const *hook)
 
bool wasInvoked (Activity const &hook)
 
ActivitywatchGate (Activity *&wiring, string id="")
 

Public Attributes

FakeExecutionCtx executionCtx {*this}
 

Classes

struct  _DiagnosticFun
 
class  ActivityProbe
 A rigged CALLBACK-Activity to watch passing of activations. More...
 
class  DiagnosticFun
 A Mock functor, logging all invocations into the EventLog. More...
 
struct  FakeExecutionCtx
 Mock setup of the execution context for Activity activation. More...
 
class  MockJobFunctor
 A Mocked job operation to detect any actual invocation. More...
 

Private Types

using EventLog = lib::test::EventLog
 
using Logger = _DiagnosticFun< void(string)>::Type
 

Private Attributes

EventLog eventLog_
 
uint invocationSeq_
 
std::deque< ActivityProbemockActs_ {}
 
std::deque< MockJobFunctormockOps_ {}
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Class Documentation

◆ vault::gear::test::ActivityDetector::_DiagnosticFun

struct vault::gear::test::ActivityDetector::_DiagnosticFun
Class Members
typedef typename _Fun< SIG >::Ret Ret
typedef typename _Fun< SIG >::Args Args
typedef typename StripNullType
< Args >::Seq
ArgsX
typedef typename Prepend< Ret,
ArgsX >::Seq
SigTypes
typedef typename
RebindVariadic< DiagnosticFun,
SigTypes >::Type
Type
+ Inheritance diagram for ActivityDetector::_DiagnosticFun< SIG >:
+ Collaboration diagram for ActivityDetector::_DiagnosticFun< SIG >:

Member Function Documentation

◆ buildDiagnosticFun()

auto buildDiagnosticFun ( string  id)
inline

Generic testing helper: build a λ-mock, logging all invocations.

Template Parameters
SIGsignature of the functor to be generated
Parameters
idhuman readable ID, to designate invocations in the log
Returns
a function object with signature #SIG

Definition at line 518 of file activity-detector.hpp.

References EventMatch::id().

Referenced by ActivityDetector_test::simpleUsage().

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

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