libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
Testing processors

Description

Processors for unit testing of processors.

Functions

template<typename EventList>
auto tcspc::capture_output (access_tracker< capture_output_access > &&tracker)
 Create a sink that records the output of a processor under test.
template<typename Downstream>
auto tcspc::feed_input (feed_as value_category, Downstream downstream)
 Create a source for feeding test input to a processor under test.
template<typename EventList>
auto tcspc::sink_event_list ()
 Create a processor that ignores only specific event types.
template<typename... Event>
auto tcspc::sink_events ()
 Create a processor that ignores only specific event types.

Function Documentation

◆ capture_output()

template<typename EventList>
auto tcspc::capture_output ( access_tracker< capture_output_access > && tracker)

Create a sink that records the output of a processor under test.

In order to access the recorded output or arrange to simulate errors and end-of-processing, use a tcspc::capture_output_access (usually accessed through the wrapper tcspc::capture_output_checker) retrieved from the tcspc::context from which tracker was obtained.

Template Parameters
EventListevent set to accept
Parameters
trackeraccess tracker for later access to state
Returns
processor
Events handled

◆ feed_input()

template<typename Downstream>
auto tcspc::feed_input ( feed_as value_category,
Downstream downstream )

Create a source for feeding test input to a processor under test.

In addition to handle(), flush(), and introspection, the processor has this member function:

  • void require_output_checked(std::shared_ptr<tcspc::context> context, std::string name): register a tcspc::capture_output processor whose recorded output should be fully checked or popped before events (or flush) are fed.

At least one output must be registered with this function before feeding input events (via handle()), or else std::logic_error is thrown.

Events are fed according to value_category, making a copy if necessary (when the event is an lvalue and tcspc::feed_as::rvalue is requested). Thus, the value category of the event passed to handle() does not affect how it is fed to the processor under test.

Template Parameters
Downstreamdownstream processor type (usually deduced)
Parameters
value_categoryvalue category (kind of reference) used to feed event
downstreamdownstream processor (processor under test)
Returns
processor
Events handled
  • Any type handled by Downstream: check that registered outputs have no unchecked recorded events pending; pass through as value_category
  • Flush: check that the registered outputs have been checked; pass through

◆ sink_event_list()

template<typename EventList>
auto tcspc::sink_event_list ( )

Create a processor that ignores only specific event types.

This can be used for compile-time checks of the output event types of a processor.

Template Parameters
EventListevent types to accept
Events handled
  • Events in EventList: consume with no action
  • Flush: consume with no action

◆ sink_events()

template<typename... Event>
auto tcspc::sink_events ( )

Create a processor that ignores only specific event types.

This can be used for compile-time checks of the output event types of a processor.

Template Parameters
Eventevent types to accept
Events handled
  • Events in Event...: consume with no action
  • Flush: consume with no action