Branch Coverage Cheat Sheet

From OC Systems Wiki!
Revision as of 03:03, 20 March 2018 by Swn (talk | contribs) (Branch Coverage Cheat Sheet)
Jump to: navigation, search

Branch Coverage Cheat Sheet

This document provides information about interpreting the Branch Coverage Reports produced from data collected by the predefined probes coverage,ual (and brcov.ual) and the tool abrmerge.

General Guidance

A source line with no line count (no color / no marker) is either a line with no object code and can be ignored of it is part of a subprogram for which coverage was not requested. A source line with a positive line count (no marker / green color) is OK (has been executed).

BCCS 1.jpeg

A source line with a zero line count (+ marker / yellow color) needs attention (has not been executed).

BCCS 2.jpeg

A source line with a zero line count (* marker / red color) needs attention (has not been instrumented).

BCCS 3.jpeg

A branch with positive count (green color) is OK (has been executed).

BCCS 4.jpeg

A branch with a zero count (+ marker / yellow color) need attention (has not been executed).

BCCS 4.jpeg

A branch with a zero count (+ marker / red color) need attention (has not been instrumented).

BCCS 5.jpeg

Lines with multiple branches may be easier to work with if the source code is modified to put one decision per line.

BCCS 6.jpeg

versus

BCCS 7.jpeg

C/x86

Functions

At the end of a function the closing brace may have a line count of 0 due to a patching problem. This is fixed in ap.4.4.63/7. Otherwise, the 0 line count can be ignored.

Loops

In a for loop, the index bounds test is completed at the bottom of the loop. If the branch associated with the for loop in not taken, then the body of the loop will not have been executed (line counts should be 0). Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

26: + B
10: for(j=0;j<0;j++) 0 -> 28
   27: ::{

+ 28 : 29: ::}

0 : k = k + i;
 In a for loop, the index bounds test is completed at the bottom of the loop. The line count of the for loop should be greater than the branch count of the for loop because the final bounds check will fail and not branch back to the loop body.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

32: B
110: for(j=0;j<10;j++) 100 -> 34
   33: ::{

34 : 35: ::}

100 : k = k + i;
 In a while loop, the while test is completed at the bottom of the loop. If the branch associated with the while loop in not taken, then the body of the loop will not have been executed (line counts should be 0).

+ B 0 -> 50 52: ::} In a while loop, the while test is completed at the bottom of the loop. The line count of the while loop should be greater than the branch count of the for loop because the final while test will fail and not branch back to the loop body. B 100 -> 58 60: ::} In a do-while loop, the while test is completed at the bottom of the loop. The line count of the do-while loop should be greater than the branch count of the for loop because the final while test will fail and not branch back to the loop body. 76: : 10: j=0; 81: ::} 82: : 100: while(j<10); B 90 -> 79

Conditional Operator (?)

Conditional operator expressions will generate one branch for each conditional operator (?). Conditional operators on a single line will include a branch to the same line which is for the FALSE condition. If the branch is not taken then the TRUE conditional has not been executed. If the branch is executed fewer times than the line count then both conditions have been executed. 103: : 10: k=(i>2?5:1); B 3 -> 103 Conditional operator expressions spanning multiple source lines allow for easier (not easy) determination of decisions tested. Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 46 : : : /* no iterations */

47: : 10: j=0;

48: : 10: while(j<0)

