Lumiera  0.pre.03
»edit your freedom«
mock-dispatcher.cpp File Reference

Go to the source code of this file.

Description

Implementation of a dummy render job for unit tests.

Based on using a specifically rigged DummyClosure as JobFunctor, where the actual Job invocation does nothing other than storing the invocation mark and parameters into a invocationLog_ table. Together with the likewise specifically rigged steam::engine::test::MockJobTicket, the invocation hash can be marked, which allows to prove after the invocation that a given Segment or JobTicket actually generated a specific Job, which was then invoked with specific parameters.

Usage front-end

A MockJob can directly created, and then sliced down to the Job baseclass, since it has no additional data fields. The static functions in MockJob allow to verify that a given job instance was created from this setup, that it was invoked, and verify invocation time and extract data

Definition in file mock-dispatcher.cpp.

#include "steam/engine/mock-dispatcher.hpp"
#include "vault/gear/nop-job-functor.hpp"
#include "lib/test/test-helper.hpp"
#include "lib/time/timevalue.hpp"
#include "vault/real-clock.hpp"
#include "lib/null-value.hpp"
#include "lib/hash-value.h"
#include "lib/depend.hpp"
#include "lib/util.hpp"
#include <cstdlib>
#include <functional>
#include <unordered_map>

Classes

class  DummyClosure
 MockJob objects are backed by this closure. More...
 
struct  DummyClosure::Invocation
 

Functions

const int MAX_PARAM_A (1000)
 random test values 0...1000
 
const int MAX_PARAM_B (10)
 random test values -10...+10
 

Variables

DummyClosure dummyClosure
 actual instance of the test dummy job functor
 
lib::Depend< vault::gear::NopJobFunctornopFunctor
 access to the fallback-implementation for empty segments
 

Namespaces

 steam
 Steam-Layer implementation namespace root.
 
 steam::engine
 Lumiera's render engine core and operational control.