Testing Main Functions
Test RealTime - User Guide
Testing Main Functions
You can use the Component Testing feature to test C language
main
functions. To do
so, you must rename those functions.
Example
#ifdef ATTOL
int test_main (int argc, char** argv)
#else
int main (int argc, char** argv)
#endif
{
...
}
If you are running an runtime analysis feature on the Component Testing test node,
you can also use the -rename command line option to rename the
main
function
name.
See the Instrumentor Line Command Reference section in the Rational Test RealTime
Reference Manual.
Testing Pointers against Pointer Structure Elements
To test pointers against structure elements which are also pointers, specify for each
pointer the variable it is pointing to.
For example, consider the following code:
typedef struct st_Test
{
int a;
int b;
struct st_Test *Ptr1;
}st_Toto;
int FunctionTest (st_Toto *p_toto)
{
int res=0;
if (p_toto != 0)
{
if(p_toto->Ptr1 == 0)
{
res = 1;
}
}
else
{
res = 2;
}
return(res);
}
To test the pointer p_toto, write the following test script:
SERVICE TestFunction
SERVICE_TYPE extern
156