49: ::{

+ 50 : : 0 : k = k + 2; + 51 : : 0 : j = j + 1;

    Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
55: : 10: j=0;

56: : 110: while(j<10)

57: ::{

58 : : 100 : k = k + 2; 59 : : 100 : j = j + 1;

    Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
 77: ::do 78: ::{
79 : : 100 : k = k + 2; 80 : : 100 : j = j + 1;
     Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
    Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
105 : B

B 107 : B 108 : +B

10: 6->105

0->105

10: 6->107
4: 0->108

k=(i>5?(i<10?5:1):7); k=(i>5? (i < 10 ? 5:

   +

versus

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

         109: : 4:

Switch Statements

110: : : 1): 111: : : 7);
Switch statements with a default case will have a single branch to the default case and use a jump table for the rest. Line counts will indicate which cases have been executed.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

122: : 10 : B 4 -> 142

127 : : : 130 : : : 131 : : 1 : 132 : : : 135 : : : 138 : : : switch (i) case 1: case 2: k = k + 2; case 3: case 4: case 5: default: k = k + 6;

   123: ::{

124 : : : case 0: 125 : : 1 : k = k + 1; 126 : : 1 : break;

 128 : : 1 : k = k + 1; 129 : : 1 : break;
   133 : : 2 : k = k + 3; 134 : : 2 : break;
 136 : : 1 : k = k + 4; 137 : : 1 : break;
 139 : : 1 : k = k + 5; 140 : : 1 : break;
141 : : :

142 : : 4: 143: ::}

  Switch statements without a default will have branches for each case. Line counts will indicate which cases have been executed. There will also be a branch to the same line as the switch expression (which represents the default case) which is executed when no explicit cases are executed.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

146 :

B 1->152 B 8->146 B 1->149 B 1->155 B 1->157 switch (i) case 1: case 2: k = k + 2; case 3: 159: ::} Switch statements with null or no statements will have branches to the next statement following the switch statement. If the switch statement is at the end of a loop, the next statement may be the loop condition test, whose source line number may/will be at the top of the loop.

10 :
    147: ::{

148 : : : case 0: 149 : : 1 : k = k + 1; 150 : : 1 : break;

       151 :
 :
152 : : 1 : k = k + 1; 153 : : 1 : break;
154 : 155 : 156 :
 : :1 : : :
  157 : : 2 : k = k + 3; 158 : : 2 : break;
 Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
170: B

219: B 224: 229 : 232 :

If Statements

110: 100 -> 173

for(j=0;j<10;j++) switch (i) break; case 4: case 5:

   171: ::{ <snip>

218 : : : /* switch with null alternatives */

100 40 -> 170
20
 :
 :
   220: ::{

221 : : : case 0: 222: : : ; 223 : : : case 1:

225 : : : case 2: 226 : : : case 3:
227 : : 20 : k = k + 3; 228 : : 20 : break;
 230 : : 10 : k = k + 4; 231 : : 10 : break;
 233 : : 10 : k = k + 5; 234 : : 10 : break;
235 : : : default: 236: : : ; 237: ::}

238: ::}

If statements will include (at least) one branch for the condition of each leg. If the branch count is not the same as the line count then both paths of the decision have been tested.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 248 : : : /* never taken */

249: B

+ 251: 255: + B

10: 10 -> 255
0:
10: 0 -> 261

if(ident(j)<0) j = j + 1; if (ident(j) < 1000)

   250: ::{
252: ::}

253: : : 254 : : : /* always taken */

    256: ::{

257 : 258: ::}

If statements with null/empty legs...TBD

j = j + 1; 262: ::{ 263: ::; 264: ::}

10 :
 261 : : 10 : if (ident(j) < 1000)

If statement conditions with multiple boolean operators will have one branch associated with the whole condition. If the boolean operands are spread on separate source lines they will all have the same line count. (See short circuit operators.)

368: : 10: if((ident(j)>=0)& + B 0 -> 377 372: ::{ 373 : : 10 : j = j + 1; 374: ::}

If statement conditions with short circuit operators will have one branch for each operand of the short circuit operator. If a branch has a count of 0 then that path has not been executed. If the boolean operands are spread on separate source lines they will have separate line counts which will indicate if each operand was executed.

 Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

367 : : : /* all true */

    369 : 370 : 371 :
10 : : 10 : : 10 :

(ident(k) == 0) & (0 == ident(k)) & (0 <= ident(j)))

   Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

442 : : : /* third true */

 + +

+ 443: : B 0->448 444: : B 0->448 445: : B 10 -> 448 10 : 10 : 10 : if ((ident(j) >= 1111110) || (1111110 == ident(k)) || (ident(k) == 0) || (111110 <= ident(j))) j = j + 1;

          446: :

447: ::{ 448 : : 10 : 449: ::} Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 0 :

GNAT Ada/x86

Exception Checks

Straight-line code will often include exception checks for ranges and bounds. If straight-line code contains branches to the same line then these are exception checks. If the branch counts are the same as the line counts then the exception checks passed and an exception was not raised.

19 : : 11 : result := result + i; B 11 -> 19 B 11 -> 19

Loops

All for loops will include a branch for the loop range check at the top. The normal loop range check should have a line count greater than the line count of the body statements to indicate the loop reached completion and the branch count should be non-zero to indicate the exit was taken. Testing for 0, 1, and multiple loop executions should be achieved with separate test runs.

34 : : 121 : for l in integer range 0..9 loop B 11 -> 39

For loops with dynamic bounds will test for a null loop range at the top of the loop and contain a branch to the next statement which is taken when the loop range is null.

Line Edge/Branch Line Cnt Source

      Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
    35 : : 110 : k := k + i; 36: : 110: endloop;
 

----------- --------- ------- - -

28 : : : -- no iterations

29 : : 11 : for l in integer range Ident(1)..Ident(0) loop B 11 -> 34

B 0 -> 34

While loops will test loop exit condition at the top of the loop and contain a branch to the next statement which is taken when the loop exit is taken. The loop exit condition should have a line count greater than the line count of the body statements to indicate the loop reached completion. Using short circuits operators in the loop exit condition will increase the number of branches, and each should be executed for complete coverage. Testing for 0, 1, and multiple loop executions should be achieved with separate test runs.

   +
 + 30 : : 0 : k := k + i; + 31 : : 0 : end loop;
Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
58 : : 11 : j := 0;

59: : 121: while(j<10)loop

B 11 -> 65 60 : : B 110 -> 60 61 : : B 110 -> 61 62: :

Exit Statements

110: k:=k +2; 110: j:=j +1; 110: endloop;

Loop exit statements will include a branch which is taken when the exit is taken. The branch count should be less than the line count to indicate that both paths of the decision are taken. Using short circuits operators in the loop exit condition will increase the number of branches, and each should be executed for complete coverage.

81 : : 11 : j := 0; 82: ::loop Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

  83 : : B 11 -> 83 84: : B 11 -> 84 85: : B 11 -> 89

Case Statements

11 : k := 11:j := 11 : exit when (j < 10); + 86 : : 0 : k := k + 2; + 87 : : 0 : end loop; k + 2; j+1;

Case statements will have a single branch at the top to handle the others case. Coverage of the when alternatives can be confirmed by line counts.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

96 : : B 5->110

98 : : 99 : : 100 : : B 1->100 102 : : B 1->102 104 : : B 1->104 106 : : B 1->106 108 : : B 1->108 110 : : B 5->110 111 : :

If Statements:

11 : case (i) is 1 : k:=k + 1; : when 1 => 1 : k:=k + 1; 1 : k:=k + 2; 1 : k:=k + 3; 1 : k:=k + 4; 1 : k:=k + 5; 5 : k:=k + 6; 11 : end case;

   97 : : : when 0 =>
     101 : : : when 2 =>
   103 : : : when 3 =>
   105 : : : when 4 =>
   107 : : : when 5 =>
   109 : : : when others =>
    

If statements will include (at least) one branch for the condition of each leg. If the branch count is greater than zero but less than the line count then both paths of the decision have been tested. Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

180: : 11: B 11 -> 184

+181::0: 184: : 11: + B 0 -> 188 if (ident(j) < 0) then j:=j+1; if (ident(j) < 1000) then

    182 : : : end if; 183: : :
    

185 : : 11 : j := j + 1; B 11 -> 185 If statements conditions with multiple boolean operators will have one branch associated with the whole condition. If the boolean operands are spread on separate source lines they will all have the same line count. (See short circuit operators.) 240 : : 11 : if ((ident(j) >= 0) and (ident(k) = 0)) then + B 0 -> 245 241 : : 11 : j := j + 1; B 11 -> 241 If statement conditions with short circuit operators will have one branch for each operand of the short circuit operator. If a branch has a count of 0 then that path has not been executed. If the boolean operands are spread on separate source lines they will have separate line counts which will indicate if each operand was executed.

   186 : : : end if;
Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
       242 : : : end if;
Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

353 : : : -- second true

+

354: : B 0->359 355: : B 11 -> 359 358: : 359: : B 11 -> 359 11 : if ((ident(j) >= 100000) or else

  11 :

(ident(k) = 0) or else

   + 356 : : 0 : (0 = ident(k)) or else + 357 : : 0 : (0 <= ident(j)))
360 : : : end if;

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 32 : : : /* 10 iterations */

then

11 : j:=j+1;

    XLC/PPC:

Functions: At the end of a function the closing brace may have a line count of 0. This can be safely ignored. Loops: In a for loop, an index bounds test is completed at the top and bottom of the loop. The branches generated for those tests are associated with the first line of the loop, and the first is from the top of the loop and the second is from the bottom of the loop. test, the loop body was not executed (the difference of the counts). If the first branch count is less than the line count of the loop

33 : + B
100: for(j=0;j<10;j++) 0x -> 39
   B 90x -> 35
 34: ::{

35 : 36:

100: k=k+i;
}
 In a while loop, an loop exit test is completed at the top and bottom of the loop. The branches generated for those tests are associated with the first line of

the loop, and the first is from the top of the loop and the second is from the bottom of the loop. test, the loop body was not executed (the difference of the counts). + If the first branch count is less than the line count of the loop Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 55 : : : /* 10 iterations */

56: : 10: j=0;

57: : 100: while(j<10)

58: ::{

59 : 60 : 61 :

100 : : 100 : : 100 :

k = k + 2; j = j + 1; if (j < 5)

B

B 90x -> 59 0x -> 68

    B 60x -> 64
  62 : 63: 64: 65:
40 : continue; ::else :60: k++; ::}
   In a do-while loop, an loop exit test is completed at the bottom of the loop. The branch generated for that test is associated with the last line of the loop. The loop body will have been executed one more time then the branch count, as confirmed by loop body line counts.

76 : : : /* 10 iterations */ 77: : 10: j=0;

 78: ::do 79: ::{

80 : : 100 : k = k + 2; 81 : : 100 : j = j + 1;

82: ::}

83: : 100: while(j<10); B 90x -> 80 Conditional Operator (?): Conditional operator expressions will generate one branch for each conditional operator (?). Conditional operators on a single line will include a branch to the same line which is for the FALSE condition. If the branch is not taken then the TRUE conditional has not been executed. If the branch is executed fewer times than the line count then both conditions have been executed. 103: : 10: k=(i>2?5:1); B 3 -> 103 Conditional operator expressions spanning multiple source lines allow for easier (not easy) determination of decisions tested.

    Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
    Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -
105 : B

B 108 : B 109 : +B Switch Statements:

10: 6->105

0->105

10: 6x -> 109
4: 0x -> 109

k=(i>5?(i<10?5:1):7); k=(i>5? (i<10? 5:1):7);

   +

versus Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

         Switch statements with a default case will have a single branch to the default case which shows up as a branch to the top of the switch statement. (This is a conditional branch to an unconditional branch to the default case.) Line counts will indicate which cases have been executed.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

120 :

B 4x -> 120 switch (i) case 1: case 2: k = k + 2;

10 :
   121: ::{

122 : : : case 0: 123 : : 1 : k = k + 1; 124 : : 1 : break;

125 :

128 : 129 : 130 : 133 : 136 : 139 : 140 : 141:

 :
 :
1 :
126 : : 1 : k = k + 1; 127 : : 1 : break;
 131 : : 2 : k = k + 3; 132 : : 2 : break;
case 3:
  134 : : 1 : k = k + 4; 135 : : 1 : break;
case 4:
case 5:
default:

k = k + 6;

  137 : : 1 : k = k + 5; 138 : : 1 : break;
:
4: ::}
  Switch statements without a default will have branches for each case. Line counts will indicate which cases have been executed.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 143 : : : /* switch with no default */

144 :

B 1x -> 147 B 1x -> 150 B 1x -> 153 B 1x -> 155 switch (i) case 1: case 2: k = k + 2;

10 :
     145: ::{

146 : : : case 0: 147 : : 1 : k = k + 1; 148 : : 1 : break;

    149 :

152 : 153 : 154 : 157:

 :
 : :1 : : :
150 : : 1 : k = k + 1; 151 : : 1 : break;
  case 3: ::}
155 : : 2 : k = k + 3; 156 : : 2 : break;
 

Switch statements with null or no statements will not have branches to those cases. For multiple cases with the same statements, each case will have a branch to the same source line. Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 216 : : : /* switch with null alternatives */

217 :

B 60x -> 217 B 20x -> 222 B 10x -> 225 B 10x -> 225 B 10x -> 228 B 10x -> 231 switch (i)

break;
case 4:
case 5:
100 :
     218: ::{

219 : : : case 0: 220: : : ; 221 : : : case 1:

       222 :

227 : 230 : If Statements:

20
 :
223 : : : case 2: 224 : : : case 3:
225 : : 20 : k = k + 3; 226 : : 20 : break;
 228 : : 10 : k = k + 4; 229 : : 10 : break;
 231 : : 10 : k = k + 5; 232 : : 10 : break;
233 : : : default: 234: : : ; 235: ::}

236: ::}

If statements will include (at least) one branch for the condition of each leg. If the branch count is not the same as the line count then both paths of the decision have been tested.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 248 : : : /* never taken */

249: B

+ 251: 255: + B

10: 10 -> 255
0:
10: 0 -> 261

if(ident(j)<0) j = j + 1; if (ident(j) < 1000)

   250: ::{
252: ::}

253: : : 254 : : : /* always taken */

    256: ::{

257 : 258: ::} If statements with null/empty legs...TBD j = j + 1;

10 :
 261 : : 10 : if (ident(j) < 1000)

If statement conditions with multiple boolean operators will have one branch associated with the whole condition. If the boolean operands are spread on separate source lines they will all have the same line count. (See short circuit operators.) 368: : 10: if((ident(j)>=0)& + B 0 -> 377 372: ::{ 373 : : 10 : j = j + 1; 374: ::} If statement conditions with short circuit operators will have one branch for each operand of the short circuit operator. If a branch has a count of 0 then that path has not been executed. If the boolean operands are spread on separate source lines they will have separate line counts which will indicate if each operand was executed.

262: ::{ 263: ::; 264: ::}
Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

367 : : : /* all true */

    369 : 370 : 371 :
10 : : 10 : : 10 :

(ident(k) == 0) & (0 == ident(k)) & (0 <= ident(j)))

   Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

440 : : : /* third true */

441 : + B
10 : if ((ident(j) >= 1111110) || 0x -> 442
   442 :

B 10x -> 443

10 : (1111110 == ident(k)) ||
+ +

443 : B 0x-> 444 : 445: 446 : 447:

10 : (ident(k) == 0) || 444
0 : (111110 <= ident(j))) ::{
10: j=j+1; ::}
       PowerAda/PPC:

Exception Checks: Straight-line code will often include exception checks for ranges and bounds. If straight-line code contains branches to the end of a subprogram then these are exception checks. Branch counts will indicate how many time the exception was raised. 15 : : 11 : result := result + i; + B 0x -> 21 Loops: All for loops will include a branch for the loop range check at the bottom. The normal loop range check should have a branch count less than the line count of the body statements to indicate the loop reached completion. Testing for 0, 1, and multiple loop executions should be achieved with separate test runs. B 99x -> 35 For loops with dynamic bounds will test for a null loop range at the top of the loop and contain a branch to the next statement which is taken when the loop range is null. 29 : : 11 : for l in integer range Ident(1)..Ident(0) loop B 11 -> 34 B 0 -> 34 While loops will test the loop exit condition at the top of the loop and contain a branch to the next statement which is taken when the loop exit is taken. While loops will test the loop exit condition at the bottom of the loop too and contain a branch to the top of the loop which is taken when the loop continues. The loop exit condition should have a line count greater than the line count of the body statements to indicate the loop reached completion. Using short circuits operators in the loop exit condition will increase the number of branches, and each should be executed for complete coverage. Testing for 0, 1, and multiple loop executions should be achieved with separate test runs. Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

     Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

33 : : : -- 10 iterations

34 : 35 : 36:
11 : for l in integer range 0..9 loop : 110 : k := k + i;
110: endloop;
   Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

28 : : : -- no iterations

    +
 + 30 : : 0 : k := k + i; + 31 : : 0 : end loop;
Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

67 : : : -- 10 iterations

68 : : 11 : j := 0;

69 : : 11 : while (j < 10) loop

+B 70 :

+B 71 : +B B Exit Statements: 0x -> 75

110: k:=k+2;

0x -> 100

110: j:=j+1;

0x -> 100 99x -> 70

            Loop exit statements will include a branch which is taken when the exit is taken. The branch count should be less than the line count to indicate that both paths of the decision are taken. Using short circuits operators in the loop exit condition will increase the number of branches, and each should be executed for complete coverage.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 83 : : : -- 10 iterations

84: 85: 86:

+ B 87: + B 88: B 89: + B

11: j:= 0; ::loop :110:k :=

0x -> 93

110: j :=

0x -> 93

110: exit

11x -> 92

99: k:=

0x -> 93 k+2; j+1; when (j >= 10); k+2;

                 90 : : : end loop;

Case Statements: Case statements will have a branch for each alternative listed. The others alternative will have branches associated with values not handled by the specified alternatives, including values below the range, above the range, and values in between. Coverage of the when alternatives can be confirmed by line counts. Coverage of out of bound values can be confirmed by the branch counts. Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

99 : + B
11: 0x -> 113

case (i) is k:=k+ 1; k:=k+ 1; k:=k+ 2; k:=k+ 3; k:=k+ 4; k:=k+ 5; k:=k+ 6;

   B 1x -> 101 B 1x -> 103 B 1x -> 105 B 1x -> 107 B 1x -> 109 B 1x -> 111
100 : : : when 0 =>
          101 : + B

103 : + B 105 : + B 107 : + B 109 : + B 111 : + B 113 : + B If Statements:

1: 0x -> 135
1: 0x -> 135
1: 0x -> 135
1: 0x -> 135
1: 0x -> 135
1: 0x -> 135
5: 0x -> 135
   102 : : : when 1 =>
   104 : : : when 2 =>
   106 : : : when 3 =>
   108 : : : when 4 =>
   110 : : : when 5 =>
   112 : : : when others =>
   114 : : : end case;

If statements will include (at least) one branch for the condition of each leg. If the branch count is greater than zero but less than the line count then both paths of the decision have been tested. Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - - 182 : : : -- never taken

183 :

B 11x -> 187 if (ident(j) < 0) then j := j + 1; if (ident(j) < 1000) then j := j + 1;

   +

+ +

11:
0:

184 : 187 : B 0x-> 191

185 : : : end if; 186: : :
: 11:
   188 :

B 0x-> 432 11:

   189 : : : end if;

If statements conditions with multiple boolean operators will have one branch associated with the whole condition. If the boolean operands are spread on separate source lines they will all have the same line count. (See short circuit operators.)

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

227 : + B 228 : + B

11: if((k<0)or(ident(j)>=0))then 0x -> 231
11: j:=j+1; 0x -> 432
       229 : : : end if;

If statement conditions with short circuit operators will have one branch for each operand of the short circuit operator. If a branch has a count of 0 then that path has not been executed. If the boolean operands are spread on separate source lines they will have separate line counts which will indicate if each operand was executed.

Line Edge/Branch Line Cnt Source ------ ----------- --------- ------- - -

356 : : : -- second true

+

+ 357 : : B 0x-> 362 11 : if ((ident(j) >= 100000) or else (ident(k) = 0) or else then j := j + 1;

  358 :

B 11x -> 362

11 :
   + 359 : : 0 : (0 = ident(k)) or else + 360 : : 0 : (0 <= ident(j)))
361 : 362 :
 :
: 11 : B 0x-> 432
   363 : : : end if;