Template Instrumentation
Runtime Analysis
{
if (b ==0 )
{
fprintf ( stderr, "Division by zero\n" );
exit (1 );
};
if (b ==1 )
{
*c =a;
return;
};
*c =a /b;
}
At least two branches per C++ method are defined. The input is always enumerated,
as is the output if it can be covered. If it cannot, it is preceded by a terminal
instruction involving returns or by a call to exit(), abort(), or terminate().
Potentially Terminal Statements
The following decision statements are potentially terminal if they contain at least one
statement that transfers program control out of its sequence (RETURN, THROW,
GOTO, BREAK, CONTINUE) or that terminates the execution (EXIT).
·
IF without an ELSE
·
SWITCH, FOR
·
WHILE or DO...WHILE
Template Instrumentation
Code Coverage performs the instrumentation of templates, functions, and methods
of template classes, considering that all instances share their branches. The number of
branches computed by the feature is independent of the number of instances for this
template. All instances will cover the same once-defined branches in the template
code.
Files containing template definitions implicitly included by the compiler (no specific
compilation command is required for such source files) are also instrumented by the
Code Coverage feature and present in the instrumented files where they are needed.
For some compilers, you must specifically take care of certain templates (for example,
static or external linkage). You must verify if your Code Coverage Runtime
installation contains a file named templates.txt and, if it does, read that file carefully.
·
To instrument an application based upon Rogue Wave libraries , you must use
the -DRW_COMPILE_INSTANTIATE compilation flag that suppresses the
implicit include mechanism in the header files. (Corresponding source files are
so included by pre-processing.)
·
To instrument an application based upon ObjectSpace C++ Component Series ,
you must use the -DOS_NO_AUTO_INSTANTIATE compilation flag that
49