Subject: | Small pile of fixes |
I'm considering using Scalar::Util::Numeric in perl5i to replace my ad
hoc is_integer/is_decimal checks. As such I want to fix it up so it
makes CPAN testers happy.
Here you'll find a small pile of fixes for Scalar::Util::Numeric. I
started with trying to get it working on 5.6.2 and cleaned up a few
other things.
http://github.com/schwern/Scalar-Util-Numeric/commits/master
* AutoLoader is probably slowing down the loading of such a small
module. Probably an artifact of h2xs.
* 5.6's Math::BigInt doesn't have bstr()
* Make the test-only deps on Math::BigInt and Math::Complex optional.
5.6.2 remains confused about the UV tests.
$ perl5.6.2 -Iblib/lib -Iblib/arch t/Scalar-Util-Numeric.t
1..34
ok 1 - use Scalar::Util::Numeric;
ok 2 - isnum(0) == 1
ok 3 - isnum(1) == 1
ok 4 - isnum(-1) == 9
ok 5 - isnum('0.00') == 5
ok 6 - isnum(undef) == 0
ok 7 - isnum('A') == 0
ok 8 - isnum('A0') == 0
ok 9 - isnum('0A') == 0
ok 10 - isnum(\&ok) == 0
not ok 11 - isuv($uvmax) == 1
# Failed test (t/Scalar-Util-Numeric.t at line 31)
# got: '0'
# expected: '1'
# UVMAX: 4294967295
ok 12 - isuv(-1) == 1
not ok 13 - isbig($uvmax) == 0
# Failed test (t/Scalar-Util-Numeric.t at line 34)
# got: '1'
# expected: '0'
ok 14 # skip Need Math::BigInt with bstr() to test numbers bigger than UV
ok 15 - isfloat(3.1415927) == 1
ok 16 - isfloat(-3.1415927) == 1
ok 17 - isfloat(3) == 0
ok 18 - isfloat('1.0')
ok 19 - isneg(-1) == 1
ok 20 - isneg(-3.1415927) == 1
ok 21 - isneg(1) == 0
ok 22 - isneg(3.1415927) == 0
ok 23 - isinf('Inf') == 1
ok 24 - isinf(3.1415927) == 0
ok 25 - isinf($Math::Complex::Inf) == 1
ok 26 - isint(-99) == -1
ok 27 - isint(0) == 1
ok 28 - isint(3.1415927) == 0
ok 29 - isint(-3.1415927) == 0
not ok 30 - isint($uvmax) == 1
# Failed test (t/Scalar-Util-Numeric.t at line 61)
# got: '0'
# expected: '1'
ok 31 - isint($Math::Complex::Inf) == 0
ok 32 - isint('1.0')
not ok 33 - isnan('NaN') == 1
# Failed test (t/Scalar-Util-Numeric.t at line 67)
# got: '0'
# expected: '1'
ok 34 - isnan(42) == 0
# Looks like you failed 4 tests of 34.
I don't actually care if it works on 5.6, but if 5.6 is abandoned update
the use 5.006 line in the Makefile.PL so the cpan testers stop failing it.