Specifying parameters for environments

Component Testing for C

You can specify parameters for environments.

Declare the parameters in the ENVIRONMENT instruction as you would for a service:

ENVIRONMENT compute_histo1(a,b,c,d)

VAR x1, init = a, ev = init

VAR x2, init = b, ev = init

VAR y1, init = c, ev = init

VAR y2, init = d, ev = init

ARRAY histo[0..SIZE_HISTO?1], init = 0, ev = 0

VAR status, init ==, ev = 0

END ENVIRONMENT

The parameters are identifiers, which you can use in variable status instructions, as follows:

  • In initial or expected value expressions

  • In expressions delimiting bounds of arrays in extended mode

The parameters are initialized when they are used:

USE compute_histo1(0,0,SIZE_IMAGE?1,SIZE_IMAGE?1)

The number of values must be strictly equal to the number of parameters defined for the environment. The values can be expressions of any type.