Skip Menu |

This queue is for tickets about the Math-NumberCruncher CPAN distribution.

Report information
The Basics
Id: 17601
Status: new
Priority: 0/
Queue: Math-NumberCruncher

People
Owner: sifukurt [...] yahoo.com
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.00
Fixed in: (no value)



Subject: Test failures with Perl 5.8
Hi, running 'make test' on Math::NumberCruncher 5.00 under Perl 5.8.4 and 5.8.7 on Debian GNU/Linux, I get the following: Testing......99/99 Total Tests: 99 Failed Tests: 3 Success Rate: 96.97% The following tests encountered errors: Test 23: Union() Test 24: Intersection() Test 25: Difference() The tests fail because they rely on the order of the lists returned by these functions, while the lists are originally obtained from 'keys %hash'. The keys() function does not guarantee the order of the list returned. Since the Math::NumberCruncher documentation of these functions does not say anything about the order of the elements, I assume that it is not meant to be guaranteed either. Thus I'm attaching a proposed patch for test.pl that sorts the returned lists before checking their contents. Cheers, -- Niko Tyni ntyni@iki.fi
Subject: test.patch
--- test.pl 2006/02/12 20:11:41 1.2 +++ test.pl 2006/02/12 20:19:15 @@ -207,14 +207,14 @@ # Union @a = ( 1, 1, 1, 2, 3 ); @b = ( 2, 3, 4 ); -@union = $ref->Union( \@a, \@b ); +@union = sort $ref->Union( \@a, \@b ); unless ( $union[0] == 1 && $union[1] == 2 && $union[2] == 3 && $union[3] == 4 ) { $Failed{23} = "Union()"; } Testing(); # Inersection() -@temp = $ref->Intersection( \@a, \@b ); +@temp = sort $ref->Intersection( \@a, \@b ); unless ( $temp[0] == 2 && $temp[1] == 3 ) { $Failed{24} = "Intersection()"; } @@ -223,7 +223,7 @@ # Difference() @a = ( 1, 2, 3, 4 ); @b = ( 3, 4, 5, 6 ); -@diff = $ref->Difference( \@a, \@b ); +@diff = sort $ref->Difference( \@a, \@b ); unless ( $diff[0] == 1 && $diff[1] == 2 && $diff[2] == 5 && $diff[3] == 6 ) { $Failed{25} = "Difference()"; }