Posts Tagged Default case

Misapprehension 1: 100% can always be reached

Of course not. It is easy to find real-world examples where the structure of the code prevents the software from being executed completely.

Branch Coverage

Figure: An example where 100% branch coverage cannot be reached

The figure above designates a software snippet where 100% branch coverage cannot be reached. This is a real-world example that was simplified.
Why can 100% not be reached? The cause is the missing execution of the “default:” case of the switch instruction. This “default:” case is always present, whether it is programmed explicitly or not.

, , ,

No Comments