Functions Using _inout Mode Arrays

Component Testing for C

To stub a function taking an array in _inout mode, you must provide storage space for the actual parameters of the function.

The function prototype in the .ptu test script remains as usual:

#extern void function(unsigned char *table);

The DEFINE STUB statement however is slightly modified:

DEFINE STUB Funct

#void function(unsigned char _inout table[10]);

END DEFINE

The declaration of the pointer as an array with explicit size is necessary to memorize the actual parameters when calling the stubbed function. For each call you must specify the exact number of required array elements.

ELEMENT

STUB Funct.function 1 => (({'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 0x0},

& {'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', 0x0}))

#call_the_code_under_test();

END ELEMENT

This naming convention compares the actual values and not the pointers.

The following line shows how to pass _inout parameters:

({<in_parameter>},{<out_parameter>})