Skip to content

Commit

Permalink
Don't loop forever in uniqnum.t
Browse files Browse the repository at this point in the history
If infinities are not working, make sure we fail after a few tries
rather than looping infinitely to find infinity. 10 iterations is
arbitrary -- 1 is likely enough in most cases.
  • Loading branch information
craigberry committed Mar 29, 2024
1 parent 1c90da2 commit a49eddd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Porting/Maintainers.pl
Expand Up @@ -1005,6 +1005,10 @@ package Maintainers;
'Scalar::Util' => {
'DISTRIBUTION' => 'PEVANS/Scalar-List-Utils-1.63.tar.gz',
'FILES' => q[cpan/Scalar-List-Utils],
'CUSTOMIZED' => [
# https://github.com/Dual-Life/Scalar-List-Utils/pull/130
't/uniqnum.t'
],
},

'Search::Dict' => {
Expand Down
5 changes: 4 additions & 1 deletion cpan/Scalar-List-Utils/t/uniqnum.t
Expand Up @@ -190,7 +190,10 @@ is_deeply( [ uniqnum @in],
# Hard to know for sure what an Inf is going to be. Lets make one
my $Inf = 0 + 1E1000;
my $NaN;
$Inf **= 1000 while ( $NaN = $Inf - $Inf ) == $NaN;
for (1..10) {
$Inf **= 1000;
last unless ( $NaN = $Inf - $Inf ) == $NaN;
}

is_deeply( [ uniqnum 0, 1, 12345, $Inf, -$Inf, $NaN, 0, $Inf, $NaN ],
[ 0, 1, 12345, $Inf, -$Inf, $NaN ],
Expand Down
1 change: 1 addition & 0 deletions t/porting/customized.dat
Expand Up @@ -10,6 +10,7 @@ MIME::Base64 cpan/MIME-Base64/Base64.xs ad617fe2d01932c35b92defa26d40aba601a95a8
MIME::Base64 cpan/MIME-Base64/lib/MIME/Base64.pm 18e38d197c7c83f96b24f48bef514e93908e6a82
MIME::Base64 cpan/MIME-Base64/lib/MIME/QuotedPrint.pm 36cbb455ab57b9bbca7e86f50987c8b1df1a8122
Pod::Perldoc cpan/Pod-Perldoc/lib/Pod/Perldoc.pm 582be34c077c9ff44d99914724a0cc2140bcd48c
Scalar::Util cpan/Scalar-List-Utils/t/uniqnum.t 553b0df79a084015b39e4ae9774f801c9eafeb4c
Time::Piece cpan/Time-Piece/Piece.pm 8cec8b66183ceddb9bf2b6af35dcdd345bc9adfa
Time::Piece cpan/Time-Piece/Piece.xs 543152540ee17788a638b2c5746b86c3d04401d1
Win32API::File cpan/Win32API-File/File.pm 8fd212857f821cb26648878b96e57f13bf21b99e
Expand Down

0 comments on commit a49eddd

Please sign in to comment.