DEFINE STUB ... END DEFINE
Ada Test Script Language
Purpose
The DEFINE STUB and END DEFINE instructions delimit a simulation block consisting of stub definition declarations written in Ada.
Syntax
DEFINE STUB <stub_name> [ <stub_dim> ]
END DEFINE
where:
<stub_name> is the mandatory name of a simulation block.
<stub_dim> is an optional maximum number of stub call descriptions for a test scenario. By default, its value is 10.
Description
Defining stubs in a test script is optional.
DEFINE STUB / END DEFINE blocks must be located after the BEGIN instruction and outside any SERVICE block.
Using the stub definitions, the Ada Test Script Compiler generates simulation variables and functions for which the interface is identical to that of the stubbed variables and functions.
The purpose of these simulation variables and functions is to store and test input parameters, assign values to output parameters, and if necessary, return appropriate values.
All functions and procedures of the <stub_name> package are simulated, and stub definitions are Ada declarations (beginning with '#') of functions, procedures, or assignment instructions.
Stub parameters describe both the type of item used by the calling function and the mode of passing. The mode of passing the parameter is specified by adding the following before the parameter name:
in for input parameters
out for output parameters
in out for input/output parameters
_no for parameters that you do not want to test
Additionally, when using the in or in out parameters, you can add an optional _nocheck parameter before the in or in out parameter (see the Example paragraph). This allows the parameters to be sent to the stub without being checked.
The parameter mode is optional. If no parameter mode is specified, the in mode is assumed by default.
A return parameter is always deemed to be an output parameter.
Global variables defined in DEFINE STUB blocks replace the real global variables.
Example
An example of the use of stubs is available in the StubAda example project installed with the application.
Related Topics