Example of CTC++ Execution Profile Listing

*****************************************************************************
*           CTC++, Test Coverage Analyzer for C/C++, Version 8.1            *
*                                                                           *
*                         EXECUTION PROFILE LISTING                         *
*                                                                           *
*                    Copyright (c) 1993-2013 Testwell Oy                    *
*             Copyright (c) 2013-2016 Verifysoft Technology GmbH            *
*****************************************************************************

Symbol file(s) used   : MON.sym (Wed Nov 23 13:07:08 2016)
Data file(s) used     : MON.dat (Wed Nov 23 13:08:23 2016)
Listing produced at   : Wed Nov 23 13:09:53 2016
Coverage view         : As instrumented
 
MONITORED SOURCE FILE : F:\ctcwork\v81\doc\examples\prime.c
INSTRUMENTATION MODE  : multicondition
 HITS/TRUE      FALSE    LINE DESCRIPTION
=============================================================================
         1                  8 FUNCTION main()
         3          1      12   while (( prime_candidate = io_ask ( ) ) > 0)
         2          1      14     if (is_prime ( prime_candidate ))
                           15     }+
                           16     else
                           17     }+
                           18   }+
         1                 19   return 0
                           20 }
***TER 100 % (  6/  6) of FUNCTION main()
       100 % (  6/  6) statement
-----------------------------------------------------------------------------

***TER 100 % (  6/  6) of FILE F:\ctcwork\v81\doc\examples\prime.c
       100 % (  6/  6) statement
-----------------------------------------------------------------------------
 
MONITORED SOURCE FILE : F:\ctcwork\v81\doc\examples\io.c
INSTRUMENTATION MODE  : multicondition
 HITS/TRUE      FALSE    LINE DESCRIPTION
=============================================================================
         4                  5 FUNCTION io_ask()
         0          4 -    11   if (( amount = scanf ( "%u" , & val ) ) <= 0)
                           13   }+
         4                 14   return val
                           15 }
***TER  75 % (  3/  4) of FUNCTION io_ask()
        83 % (  5/  6) statement
-----------------------------------------------------------------------------
         3                 18 FUNCTION io_report()
         3                 21 }
***TER 100 % (  2/  2) of FUNCTION io_report()
       100 % (  1/  1) statement
-----------------------------------------------------------------------------

***TER  83 % (  5/  6) of FILE F:\ctcwork\v81\doc\examples\io.c
        86 % (  6/  7) statement
-----------------------------------------------------------------------------
 
MONITORED SOURCE FILE : F:\ctcwork\v81\doc\examples\calc.c
INSTRUMENTATION MODE  : multicondition
 HITS/TRUE      FALSE    LINE DESCRIPTION
=============================================================================
         3                  4 FUNCTION is_prime()
         1          2       8   if (val == 1 || val == 2 || val == 3)
         0            -     8     1: T || _ || _
         1                  8     2: F || T || _
         0            -     8     3: F || F || T
                    2       8     4: F || F || F
         1                  9     return 1
                            9   }+
         1          1      10   if (val % 2 == 0)
         1                 11     return 0
                           11   }+
         0          1 -    12   for (;divisor < val / 2;)
         0          0 -    14     if (val % divisor == 0)
         0            -    15       return 0
                           15     }-
                           16   }+
         1                 17   return 1
                           18 }
***TER  65 % ( 11/ 17) of FUNCTION is_prime()
        82 % (  9/ 11) statement
-----------------------------------------------------------------------------

***TER  65 % ( 11/ 17) of FILE F:\ctcwork\v81\doc\examples\calc.c
        82 % (  9/ 11) statement
-----------------------------------------------------------------------------
 
SUMMARY
=======
Source files       : 3
Headers extracted  : 0
Functions          : 4
Source lines       : 59
TER                : 76 % (22/29) multicondition
TER                : 88 % (21/24) statement

The two leftmost columns are execution counters. The code locations that have not been exercised in the test runs are marked with a '-' character. The points where CTC++ has made instrumentation are shown with a line number and a description what there is on the line.

The information-only lines "}+" and "}-" tell where a control structure part ("if-then", "if-else", "loop-body", etc.) ends. The "+"/"-" marking is derived by execution flow analysis, and tells if execution has entered to the code after the "}". That information is needed when constructing the HTML report for deciding what line coverage background color will be used.

In the file calc.c on line 8 we see how CTC++ reports a multicondition coverage. On that line the conditional expression contained three elementary conditions connected with the logical || operator. There is a detailed analysis how many times each of the possible combinations to evaluate the expression has actually been evaluated and did the overall decision evaluate to true or false. Had the file been instrumented with only decision coverage or had the condition expression been simple, the reporting is as shown in the file calc.c on lines 10, 12 and 14.

TER stands for Test Effectiveness Ratio. There are two of them per each function, file and overall. The first one is the primary one and reflects the "program flow structural coverage". It is a percentage of the essential code locations that should have been visited from the perspective of thorough testing.

The second TER is statement coverage. It is calculated by analyzing the program flow and how many statements there have been in each then-part, else-part, for-loop, etc. In statement coverage calculation each ';' is considered as one statement. Additionally each if, for, while, do-while, switch and try statement is considered as one statement.

In ctcpost there are options to get the report of selected files only. Also it can be reported in "lower level" (e.g. multicondition coverage reported as MC/DC coverage, as condition coverage, as decision coverage or as function coverage).