Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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 221 of file activity-detector.hpp.

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...
 

Public Types

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

Public Attributes

FakeExecutionCtx executionCtx {*this}
 

Public Member Functions

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

Private Types

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

Private Attributes

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

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ ActivityDetector()

ActivityDetector ( string  id = "")
inline

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


Class Documentation

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

struct vault::gear::test::ActivityDetector::_DiagnosticFun
Class Members
typedef Ret Ret
typedef Args Args
typedef Seq SigTypes
typedef Type Type
+ Inheritance diagram for ActivityDetector::_DiagnosticFun< SIG >:
+ Collaboration diagram for ActivityDetector::_DiagnosticFun< SIG >:

Member Typedef Documentation

◆ EventLog

using EventLog = lib::test::EventLog
private

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

◆ Logger

using Logger = _DiagnosticFun<void(string)>::Type
private

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

◆ SIG_post

◆ SIG_work

using SIG_work = void(Time, size_t)

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

◆ SIG_done

using SIG_done = void(Time, size_t)

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

◆ SIG_tick

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

Member Function Documentation

◆ operator string()

operator string ( ) const
inline

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

References ActivityDetector::eventLog_, and util::join().

+ Here is the call graph for this function:

◆ showLog()

string showLog ( ) const
inline

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

References ActivityDetector::eventLog_, and util::join().

+ Here is the call graph for this function:

◆ clear()

void clear ( string  newID)
inline

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

References EventLog::clear(), and ActivityDetector::eventLog_.

+ Here is the call graph for this function:

◆ incrementSeq()

◆ currSeq()

uint currSeq ( ) const
inline

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

References ActivityDetector::invocationSeq_.

Referenced by ActivityDetector_test::verifyMockInvocation().

+ Here is the caller graph for this function:

◆ buildDiagnosticFun()

template<typename SIG >
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 511 of file activity-detector.hpp.

References ActivityDetector::eventLog_, and ActivityDetector::invocationSeq_.

Referenced by ActivityDetector_test::simpleUsage(), ActivityDetector_test::verifyFakeInvocation(), and ActivityDetector_test::verifyMockInvocation().

+ Here is the caller graph for this function:

◆ buildMockJobFunctor()

JobClosure & buildMockJobFunctor ( string  id)
inline

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

References ActivityDetector::mockOps_.

Referenced by ActivityDetector::buildMockJob(), SchedulerActivity_test::verifyActivity_Invoke(), ActivityDetector_test::verifyMockJobFunctor(), and ActivityDetector_test::watch_ActivationTap().

+ Here is the caller graph for this function:

◆ buildMockJob()

Job buildMockJob ( string  id = "",
Time  nominal = lib::test::randTime(),
size_t  extra = rani() 
)
inline

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

References ActivityDetector::buildMockJobFunctor(), extra, InvocationInstanceID::part, and util::toString().

Referenced by SchedulerCommutator_test::integratedWorkCycle(), SchedulerActivity_test::scenario_IOJob(), SchedulerActivity_test::scenario_MetaJob(), SchedulerActivity_test::scenario_Notification(), SchedulerActivity_test::scenario_RenderJob(), SchedulerService_test::scheduleRenderJob(), and SchedulerActivity_test::termBuilder().

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

◆ buildActivationProbe()

Activity & buildActivationProbe ( string  id)
inline

build a rigged HOOK-Activity to record each invocation

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

References ActivityDetector::eventLog_, ActivityDetector::invocationSeq_, and ActivityDetector::mockActs_.

Referenced by ActivityDetector::insertActivationTap(), SchedulerService_test::invokeWorkFunction(), ActivityDetector_test::watch_ActivationProbe(), and ActivityDetector::watchGate().

+ Here is the caller graph for this function:

◆ buildActivationTap()

Activity & buildActivationTap ( Activity const &  subject,
string  id = "" 
)
inline

build ActivationProbe to record each activation before passing it to the subject

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

References ActivityDetector::eventLog_, ActivityDetector::invocationSeq_, ActivityDetector::mockActs_, util::showAdr(), and Activity::showVerb().

Referenced by ActivityDetector::buildGateWatcher(), ActivityDetector::insertActivationTap(), and ActivityDetector_test::watch_ActivationTap().

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

◆ insertActivationTap()

Activity & insertActivationTap ( Activity *&  wiring,
string  id = "" 
)
inline

build ActivationProbe to record each activation before passing it to the subject

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

References ActivityDetector::buildActivationProbe(), ActivityDetector::buildActivationTap(), and util::showAdr().

Referenced by ActivityDetector::buildGateWatcher(), ActivityDetector_test::insert_ActivationTap(), SchedulerActivity_test::scenario_MetaJob(), SchedulerActivity_test::scenario_Notification(), and ActivityDetector_test::watch_notification().

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

◆ buildGateWatcher()

Activity & buildGateWatcher ( Activity gate,
string  id = "" 
)
inline

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

References ActivityDetector::buildActivationTap(), ActivityDetector::insertActivationTap(), Activity::next, util::showAdr(), and Activity::showVerb().

