Stub Simulation

Component Testing for Ada

Stub simulation is based on the idea that subroutines to be simulated are replaced with other subroutines generated in the test driver. These simulated subroutines are often referred to as stubs.

Stubs use the same interface as the simulated subroutines, only the body of the subroutine is replaced.

Stubs have the following roles:

To generate stubs, the Test Script Compiler needs to know the specification of the compilation units that are to be simulated.

Passing parameters by pointer can lead to problems of ambiguity regarding the data actually passed to the function. For example, a parameter that is described in a prototype by int *x can be passed in the following way:

int *x as input ==> f(x)

int x as output or input/output ==> f(&x)

int x[10] as input ==> f(x)

int x[10] as output or input/output ==> f(x)

 

Therefore, to define a stub, you must specify the following information:

Example

An example project called Stub Ada is available from the Examples section of the Start page. This example demonstrates the use of stubs in Component Testing for Ada. See Example projects for more information.

Related Topics

Defining stubsUsing StubsAda Syntax ExtensionsAdvanced Stubs (Ada)Example projects