Signal Mapping Definition Machine¶
This document is in progress
The model definition machine utilizes method cascading with an entry point at
zmbt::api::SignalMapping
class, which consumes a model name.
Each subsequent method call consumes some parameter and transitions to a
subclass of zmbt::mapping::ModelDefinition
that narrows the choices to methods
valid for that specific step, effectively forming a push-down automaton.
This technique simplifies the API usage, enhancing the code completion
and checking certain errors at compilation stage.
Each model is resolved and tested on reaching it's destructor.
The railroad diagram below shows the incomplete BNF definition of the Signal Mapping DSL. Omitted rules may be deduced from introduction given above or from the following documentation.
Channel clauses¶
Each channel node of the model definition starts with InjectTo
or ObserveOn
method,
followed with optional filters. Each filter has one or more mutually exclusive clauses.
The channel definition node is terminated once the new channel started with the
InjectTo
or ObserveOn
method, or when the definition switches to Parameters
or Tests
nodes.
Channel filters:
- Role:
InjectTo
: start stimulus definition on a specified interface.ObserveOn
: start response observation definition on a specified interface.- interface referencing syntax and defaults are the same as for
InterfaceRecord
with one exception: refobj resolves as trigger object if compatible mfp provided.
- Kind:
Return
: address the interface return value by a signal path (JSON Pointer).- default (no args):
"/"
.
- default (no args):
Args
: address the interface arguments tuple by a signal path (JSON Pointer).- default (no args):
"/0"
for unary interfaces,"/"
otherwise (follows the Boost JSON logic).
- default (no args):
CallCount
: address the number of observed interface calls (used for mocks).Exception
: address the interface thrown or observed exceptions.- default kind (when none of the above are specified):
- if on trigger:
Args
forInjectTo
,Return
forObserveOn
. - if on mock:
Args
forObserveOn
,Return
forInjectTo
.
- if on trigger:
- Other:
As
: specify the type decorator for channel signal (see zmbt::SignalOperatorHandler).- default:
zmbt::GenericSignalOperator
, good enough for most cases.
- default:
Call
: specify the interface call number (0-based).- Negative value is resolved as a reverse index, with -1 referring to the last call.
- default:
-1
CallRange
: specify the interface call range in 0-based slice with inclusive boundaries.
Interface referencing¶
WIP