Referenced by SchedulerActivity_test::verifyActivity_Gate_block(), SchedulerActivity_test::verifyActivity_Gate_dead(), SchedulerActivity_test::verifyActivity_Gate_notify(), SchedulerActivity_test::verifyActivity_Gate_opened(), SchedulerActivity_test::verifyActivity_Gate_pass(), and ActivityDetector::watchGate().

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

◆ watchGate()

Activity & watchGate ( Activity *&  wiring,
string  id = "" 
)
inline

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

References ActivityDetector::buildActivationProbe(), ActivityDetector::buildGateWatcher(), and util::showAdr().

Referenced by SchedulerActivity_test::dispatchChain(), SchedulerCommutator_test::integratedWorkCycle(), SchedulerActivity_test::scenario_Notification(), SchedulerActivity_test::scenario_RenderJob(), and ActivityDetector_test::watch_gate().

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

◆ invokeTime() [1/2]

Time invokeTime ( Activity const *  hook)
inline

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

References ActivityDetector::ActivityProbe::lastInvoked().

Referenced by SchedulerService_test::invokeWorkFunction(), ActivityDetector::wasInvoked(), and ActivityDetector_test::watch_ActivationProbe().

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

◆ wasInvoked() [1/2]

bool wasInvoked ( Activity const *  hook)
inline

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

References ActivityDetector::invokeTime(), and TimeValue::isRegular().

Referenced by ActivityDetector_test::watch_ActivationProbe().

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

◆ invokeTime() [2/2]

Time invokeTime ( Activity const &  hook)
inline

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

References ActivityDetector::invokeTime().

Referenced by ActivityDetector::invokeTime().

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

◆ wasInvoked() [2/2]

bool wasInvoked ( Activity const &  hook)
inline

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

References ActivityDetector::wasInvoked().

Referenced by ActivityDetector::wasInvoked().

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

◆ verifyInvocation()

ActivityMatch verifyInvocation ( string  fun)
inline

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

References ActivityDetector::eventLog_, and EventLog::verifyCall().

Referenced by SchedulerCommutator_test::demonstrateSimpleUsage(), SchedulerActivity_test::dispatchChain(), ActivityDetector_test::insert_ActivationTap(), SchedulerActivity_test::scenario_IOJob(), SchedulerActivity_test::scenario_MetaJob(), SchedulerActivity_test::scenario_Notification(), SchedulerActivity_test::scenario_RenderJob(), SchedulerActivity_test::simpleUsage(), SchedulerActivity_test::termBuilder(), SchedulerActivity_test::verifyActivity_Gate_block(), SchedulerActivity_test::verifyActivity_Gate_dead(), SchedulerActivity_test::verifyActivity_Gate_notify(), SchedulerActivity_test::verifyActivity_Gate_opened(), SchedulerActivity_test::verifyActivity_Gate_pass(), SchedulerActivity_test::verifyActivity_Invoke(), SchedulerActivity_test::verifyActivity_Notify(), SchedulerActivity_test::verifyActivity_Post(), ActivityDetector_test::verifyFakeExeContext(), ActivityDetector_test::verifyFakeInvocation(), ActivityDetector_test::verifyMockInvocation(), ActivityDetector_test::verifyMockJobFunctor(), ActivityDetector_test::watch_ActivationProbe(), ActivityDetector_test::watch_ActivationTap(), ActivityDetector_test::watch_gate(), and ActivityDetector_test::watch_notification().

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

◆ ensureNoInvocation()

ActivityMatch ensureNoInvocation ( string  fun)
inline

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

References EventLog::ensureNot(), ActivityDetector::eventLog_, and EventMatch::locateCall().

Referenced by SchedulerActivity_test::dispatchChain(), SchedulerCommutator_test::integratedWorkCycle(), SchedulerActivity_test::scenario_IOJob(), SchedulerActivity_test::scenario_Notification(), SchedulerActivity_test::verifyActivity_Gate_opened(), ActivityDetector_test::verifyFakeExeContext(), ActivityDetector_test::verifyMockInvocation(), ActivityDetector_test::verifyMockJobFunctor(), and ActivityDetector_test::watch_ActivationTap().

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

◆ verifySeqIncrement()

ActivityMatch verifySeqIncrement ( uint  seqNr)
inline

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

References ActivityDetector::eventLog_, util::toString(), and EventLog::verifyEvent().

Referenced by SchedulerCommutator_test::integratedWorkCycle(), SchedulerService_test::scheduleRenderJob(), SchedulerActivity_test::verifyActivity_Gate_opened(), SchedulerActivity_test::verifyActivity_Notify(), ActivityDetector_test::verifyMockInvocation(), and ActivityDetector_test::watch_ActivationTap().

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

Member Data Documentation

◆ eventLog_

◆ invocationSeq_

◆ mockOps_

std::deque<MockJobFunctor> mockOps_ {}
private

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

Referenced by ActivityDetector::buildMockJobFunctor().

◆ mockActs_

std::deque<ActivityProbe> mockActs_ {}
private

◆ executionCtx

+ Inheritance diagram for ActivityDetector:
+ Collaboration diagram for ActivityDetector:

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