Statement Coverage
Statement Coverage measures how many statements in the source code are executed during test.
Testwell CTC++ counts statements the following way:
- each semicolon is counted as one statement,
- control statements, which can be written without ";" (like
if
) are counted as one statement, - empty compound statements, i.e. "{}", are counted as one statement,
- statements outside of functions are not counted.
The source code in the following example contains six statements: The
if
-statement in line 2, and the five statements followed by a semicolon
in lines 3, 4, 5, 7 and 11. Three of them (if
, return
and call to foo
) have been executed.
Note: Statement coverage is reported
- with ctcreport: option
-measures ...,s,...
, - with ctcpost by default.