Skip Menu |

This queue is for tickets about the Data-Random CPAN distribution.

Report information
The Basics
Id: 27392
Status: resolved
Priority: 0/
Queue: Data-Random

People
Owner: Nobody in particular
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.05
Fixed in: 0.06



Subject: test 1 in t/rand_time.t fails occasionally
Hi, test 1 in t/rand_time.t fails when rand_time() returns "00:00:00", since _to_secs() then returns 0 which evaluates to false. This happens with a probability of about 7% and was found in an automatic build of the Debian packaged version of Data::Random - see http://bugs.debian.org/427188 . A simple fix is to test if the return value is defined. Proposed patch attached. Cheers, -- Niko Tyni (on behalf of the Debian Perl Group) ntyni@iki.fi
Subject: 427188.patch
--- t/rand_time.t 2007/06/02 12:35:37 1.1 +++ t/rand_time.t 2007/06/02 12:35:50 @@ -16,7 +16,7 @@ while ( $pass && $i < $max_secs ) { my $time = rand_time(); - $pass = 0 unless _to_secs($time); + $pass = 0 unless defined _to_secs($time); $i++; }
Subject: tests in t/rand_datetime.t fail occasionally
From: dam [...] modsoftsys.com
There are similar random test failures in rand_datetime.t Reported as Debian bug #441746 - http://bugs.debian.org/441746 Proposed patch attached.
Index: libdata-random-perl/t/rand_datetime.t =================================================================== --- libdata-random-perl.orig/t/rand_datetime.t 2007-09-11 11:11:37.000000000 +0300 +++ libdata-random-perl/t/rand_datetime.t 2007-09-11 11:12:32.000000000 +0300 @@ -35,7 +35,7 @@ $pass = 0 unless $delta >= 0 && $delta <= $max_days - && _to_secs( ( split ( / /, $date ) )[1] ); + && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); $i++; } @@ -59,7 +59,7 @@ $pass = 0 unless $delta >= 0 && $delta <= $max_days - && _to_secs( ( split ( / /, $date ) )[1] ); + && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); $i++; } @@ -89,7 +89,7 @@ $pass = 0 unless $delta >= 0 && $delta <= $max_days - && _to_secs( ( split ( / /, $date ) )[1] ); + && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); $i++; } @@ -121,7 +121,7 @@ $pass = 0 unless $delta >= 0 && $delta <= $max_days - && _to_secs( ( split ( / /, $date ) )[1] ); + && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); $i++; } @@ -139,7 +139,7 @@ $pass = 0 unless $new_year == $year && $new_month == $month && $new_day == $day - && _to_secs( ( split ( / /, $date ) )[1] ); + && defined( _to_secs( ( split ( / /, $date ) )[1] ) ); ok($pass); }
I took over Data::Random recently, and while working on a release, I ran across the same bug(s) described in this ticket. The newest version, 0.06, should have these fixed. Sorry for the major delay in addressing these!