db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Embretsen <John.Embret...@Sun.COM>
Subject Re: code coverage for junit tests for svn trunk revision 529822
Date Fri, 20 Apr 2007 08:19:17 GMT
Øystein Grøvlen wrote:

>   - What is the meaning of blocks?  I thought it was a block of
>     statements, but the report says there are more blocks than lines.
>     (E.g., Blob.isBinaryStream is reported to have 1 line and 10
>     blocks.)

A basic block is basically a sequence of bytecode instructions with a single
entry point and a single exit point. I found an explanation on the Emma web site:

http://emma.sourceforge.net/faq.html#q.blockcoverage

I don't think I remember enough from grad school to be able to explain exactly
why Blob.isBinaryStream() is reported to have 10 blocks; it may also be possible
that the code coverage tool has its own interpretation. The method's bytecode
would look something like this:

public boolean isBinaryStream();
   Code:
    0:   aload_0
    1:   getfield        #2; //Field dataType_:I
    4:   aload_0
    5:   getfield        #3; //Field BINARY_STREAM:I
    8:   iand
    9:   aload_0
    10:  getfield        #3; //Field BINARY_STREAM:I
    13:  if_icmpne       20
    16:  iconst_1
    17:  goto    21
    20:  iconst_0
    21:  ireturn


(I used javap to find this)

-- 
John




Mime
View raw message