'Multiple Condition Coverage
Trying to figure out the difference between the Multiple Condition Coverage
Code A:
if (a && b) then
print "Hello"
Endif
Multiple Condition Coverage for A:
a=1 , b=1
a=1 , b=0
a=0 , b=1
a=0 , b=0
What about this one?
Code B:
if (a) then
if (b) then
print "Hello"
Endif
Endif
Does this code have the same "Multiple Condition Coverage"? because when a=0 the inner condition is ignored...
Solution 1:[1]
Both solutions effectively do the same thing and do satisfy "multiple condition coverage" assuming you only want "Hello" to print when both are true. Whether or not one is more efficient than the other depends on the language being used. Regardless, both are linear in terms of complexity so for modern languages and hardware the difference is moot.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mike Collins |