How to read the stats
Alexey Fedorchenko
alexey.fedorchenko at oracle.com
Fri May 6 11:25:47 UTC 2016
Hello!
I assume that you running your tests for all cases in switch without
default, for an example:
This example will give the results you referring to:
for (int i = -2; i < 8; i++){
retR(i);
}
And this example will cover default branch:
for (int i = -2; i < 9; i++){
retR(i);
}
Coloring the source code in the report is not always very user-friendly.
In the result.xml this should looks similar to this:
"<default s="130" e="131" id="7" count="0"/>"
--Alexey
On 06.05.2016 6:23, José Cornado wrote:
> Hello, again!
>
> I moved along in the work that I am doing I ran into the following:
>
> The stats show 100% coverage of methods, blocks lines but the branch
> coverage is one less than 100%.
>
> The method in question is:
>
> int retR(int i){
>
> int r = i + 2;
>
> switch(r){
>
> case 0:
>
> r = i;
>
> break;
>
> case 1:
>
> r = i + 2;
>
> break;
>
> case 2:
>
> r = i + 3;
>
> break;
>
> case 3:
>
> r = i + 4;
>
> break;
>
> case 4:
>
> r = i + 5;
>
> break;
>
> case 5:
>
> r = i + 6;
>
> break;
>
> case 6:
>
> r = i + 7;
>
> break;
>
> case 7:
>
> r = i + 8;
>
> break;
>
> case 8:
>
> r = i + 9;
>
> break;
>
> case 9:
>
> r = i + 10;
>
> break;
>
> }
>
> return r;
>
> }
>
> What am I missing? What should I look for in the instrumented class and
> templates that indicates that something is a branch?
>
> How should I read this? a branch with no block or statements didn't get hit?
>
> Just straight 2.0 and 1.8 74 jvm
>
> Thanks again!
>
More information about the jcov-dev
mailing list