Lumiera  0.pre.03
»edit your freedom«
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 143 of file mock-dispatcher.hpp.

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

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

Static Private Member Functions

static ExitNode defineSimpleSpec (HashVal seed=1+rand())
 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.
 

Member Function Documentation

◆ 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 291 of file mock-dispatcher.hpp.

Referenced by MockJobTicket::isAssociated().

+ 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 307 of file mock-dispatcher.hpp.

References MockJobTicket::verify_associated().

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

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