Example of CTC++ Execution Profile Listing

*****************************************************************************
*           CTC++, Test Coverage Analyzer for C/C++, Version 7.0            *
*                                                                           *
*                         EXECUTION PROFILE LISTING                         *
*                                                                           *
*                    Copyright (c) 1993-2011 Testwell Oy                    *
*****************************************************************************

Symbol file(s) used   : MON.sym (Fri Jul 01 08:22:06 2011)
Data file(s) used     : MON.dat (Fri Jul 01 08:23:00 2011)
Listing produced at   : Thu Aug 04 14:00:51 2011
Coverage view         : As instrumented
 
MONITORED SOURCE FILE : prime.c
INSTRUMENTATION MODE  : multicondition+inclusive_timing
 HITS/TRUE      FALSE    LINE DESCRIPTION
=============================================================================
         2                  8 FUNCTION main()
         6          2      12   while (( prime_candidate = io_ask ( ) ) > 0)
         4          2      14     if (is_prime ( prime_candidate ))
                           16     else
         2                 19   return 0
                           20 }
***TER 100 % (  6/  6) of FUNCTION main()
       100 % (  6/  6) statement
-----------------------------------------------------------------------------

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

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

***TER  65 % ( 11/ 17) of SOURCE FILE calc.c
        82 % (  9/ 11) statement
-----------------------------------------------------------------------------
 
SUMMARY
=======
Source files       : 3
Source lines       : 59
Measurement points : 27
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.

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).