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

#include "/Werk/devel/lumi/tests/core/steam/engine/mock-dispatcher.hpp"

Description

Mock setup for a JobTicket to generate dummy render Job invocations.

Implemented as subclass, it provides a specification DSL for tests, and is able to probe some otherwise opaque internals of JobTicket. Beyond that, MockJobTicket has the same storage size; and behaves like the regular JobTicket after construction – but any Job created by JobTicket::createJobFor(nominalTime) will be wired with the MockJob functor and can thus be related back to the test specification setup.

See also
JobPlanningPipeline_test
DispatcherInterface_test

Definition at line 136 of file mock-dispatcher.hpp.

Static Public Member Functions

static bool isAssociated (Job const &, JobTicket const &)
 convenience shortcut to perform this test on arbitrary JobTicket and Job instances.
 

Public Member Functions

 MockJobTicket ()
 
 MockJobTicket (HashVal seed)
 
bool verify_associated (Job const &) const
 verify the given job instance was actually generated from this JobTicket.
 
- Public Member Functions inherited from JobTicket
template<class ALO >
 JobTicket (ExitNode const &exitNode, ALO &allocator)
 
bool empty () const
 
bool isValid () const
 
auto getPrerequisites ()
 Core operation: iterate over the prerequisites, required to carry out a render operation based on this blueprint.
 
Job createJobFor (Time nominalTime)
 Core operation: build a concrete render job based on this blueprint.
 
Duration getExpectedRuntime ()
 Core operation: guess expected runtime for rendering.
 

Private Member Functions

auto & allocator ()
 
- Private Member Functions inherited from AllocatorHandle< JobTicket >
JobTicket & operator() (ARGS &&...args)
 
 ~AllocatorHandle ()
 

Static Private Member Functions

static ExitNode defineSimpleSpec (HashVal seed=ranHash())
 provide a test specification wired to MockJob
 

Additional Inherited Members

- Static Public Attributes inherited from JobTicket
static JobTicket NOP {}
 special »do nothing« JobTicket marker
 
- Protected Member Functions inherited from JobTicket
bool verifyInstance (JobFunctor &, InvocationInstanceID const &, Time) const
 Helper for tests: verify the given invocation parameters match this JobTicket.
 
- Static Protected Member Functions inherited from JobTicket
static InvocationInstanceID timeHash (Time, InvocationInstanceID const &)
 Tag the precomputed invocation ID with the nominal frame time.
 

Constructor & Destructor Documentation

◆ MockJobTicket() [1/2]

MockJobTicket ( )
inline

Definition at line 156 of file mock-dispatcher.hpp.

◆ MockJobTicket() [2/2]

MockJobTicket ( HashVal  seed)
inline

Definition at line 160 of file mock-dispatcher.hpp.

Member Function Documentation

◆ allocator()

auto & allocator ( )
inlineprivate

Definition at line 141 of file mock-dispatcher.hpp.

◆ defineSimpleSpec()

static ExitNode defineSimpleSpec ( HashVal  seed = ranHash())
inlinestaticprivate

provide a test specification wired to MockJob

Definition at line 148 of file mock-dispatcher.hpp.

References MockJob::getFunctor().

+ Here is the call graph for this function:

◆ verify_associated()

bool verify_associated ( Job const &  job) const
inline

verify the given job instance was actually generated from this JobTicket.

Remarks
this test support function relies on some specific rigging, which typically is prepared by setup of a MockJobTicket.

Definition at line 284 of file mock-dispatcher.hpp.

References JobTicket::isValid(), and JobTicket::verifyInstance().

Referenced by MockJobTicket::isAssociated(), and MockSupport_test::verify_MockJobTicket().

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

◆ isAssociated()

bool isAssociated ( Job const &  job,
JobTicket const &  ticket 
)
inlinestatic

convenience shortcut to perform this test on arbitrary JobTicket and Job instances.

Warning
a positive test result however relies on some casting trickery and there is no guarantee this test works if the JobTicket was not created from this mock framework.

Definition at line 300 of file mock-dispatcher.hpp.

References MockJobTicket::verify_associated().

Referenced by JobPlanningPipeline_test::demonstrateScaffolding(), MockSupport_test::simpleUsage(), MockDispatcher::verify(), and MockSupport_test::verify_MockSegmentation().

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

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