...
Note | ||
---|---|---|
| ||
To optimize performance, the Coverage view starts in a uninitialized mode—displaying only project-level coverage summaries. This mode is indicated with grayed project icons: Coverage in this mode may not be current—for instance, if the source code was modified outside of this IDE. You can update the coverage view by simply expand expanding a project node. Or, you can wait for the view to to be automatically updated during execution. |
...
- Line Coverage
- Statement Coverage
- Block Coverage
- Path Coverage
- Decision (Branch) Coverage
- Modified Condition/Decision Coverage (MC/DC)
- Simple Condition Coverage
- Function Coverage
- Call Coverage
To help understand how these coverage types are handled by C++test, be sure to read and understand the terms in the following table:
...
Indicates how many functions in the source code were reached at least once during execution. Complete, 100% function coverage is obtained if all functions are reached at least once.
Call Coverage
Indicates how many defined function or method calls were executed at program runtime. Complete, 100% call coverage is obtained if all functions or methods calls were executed.
Limitations:
- Constructors calls, both explicit and implicit, are not included in call coverage calculation.
- Implicit destructor calls are not included in call coverage calculation.
- C++ operators, both predefined and overloaded, are not included in call coverage calculation.
Example:
Code Block |
---|
class A
{
public:
A() {}
A(const A&) {}
A(int val) {}
A& foo()
{
return *this;
}
~A() {}
};
void funcA(const A& a) {}
A& operator+(const A & a, const A & b) {}
void defaultConstructorCall()
{
A objA; // Default constructor call - not included
A objArr[10]; // Default constructor calls - not included
A objB = objA; // Copy constructor call - not included
A objC = 10; // Implicit call of A(int) constructor - not included
funcA(10); // Implicit call of A(int) constructor - not included
A res = objA + objA; // Operator + call - not included
// Copy constructor call - not included
A* objD = new A(); // Default constructor call - not included
// Operator new call - not included
delete objD; // Destructor call - not included
// Operator new call - not included
A* objE = new A[10]; // Default constructor calls - not included
// Operator new call - not included
delete[] objE; // Destructor calls - not included
// Implicit destructor calls - not included
} |
Line Coverage
Indicates how many executable lines of source code were reached by the control flow at least once. Complete, 100% line coverage is obtained if all executable lines are reached at least once.
...