How to read the stats

José Cornado jose.cornado at gmail.com
Fri May 6 16:46:48 UTC 2016


Ok. I checked templates and bytecode., I need to add default label to my
logic.

thanks! and sorry fro the noise.

On Fri, May 6, 2016 at 8:28 AM, José Cornado <jose.cornado at gmail.com> wrote:

> Thanks!
>
> The problem is not exercising the code in the method. The machine does it
> for me. I guess I should have included the actual figures:
>
> 13/13 blocks, 10/11 branches, 23/23 lines.
>
> Since we have 10 case labels I am trying to understand where the 11 comes
> from since everything else is hit 100%
>
> I am using
>
> SillyClass{
> int retR(int i){
> .....
> }
> }
>
> does the Javac/JVM create an additional branch inside the default
> constructor( which I am not processing)?
>
> Do the slots have data about the element they represent?
>
> Thanks for your patience!!
>
> On Fri, May 6, 2016 at 5:25 AM, Alexey Fedorchenko <
> alexey.fedorchenko at oracle.com> wrote:
>
>> 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!
>>>
>>>
>>
>
>
> --
> José Cornado
>
> --
>
> home: http://www.efekctive.com
> blog:   http://blogging.efekctive.com
> ----------------------
>
> Everything has been said before, but since nobody listens we have to keep
> going back and beginning all over again.
>
> Andre Gide
>



-- 
José Cornado

--

home: http://www.efekctive.com
blog:   http://blogging.efekctive.com
----------------------

Everything has been said before, but since nobody listens we have to keep
going back and beginning all over again.

Andre Gide


More information about the jcov-dev mailing list