Simulating Functions with void* Parameters

Component Testing for C

When stubbing a function that takes void* type parameters, such as as fct_sim(double c, void * d), the Source Code Parser generates incomplete code that might not compile.

Using void* _out means that the stub has to dereference a pointer to void, which is not possible.

When you are stubbing functions that take void* parameters, you must check and edit the .ptu test script in order to specify the real type that the stub has to dereference.

Example

Consider the following test script generated by the C Source Code Parser:

DEFINE STUB fct_sim_c

#int fct_sim(double _in c, void _inout d);

END DEFINE

 

You should modify the .ptu script like this:

DEFINE STUB fct_sim_c

#int fct_sim(double _in c, unsigned char _inout d);

END DEFINE

 

Or, if testing the parameters is not required:

DEFINE STUB fct_sim_c

#int fct_sim(double _no c, unsigned char _no d);

END DEFINE