| 1 |
// all control paths return |
| 2 |
|
| 3 |
fun int foo( int a, int b ) |
| 4 |
{ |
| 5 |
if( a == 1 ) |
| 6 |
{ |
| 7 |
if( b == 1 ) |
| 8 |
{ |
| 9 |
return 1; |
| 10 |
} |
| 11 |
else |
| 12 |
{ |
| 13 |
return 2; |
| 14 |
} |
| 15 |
} |
| 16 |
else if( a == 2 ) |
| 17 |
{ |
| 18 |
if( b == 1 ) |
| 19 |
return 3; |
| 20 |
else |
| 21 |
return 4; |
| 22 |
} |
| 23 |
else |
| 24 |
{ |
| 25 |
if( b == 1 ) |
| 26 |
{ |
| 27 |
return 5; |
| 28 |
} |
| 29 |
else if( b == 2 ) |
| 30 |
return 6; |
| 31 |
else |
| 32 |
{ |
| 33 |
return 7; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
foo( 1, 1 ) => int r1; |
| 39 |
foo( 1, 2 ) => int r2; |
| 40 |
foo( 2, 1 ) => int r3; |
| 41 |
foo( 2, 2 ) => int r4; |
| 42 |
foo( 3, 1 ) => int r5; |
| 43 |
foo( 3, 2 ) => int r6; |
| 44 |
foo( 3, 3 ) => int r7; |
| 45 |
|
| 46 |
// success condition |
| 47 |
if( r1 == 1 && r2 == 2 && r3 == 3 && r4 == 4 && r5 == 5 && r6 == 6 && r7 == 7 ) |
| 48 |
<<< "success" >>>; |