Example of CTC++ Execution Profile Listing / MC/DC Coverage View

*****************************************************************************
*           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 16:26:25 2016)
Data file(s) used     : MON.dat (Wed Nov 23 16:27:03 2016)
Listing produced at   : Thu Dec 01 14:07:22 2016
Coverage view         : Reduced to MC/DC coverage
 
MONITORED SOURCE FILE : F:\ctcwork\v81\doc\examples\prime.c
INSTRUMENTATION MODE  : multicondition+inclusive_timing
 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+inclusive_timing
 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+inclusive_timing
 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
                      -     8     MC/DC (cond 1): 1 - 4
                            8     MC/DC (cond 2): 2 + 4
                      -     8     MC/DC (cond 3): 3 - 4
         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  63 % ( 10/ 16) of FUNCTION is_prime()
        82 % (  9/ 11) statement
-----------------------------------------------------------------------------

***TER  63 % ( 10/ 16) 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                : 75 % (21/28) MC/DC
TER                : 88 % (21/24) statement

This Execution Profile Listing has been generated by ctcpost -fmcdc option (force MC/DC coverage view). The difference shows at file calc.c on line 8. I.e. in a multicondition instrumented code of complex condition expressions there is still shown what are the possible evaluation alternatives and how many times each of them were executed. But there is no coverage complaint if some evaluation alternative was not exercised.

Instead there is added MC/DC analysis if each elementary condition alone being true/false, and when the other conditions are the same or not evaluated due to the short-circuit rule, has affected the overall decision outcome. We can read here that for the second condition (val == 2) execution of evaluation alternatives 2 and 4 demonstrate meeting of the MC/DC criteria. On the first (val == 1) and third (val == 3) conditions the MC/DC criteria was not met. The report shows also which evaluation alternative executions demonstrate meeting of the MC/DC criteria on the condition (marked: i + j), and which evaluation alternative executions would have demonstrated it (marked: i - j) on the condition. In TER% calculation there is: the overall condition expression has been true and false and each elementary condition meets the MC/DC criteria.