diff -Nru libscalar-list-utils-perl-1.42/Changes libscalar-list-utils-perl-1.43/Changes --- libscalar-list-utils-perl-1.42/Changes 2015-04-23 00:30:54.000000000 +0000 +++ libscalar-list-utils-perl-1.43/Changes 2016-02-08 15:05:37.000000000 +0000 @@ -1,3 +1,18 @@ +1.43 -- 2016/02/08 15:05:23 + [CHANGES] + * Updated documentation + * Added MIN_PERL_VERSION to Makefile.PL + * Added "use warnings" to all tests + * Added MANIEST.SKIP patterns for common editor backup/swapfiles + * Test product(0,0) (RT105415) + + [BUGFIXES] + * Fix build on non-C99 compilers + * Avoid divide-by-zero exception if product()'s accumulator is IV zero + (RT105415) + * Possible fix for SvTEMP issues in first and any/all/none/notall + (RT96343) + 1.42 -- 2015/04/32 01:25:55 [CHANGES] * Added List::Util::unpairs() - the inverse of pairs() diff -Nru libscalar-list-utils-perl-1.42/debian/changelog libscalar-list-utils-perl-1.43/debian/changelog --- libscalar-list-utils-perl-1.42/debian/changelog 2015-12-17 16:05:26.000000000 +0000 +++ libscalar-list-utils-perl-1.43/debian/changelog 2016-02-08 16:00:18.000000000 +0000 @@ -1,8 +1,11 @@ -libscalar-list-utils-perl (1:1.42-1build1) xenial; urgency=medium +libscalar-list-utils-perl (1:1.43-1) unstable; urgency=medium - * Rebuild for Perl 5.22.1. + * debian/control: Use HTTPS transport protocol for Vcs-Git URI + * Import upstream version 1.43 + * Update copyright years for debian/* packaging files + * Declare compliance with Debian policy 3.9.7 - -- Colin Watson Thu, 17 Dec 2015 16:05:26 +0000 + -- Salvatore Bonaccorso Mon, 08 Feb 2016 16:59:44 +0100 libscalar-list-utils-perl (1:1.42-1) unstable; urgency=medium diff -Nru libscalar-list-utils-perl-1.42/debian/control libscalar-list-utils-perl-1.43/debian/control --- libscalar-list-utils-perl-1.42/debian/control 2015-07-01 05:27:30.000000000 +0000 +++ libscalar-list-utils-perl-1.43/debian/control 2016-02-08 16:00:18.000000000 +0000 @@ -6,9 +6,9 @@ Section: perl Priority: optional Build-Depends: debhelper (>= 9.20120312~), perl -Standards-Version: 3.9.6 +Standards-Version: 3.9.7 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libscalar-list-utils-perl.git -Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libscalar-list-utils-perl.git +Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libscalar-list-utils-perl.git Homepage: https://metacpan.org/release/Scalar-List-Utils Testsuite: autopkgtest-pkg-perl diff -Nru libscalar-list-utils-perl-1.42/debian/copyright libscalar-list-utils-perl-1.43/debian/copyright --- libscalar-list-utils-perl-1.42/debian/copyright 2015-07-01 05:27:30.000000000 +0000 +++ libscalar-list-utils-perl-1.43/debian/copyright 2016-02-08 16:00:18.000000000 +0000 @@ -46,7 +46,7 @@ License: Artistic or GPL-1+ Files: debian/* -Copyright: 2009-2015, Salvatore Bonaccorso +Copyright: 2009-2016, Salvatore Bonaccorso 2010, Jonathan Yu 2011, Fabrizio Regalli License: Artistic or GPL-1+ diff -Nru libscalar-list-utils-perl-1.42/lib/List/Util/XS.pm libscalar-list-utils-perl-1.43/lib/List/Util/XS.pm --- libscalar-list-utils-perl-1.42/lib/List/Util/XS.pm 2015-04-23 00:30:54.000000000 +0000 +++ libscalar-list-utils-perl-1.43/lib/List/Util/XS.pm 2016-02-08 15:05:07.000000000 +0000 @@ -1,8 +1,9 @@ package List::Util::XS; use strict; +use warnings; use List::Util; -our $VERSION = "1.42"; # FIXUP +our $VERSION = "1.43"; # FIXUP $VERSION = eval $VERSION; # FIXUP 1; diff -Nru libscalar-list-utils-perl-1.42/lib/List/Util.pm libscalar-list-utils-perl-1.43/lib/List/Util.pm --- libscalar-list-utils-perl-1.42/lib/List/Util.pm 2015-04-23 00:30:54.000000000 +0000 +++ libscalar-list-utils-perl-1.43/lib/List/Util.pm 2016-02-08 15:05:07.000000000 +0000 @@ -7,6 +7,7 @@ package List::Util; use strict; +use warnings; require Exporter; our @ISA = qw(Exporter); @@ -14,7 +15,7 @@ all any first min max minstr maxstr none notall product reduce sum sum0 shuffle pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst ); -our $VERSION = "1.42"; +our $VERSION = "1.43"; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -48,7 +49,15 @@ =head1 SYNOPSIS - use List::Util qw(first max maxstr min minstr reduce shuffle sum); + use List::Util qw( + reduce any all none notall first + + max maxstr min minstr product sum sum0 + + pairs pairkeys pairvalues pairfirst pairgrep pairmap + + shuffle + ); =head1 DESCRIPTION @@ -67,7 +76,9 @@ =cut -=head2 $result = reduce { BLOCK } @list +=head2 reduce + + $result = reduce { BLOCK } @list Reduces C<@list> by calling C in a scalar context multiple times, setting C<$a> and C<$b> each time. The first call will be with C<$a> and C<$b> @@ -289,22 +300,23 @@ I A convenient shortcut to operating on even-sized lists of pairs, this function -returns a list of ARRAY references, each containing two items from the given -list. It is a more efficient version of +returns a list of C references, each containing two items from the +given list. It is a more efficient version of @pairs = pairmap { [ $a, $b ] } @kvlist It is most convenient to use in a C loop, for example: - foreach my $pair ( pairs @KVLIST ) { + foreach my $pair ( pairs @kvlist ) { my ( $key, $value ) = @$pair; ... } -Since version C<1.39> these ARRAY references are blessed objects, recognising -the two methods C and C. The following code is equivalent: +Since version C<1.39> these C references are blessed objects, +recognising the two methods C and C. The following code is +equivalent: - foreach my $pair ( pairs @KVLIST ) { + foreach my $pair ( pairs @kvlist ) { my $key = $pair->key; my $value = $pair->value; ... @@ -316,7 +328,7 @@ I -The inverse function to C; this function takes a list of ARRAY +The inverse function to C; this function takes a list of C references containing two elements each, and returns a flattened list of the two values from each of the pairs, in order. This is notionally equivalent to diff -Nru libscalar-list-utils-perl-1.42/lib/Scalar/Util.pm libscalar-list-utils-perl-1.43/lib/Scalar/Util.pm --- libscalar-list-utils-perl-1.42/lib/Scalar/Util.pm 2015-04-23 00:30:54.000000000 +0000 +++ libscalar-list-utils-perl-1.43/lib/Scalar/Util.pm 2016-02-08 15:05:07.000000000 +0000 @@ -7,6 +7,7 @@ package Scalar::Util; use strict; +use warnings; require Exporter; our @ISA = qw(Exporter); @@ -16,7 +17,7 @@ dualvar isdual isvstring looks_like_number openhandle readonly set_prototype tainted ); -our $VERSION = "1.42"; +our $VERSION = "1.43"; $VERSION = eval $VERSION; require List::Util; # List::Util loads the XS @@ -74,8 +75,8 @@ C contains a selection of subroutines that people have expressed would be nice to have in the perl core, but the usage would not really be high -enough to warrant the use of a keyword, and the size so small such that being -individual extensions would be wasteful. +enough to warrant the use of a keyword, and the size would be so small that +being individual extensions would be wasteful. By default C does not export any subroutines. @@ -89,7 +90,7 @@ my $pkg = blessed( $ref ); -If C<$ref> is a blessed reference the name of the package that it is blessed +If C<$ref> is a blessed reference, the name of the package that it is blessed into is returned. Otherwise C is returned. $scalar = "foo"; @@ -108,7 +109,7 @@ my $addr = refaddr( $ref ); -If C<$ref> is reference the internal memory address of the referenced value is +If C<$ref> is reference, the internal memory address of the referenced value is returned as a plain integer. Otherwise C is returned. $addr = refaddr "string"; # undef @@ -122,7 +123,7 @@ my $type = reftype( $ref ); -If C<$ref> is a reference the basic Perl type of the variable referenced is +If C<$ref> is a reference, the basic Perl type of the variable referenced is returned as a plain string (such as C or C). Otherwise C is returned. @@ -138,7 +139,7 @@ weaken( $ref ); The lvalue C<$ref> will be turned into a weak reference. This means that it -will not hold a reference count on the object it references. Also when the +will not hold a reference count on the object it references. Also, when the reference count on that object reaches zero, the reference will be set to undef. This function mutates the lvalue passed as its argument and returns no value. @@ -242,8 +243,8 @@ $bar = $foo + 0; $dual = isdual($foo); # true -Note that although C<$!> appears to be dual-valued variable, it is actually -implemented using a tied scalar: +Note that although C<$!> appears to be a dual-valued variable, it is +actually implemented as a magical variable inside the interpreter: $! = 1; print("$!\n"); # "Operation not permitted" @@ -258,7 +259,7 @@ my $vstring = isvstring( $var ); -If C<$var> is a scalar which was coded as a vstring the result is true. +If C<$var> is a scalar which was coded as a vstring, the result is true. $vs = v49.46.48; $fmt = isvstring($vs) ? "%vd" : "%s"; #true @@ -328,15 +329,6 @@ The version of perl that you are using does not implement Vstrings, to use L you will need to use a newer release of perl. -=item C is only available with the XS version of Scalar::Util - -C contains both perl and C implementations of many of its -functions so that those without access to a C compiler may still use it. -However some of the functions are only available when a C compiler was -available to compile the XS version of the extension. - -At present that list is: weaken, isweak, dualvar, isvstring, set_prototype - =back =head1 KNOWN BUGS diff -Nru libscalar-list-utils-perl-1.42/lib/Sub/Util.pm libscalar-list-utils-perl-1.43/lib/Sub/Util.pm --- libscalar-list-utils-perl-1.42/lib/Sub/Util.pm 2015-04-23 00:30:54.000000000 +0000 +++ libscalar-list-utils-perl-1.43/lib/Sub/Util.pm 2016-02-08 15:05:07.000000000 +0000 @@ -15,7 +15,7 @@ subname set_subname ); -our $VERSION = "1.42"; +our $VERSION = "1.43"; $VERSION = eval $VERSION; require List::Util; # as it has the XS diff -Nru libscalar-list-utils-perl-1.42/ListUtil.xs libscalar-list-utils-perl-1.43/ListUtil.xs --- libscalar-list-utils-perl-1.42/ListUtil.xs 2015-04-23 00:28:41.000000000 +0000 +++ libscalar-list-utils-perl-1.43/ListUtil.xs 2016-02-03 00:56:58.000000000 +0000 @@ -96,7 +96,7 @@ CODE: { int index; - NV retval; + NV retval = 0.0; /* avoid 'uninit var' warning */ SV *retsv; int magic; @@ -212,16 +212,72 @@ break; case ACC_IV: if(is_product) { - if(!SvNOK(sv) && SvIOK(sv) && (SvIV(sv) < IV_MAX / retiv)) { - retiv *= SvIV(sv); - break; + /* TODO: Consider if product() should shortcircuit the moment its + * accumulator becomes zero + */ + /* XXX testing flags before running get_magic may + * cause some valid tied values to fallback to the NV path + * - DAPM */ + if(!SvNOK(sv) && SvIOK(sv)) { + IV i = SvIV(sv); + if (retiv == 0) /* avoid later division by zero */ + break; + if (retiv < 0) { + if (i < 0) { + if (i >= IV_MAX / retiv) { + retiv *= i; + break; + } + } + else { + if (i <= IV_MIN / retiv) { + retiv *= i; + break; + } + } + } + else { + if (i < 0) { + if (i >= IV_MIN / retiv) { + retiv *= i; + break; + } + } + else { + if (i <= IV_MAX / retiv) { + retiv *= i; + break; + } + } + } } /* else fallthrough */ } else { - if(!SvNOK(sv) && SvIOK(sv) && (SvIV(sv) < IV_MAX - retiv)) { - retiv += SvIV(sv); - break; + /* XXX testing flags before running get_magic may + * cause some valid tied values to fallback to the NV path + * - DAPM */ + if(!SvNOK(sv) && SvIOK(sv)) { + IV i = SvIV(sv); + if (retiv >= 0 && i >= 0) { + if (retiv <= IV_MAX - i) { + retiv += i; + break; + } + /* else fallthrough */ + } + else if (retiv < 0 && i < 0) { + if (retiv >= IV_MIN - i) { + retiv += i; + break; + } + /* else fallthrough */ + } + else { + /* mixed signs can't overflow */ + retiv += i; + break; + } } /* else fallthrough */ } @@ -327,6 +383,7 @@ dMULTICALL; I32 gimme = G_SCALAR; + PERL_UNUSED_VAR(newsp); PUSH_MULTICALL(cv); for(index = 2 ; index < items ; index++) { GvSV(bgv) = args[index]; @@ -380,10 +437,15 @@ if(!CvISXSUB(cv)) { dMULTICALL; I32 gimme = G_SCALAR; + + PERL_UNUSED_VAR(newsp); PUSH_MULTICALL(cv); for(index = 1 ; index < items ; index++) { - GvSV(PL_defgv) = args[index]; + SV *def_sv = GvSV(PL_defgv) = args[index]; +# ifdef SvTEMP_off + SvTEMP_off(def_sv); +# endif MULTICALL; if(SvTRUEx(*PL_stack_sp)) { # ifdef PERL_HAS_BAD_MULTICALL_REFCOUNT @@ -448,9 +510,13 @@ I32 gimme = G_SCALAR; int index; + PERL_UNUSED_VAR(newsp); PUSH_MULTICALL(cv); for(index = 1; index < items; index++) { - GvSV(PL_defgv) = args[index]; + SV *def_sv = GvSV(PL_defgv) = args[index]; +# ifdef SvTEMP_off + SvTEMP_off(def_sv); +# endif MULTICALL; if(SvTRUEx(*PL_stack_sp) ^ invert) { @@ -529,6 +595,8 @@ for(i = 0; i < items; i++) { SV *pair = args_copy[i]; + AV *pairav; + SvGETMAGIC(pair); if(SvTYPE(pair) != SVt_RV) @@ -536,8 +604,8 @@ if(SvTYPE(SvRV(pair)) != SVt_PVAV) croak("Not an ARRAY reference at List::Util::unpack() argument %d", i); - // TODO: assert pair is an ARRAY ref - AV *pairav = (AV *)SvRV(pair); + /* TODO: assert pair is an ARRAY ref */ + pairav = (AV *)SvRV(pair); EXTEND(SP, 2); @@ -626,6 +694,7 @@ dMULTICALL; I32 gimme = G_SCALAR; + PERL_UNUSED_VAR(newsp); PUSH_MULTICALL(cv); for(; argi < items; argi += 2) { SV *a = GvSV(agv) = stack[argi]; @@ -710,6 +779,7 @@ dMULTICALL; I32 gimme = G_SCALAR; + PERL_UNUSED_VAR(newsp); PUSH_MULTICALL(cv); for(; argi < items; argi += 2) { SV *a = GvSV(agv) = stack[argi]; @@ -800,13 +870,15 @@ dMULTICALL; I32 gimme = G_ARRAY; + PERL_UNUSED_VAR(newsp); PUSH_MULTICALL(cv); for(; argi < items; argi += 2) { - SV *a = GvSV(agv) = args_copy ? args_copy[argi] : stack[argi]; - SV *b = GvSV(bgv) = argi < items-1 ? + int count; + + GvSV(agv) = args_copy ? args_copy[argi] : stack[argi]; + GvSV(bgv) = argi < items-1 ? (args_copy ? args_copy[argi+1] : stack[argi+1]) : &PL_sv_undef; - int count; MULTICALL; count = PL_stack_sp - PL_stack_base; @@ -844,13 +916,14 @@ { for(; argi < items; argi += 2) { dSP; - SV *a = GvSV(agv) = args_copy ? args_copy[argi] : ST(argi); - SV *b = GvSV(bgv) = argi < items-1 ? - (args_copy ? args_copy[argi+1] : ST(argi+1)) : - &PL_sv_undef; int count; int i; + GvSV(agv) = args_copy ? args_copy[argi] : ST(argi); + GvSV(bgv) = argi < items-1 ? + (args_copy ? args_copy[argi+1] : ST(argi+1)) : + &PL_sv_undef; + PUSHMARK(SP); count = call_sv((SV*)cv, G_ARRAY); diff -Nru libscalar-list-utils-perl-1.42/Makefile.PL libscalar-list-utils-perl-1.43/Makefile.PL --- libscalar-list-utils-perl-1.42/Makefile.PL 2012-09-27 17:30:16.000000000 +0000 +++ libscalar-list-utils-perl-1.43/Makefile.PL 2016-02-04 15:14:28.000000000 +0000 @@ -28,13 +28,24 @@ ( $PERL_CORE ? () : ( - INSTALLDIRS => ($] < 5.011 ? q[perl] : q[site]), - PREREQ_PM => {'Test::More' => 0,}, + INSTALLDIRS => ($] < 5.011 ? q[perl] : q[site]), + PREREQ_PM => {'Test::More' => 0,}, (eval { ExtUtils::MakeMaker->VERSION(6.31) } ? (LICENSE => 'perl') : ()), + (eval { ExtUtils::MakeMaker->VERSION(6.48) } ? (MIN_PERL_VERSION => '5.006') : ()), ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( META_MERGE => { + 'meta-spec' => { version => 2 }, + dynamic_config => 0, resources => { ## - repository => 'https://github.com/Scalar-List-Utils/Scalar-List-Utils', + repository => { + url => 'https://github.com/Scalar-List-Utils/Scalar-List-Utils.git', + web => 'https://github.com/Scalar-List-Utils/Scalar-List-Utils', + type => 'git', + }, + bugtracker => { + mailto => 'bug-Scalar-List-Utils@rt.cpan.org', + web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils', + }, }, } ) diff -Nru libscalar-list-utils-perl-1.42/MANIFEST libscalar-list-utils-perl-1.43/MANIFEST --- libscalar-list-utils-perl-1.42/MANIFEST 2015-04-23 00:31:07.000000000 +0000 +++ libscalar-list-utils-perl-1.43/MANIFEST 2016-02-08 15:07:27.000000000 +0000 @@ -7,8 +7,6 @@ Makefile.PL MANIFEST This list of files multicall.h -MYMETA.json -MYMETA.yml ppport.h README t/00version.t @@ -31,6 +29,7 @@ t/reduce.t t/refaddr.t t/reftype.t +t/rt-96343.t t/scalarutil-proto.t t/shuffle.t t/stack-corruption.t diff -Nru libscalar-list-utils-perl-1.42/META.json libscalar-list-utils-perl-1.43/META.json --- libscalar-list-utils-perl-1.42/META.json 2015-04-23 00:31:07.000000000 +0000 +++ libscalar-list-utils-perl-1.43/META.json 2016-02-08 15:07:26.000000000 +0000 @@ -3,8 +3,8 @@ "author" : [ "Graham Barr " ], - "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690", + "dynamic_config" : 0, + "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005", "license" : [ "perl_5" ], @@ -32,15 +32,23 @@ }, "runtime" : { "requires" : { - "Test::More" : "0" + "Test::More" : "0", + "perl" : "5.006" } } }, "release_status" : "stable", "resources" : { + "bugtracker" : { + "mailto" : "bug-Scalar-List-Utils@rt.cpan.org", + "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils" + }, "repository" : { - "url" : "https://github.com/Scalar-List-Utils/Scalar-List-Utils" + "type" : "git", + "url" : "https://github.com/Scalar-List-Utils/Scalar-List-Utils.git", + "web" : "https://github.com/Scalar-List-Utils/Scalar-List-Utils" } }, - "version" : "1.42" + "version" : "1.43", + "x_serialization_backend" : "JSON::PP version 2.27300" } diff -Nru libscalar-list-utils-perl-1.42/META.yml libscalar-list-utils-perl-1.43/META.yml --- libscalar-list-utils-perl-1.42/META.yml 2015-04-23 00:31:07.000000000 +0000 +++ libscalar-list-utils-perl-1.43/META.yml 2016-02-08 15:07:26.000000000 +0000 @@ -6,8 +6,8 @@ ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' -dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690' +dynamic_config: 0 +generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -19,6 +19,9 @@ - inc requires: Test::More: '0' + perl: '5.006' resources: - repository: https://github.com/Scalar-List-Utils/Scalar-List-Utils -version: '1.42' + bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils + repository: https://github.com/Scalar-List-Utils/Scalar-List-Utils.git +version: '1.43' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -Nru libscalar-list-utils-perl-1.42/MYMETA.json libscalar-list-utils-perl-1.43/MYMETA.json --- libscalar-list-utils-perl-1.42/MYMETA.json 2015-04-23 00:30:57.000000000 +0000 +++ libscalar-list-utils-perl-1.43/MYMETA.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -{ - "abstract" : "Common Scalar and List utility subroutines", - "author" : [ - "Graham Barr " - ], - "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690", - "license" : [ - "perl_5" - ], - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" - }, - "name" : "Scalar-List-Utils", - "no_index" : { - "directory" : [ - "t", - "inc" - ] - }, - "prereqs" : { - "build" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "runtime" : { - "requires" : { - "Test::More" : "0" - } - } - }, - "release_status" : "stable", - "resources" : { - "repository" : { - "url" : "https://github.com/Scalar-List-Utils/Scalar-List-Utils" - } - }, - "version" : "1.42" -} diff -Nru libscalar-list-utils-perl-1.42/MYMETA.yml libscalar-list-utils-perl-1.43/MYMETA.yml --- libscalar-list-utils-perl-1.42/MYMETA.yml 2015-04-23 00:30:57.000000000 +0000 +++ libscalar-list-utils-perl-1.43/MYMETA.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ ---- -abstract: 'Common Scalar and List utility subroutines' -author: - - 'Graham Barr ' -build_requires: - ExtUtils::MakeMaker: '0' -configure_requires: - ExtUtils::MakeMaker: '0' -dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690' -license: perl -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: '1.4' -name: Scalar-List-Utils -no_index: - directory: - - t - - inc -requires: - Test::More: '0' -resources: - repository: https://github.com/Scalar-List-Utils/Scalar-List-Utils -version: '1.42' diff -Nru libscalar-list-utils-perl-1.42/t/product.t libscalar-list-utils-perl-1.43/t/product.t --- libscalar-list-utils-perl-1.42/t/product.t 2014-08-27 20:58:45.000000000 +0000 +++ libscalar-list-utils-perl-1.43/t/product.t 2016-02-08 15:05:07.000000000 +0000 @@ -3,8 +3,9 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 25; +use Config; use List::Util qw(product); my $v = product; @@ -19,6 +20,18 @@ $v = product(-1); is( $v, -1, 'one -1'); +$v = product(0, 1, 2); +is( $v, 0, 'first factor zero' ); + +$v = product(0, 1); +is( $v, 0, '0 * 1'); + +$v = product(1, 0); +is( $v, 0, '1 * 0'); + +$v = product(0, 0); +is( $v, 0, 'two 0'); + my $x = -3; $v = product($x, 3); @@ -86,3 +99,29 @@ is($t, 567, 'overload returning non-overload'); } +SKIP: { + skip "IV is not at least 64bit", 8 unless $Config{ivsize} >= 8; + + my $t; + my $min = -(1<<31); + my $max = (1<<31)-1; + + $t = product($min, $min); + is($t, 1<<62, 'min * min'); + $t = product($min, $max); + is($t, (1<<31) - (1<<62), 'min * max'); + $t = product($max, $min); + is($t, (1<<31) - (1<<62), 'max * min'); + $t = product($max, $max); + is($t, (1<<62)-(1<<32)+1, 'max * max'); + + $t = product($min*8, $min); + cmp_ok($t, '>', (1<<61), 'min*8*min'); # may be an NV + $t = product($min*8, $max); + cmp_ok($t, '<', -(1<<61), 'min*8*max'); # may be an NV + $t = product($max, $min*8); + cmp_ok($t, '<', -(1<<61), 'min*max*8'); # may be an NV + $t = product($max, $max*8); + cmp_ok($t, '>', (1<<61), 'max*max*8'); # may be an NV + +} diff -Nru libscalar-list-utils-perl-1.42/t/rt-96343.t libscalar-list-utils-perl-1.43/t/rt-96343.t --- libscalar-list-utils-perl-1.42/t/rt-96343.t 1970-01-01 00:00:00.000000000 +0000 +++ libscalar-list-utils-perl-1.43/t/rt-96343.t 2016-02-08 15:05:07.000000000 +0000 @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +{ + use List::Util qw( first ); + + my $hash = { + 'HellO WorlD' => 1, + }; + + is( ( first { 'hello world' eq lc($_) } keys %$hash ), "HellO WorlD", + 'first (lc$_) perserves value' ); +} + +{ + use List::Util qw( any ); + + my $hash = { + 'HellO WorlD' => 1, + }; + + my $var; + + no warnings 'void'; + any { lc($_); $var = $_; } keys %$hash; + + is( $var, 'HellO WorlD', + 'any (lc$_) leaves value undisturbed' ); +} + +done_testing; diff -Nru libscalar-list-utils-perl-1.42/t/sum.t libscalar-list-utils-perl-1.43/t/sum.t --- libscalar-list-utils-perl-1.42/t/sum.t 2014-08-27 20:58:45.000000000 +0000 +++ libscalar-list-utils-perl-1.43/t/sum.t 2016-02-08 15:05:07.000000000 +0000 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 15; +use Test::More tests => 17; use Config; use List::Util qw(sum); @@ -91,9 +91,17 @@ } SKIP: { - skip "IV is not at least 64bit", 1 unless $Config{ivsize} >= 8; + skip "IV is not at least 64bit", 3 unless $Config{ivsize} >= 8; # Sum using NV will only preserve 53 bits of integer precision my $t = sum(1<<60, 1); cmp_ok($t, '>', 1<<60, 'sum uses IV where it can'); + + my $min = -(1<<63); + my $max = (1<<63)-1; + + $t = sum($min, $max); + is($t, -1, 'min + max'); + $t = sum($max, $min); + is($t, -1, 'max + min'); }