Hi,

code coverage tools work on the actual implementation, not on the intenden symantics. For your example data flow analysis would be necessary to collapse such descissions. If the boolean expression is a method (e.g. Date.before()) you would even need to understand the semantics of these methods.

Speaking for JaCoCo there are no plans to implement such a semantical analysis.

BTW, for your particular example 3 test cases are enough to cover all branches.

Cheers,
-marc

On 19.01.14 09:03, Richard Eversole wrote:
For code like:

if (i<0 || i>255) {
} else {
}

the condition is reported as having 4 branches. Technically, this is correct but two branches collapse as the condition has only 3 ranges of possible values:
       i<0 T
       i>255 T
       0<=i<=255 T .. ie. i<0 F and i>255 F
Could someone enhance the tool to only report the 3 branches when numeric ranges exist ? not critical just a thought..... of course then this expands as you write even more complex range checks on numbers....
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "JaCoCo 
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to