On Thu, Apr 29, 2004 at 08:05:35PM +0200, Tels wrote:

> On Friday 30 April 2004 00:40, Gabor Szabo wrote:
> > Where would we be without your work ?
> >
> > Out in the desert to fall prey to any bug ?
> > At least we can run and get some cover.

(!)

> > Thank you !
> 
> Exactly! Especially the ability to look at
> 
> http://pjcj.sytes.net/cpancover/Math-BigRat-0.12/lib-Math-BigRat-pm.html
> 
> without having the "hassle" of downloading/installing Devel::Cover is a big
> plus! I just saw that BigRat misses tests for as_bin() and as_hex() :-)
> 
> Thank you!

You're welcome.  But be aware that cpancover is probably best used as a
guide.  You'll want to run the tests yourself and generate your own
coverage so you can be sure the tests pass and that you understand the
environment in which they are being run.  (Tels, I know you do that
anyway.)

> Tels
> 
> PS: One stupid question:
> 
> In Calc.pm (part of BigInt):
> 
> 1350  149 50 408            if ($cx->[0] == 0)
> 1351                                  {
> 1352  0 0                             $zero_elements ++; shift @$cx;
> 
> If the branch is taken 50% of the time (I think that is what 50 means in the 
> second column, then why is the line "$zero_elements++" etc not covered at 
> all? Bug in Devel::Cover or did I get something wrong?

The latter ;-)

When branch coverage is 50% that means that 50% of the branches have
been taken at least once, and thus 50% of the branches have never been
taken.  If you follow the 50 link you will get to the detailed branch
coverage report which tells you that the true branch (the body of the
if statement) was never taken, but the false branch was (the missing
else).  So one out of two, or 50% branch coverage.  This fits in with
the statement coverage for the statements in the body of the if
statement being zero.

In order to get 100% branch coverage here you will need a test in which
$cx->[0] == 0 is true.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to