Commit b1298f89 authored by gregor herrmann's avatar gregor herrmann

New upstream version 1.999815

parent 5d393f3b
1.999815 2018-10-19
* Move bitwise operators signed and, signed or, and signed xor from
lib/Math/BigInt/CalcEmu.pm into lib/Math/BigInt/Lib.pm. The file
lib/Math/BigInt/CalcEmu.pm is no longer needed and thus removed.
1.999814 2018-10-01
* Add to_base() and from_base() to Math::BigInt and corresponding library
methods _to_base() and _from_base() to Math::BigInt::Lib. This was inspired
by CPAN RT #122681.
* Fix Makefile.PL to reflect that Test::More is only needed for testing, not
for building.
* In the documentation for each of the to_(bin|hex|oct|bytes) methods, add a
reference to the corresponding from_(bin|hex|oct|bytes) method.
1.999813 2018-04-18
* Fix CPAN RT #125108. Remove test files try.pl, t/author-bpi-big-mbf.t, and
......
......@@ -9,7 +9,6 @@ HISTORY
lib/Math/BigFloat.pm
lib/Math/BigInt.pm
lib/Math/BigInt/Calc.pm
lib/Math/BigInt/CalcEmu.pm
lib/Math/BigInt/Lib.pm
LICENSE
Makefile.PL
......@@ -77,6 +76,12 @@ t/author-lib-bitwise-_and.dat
t/author-lib-bitwise-_and.t
t/author-lib-bitwise-_or.dat
t/author-lib-bitwise-_or.t
t/author-lib-bitwise-_sand.dat
t/author-lib-bitwise-_sand.t
t/author-lib-bitwise-_sor.dat
t/author-lib-bitwise-_sor.t
t/author-lib-bitwise-_sxor.dat
t/author-lib-bitwise-_sxor.t
t/author-lib-bitwise-_xor.dat
t/author-lib-bitwise-_xor.t
t/author-lib-boolean-_is_even.t
......@@ -86,6 +91,8 @@ t/author-lib-boolean-_is_ten.t
t/author-lib-boolean-_is_two.t
t/author-lib-boolean-_is_zero.t
t/author-lib-comparison-_acmp.t
t/author-lib-constructor-binary-_from_base.dat
t/author-lib-constructor-binary-_from_base.t
t/author-lib-constructor-nullary-_one.t
t/author-lib-constructor-nullary-_ten.t
t/author-lib-constructor-nullary-_two.t
......@@ -110,6 +117,8 @@ t/author-lib-convert-string-_as_hex.t
t/author-lib-convert-string-_as_oct.dat
t/author-lib-convert-string-_as_oct.t
t/author-lib-convert-string-_str.t
t/author-lib-convert-string-_to_base.dat
t/author-lib-convert-string-_to_base.t
t/author-lib-convert-string-_to_bin.dat
t/author-lib-convert-string-_to_bin.t
t/author-lib-convert-string-_to_bytes.dat
......@@ -162,6 +171,7 @@ t/dparts-mbf.t
t/dparts-mbi.t
t/eparts-mbf.t
t/eparts-mbi.t
t/from_base-mbi.t
t/from_bin-mbf.t
t/from_bin-mbi.t
t/from_hex-mbf.t
......@@ -209,6 +219,7 @@ t/sub_ali.t
t/sub_mbf.t
t/sub_mbi.t
t/sub_mif.t
t/to_base-mbi.t
t/trap.t
t/upgrade.inc
t/upgrade.t
......
#!start included /usr/share/perl5/5.26/ExtUtils/MANIFEST.SKIP
#!start included /usr/local/share/perl5/site_perl/5.26/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\bRCS\b
\bCVS\b
......@@ -62,7 +62,16 @@
# Avoid MYMETA files
^MYMETA\.
#!end included /usr/share/perl5/5.26/ExtUtils/MANIFEST.SKIP
# Avoid travis-ci.org file
^\.travis.yml
# Avoid appveyor.com file
^\.appveyor.yml
#!end included /usr/local/share/perl5/site_perl/5.26/ExtUtils/MANIFEST.SKIP
# Avoid more git stuff.
\B\.gitattributes\b
# Avoid distribution-specific stuff.
^Math-BigInt-[0-9]
......@@ -21,24 +21,26 @@
},
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
"requires" : {}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
"ExtUtils::MakeMaker" : "6.58"
}
},
"runtime" : {
"requires" : {
"Math::Complex" : "1.39",
"Test::More" : "0.94",
"perl" : "5.006001"
}
},
"test" : {
"requires" : {
"Test::More" : "0.94"
}
}
},
"release_status" : "stable",
"version" : "1.999813",
"version" : "1.999815",
"x_serialization_backend" : "JSON::PP version 2.97001"
}
......@@ -3,9 +3,9 @@ abstract: unknown
author:
- 'Peter John Acklam <pjacklam@gmail.com>'
build_requires:
ExtUtils::MakeMaker: '0'
Test::More: '0.94'
configure_requires:
ExtUtils::MakeMaker: '0'
ExtUtils::MakeMaker: '6.58'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010'
license: perl
......@@ -19,7 +19,6 @@ no_index:
- inc
requires:
Math::Complex: '1.39'
Test::More: '0.94'
perl: '5.006001'
version: '1.999813'
version: '1.999815'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
......@@ -57,11 +57,32 @@ my %WriteMakefileArgs =
'VERSION_FROM' => 'lib/Math/BigInt.pm',
'AUTHOR' => 'Peter John Acklam <pjacklam@gmail.com>',
'MIN_PERL_VERSION' => 5.006001,
# A hash of modules that are required to run Makefile.PL itself, but not to
# run the distribution.
'CONFIGURE_REQUIRES' => {
'ExtUtils::MakeMaker' => 6.58,
},
# A hash of modules that are needed to build the module but not run it.
'BUILD_REQUIRES' => {},
# A hash of modules that are needed to run the module.
'PREREQ_PM' => {
#'ExtUtils::MakeMaker' => 6.58,
'Test::More' => 0.94,
'Math::Complex' => 1.39,
},
# A hash of modules that are needed to test the module but not run or build
# it.
'TEST_REQUIRES' => {
'Test::More' => 0.94,
},
'LICENSE' => 'perl_5',
'LIBS' => [''], # e.g., '-lm'
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
......
This diff is collapsed.
......@@ -19,7 +19,7 @@ use warnings;
use Carp qw< carp croak >;
use Math::BigInt ();
our $VERSION = '1.999813';
our $VERSION = '1.999815';
our @ISA = qw/Math::BigInt/;
our @EXPORT_OK = qw/bpi/;
......
This diff is collapsed.
......@@ -7,7 +7,7 @@ use warnings;
use Carp qw< carp croak >;
use Math::BigInt::Lib;
our $VERSION = '1.999813';
our $VERSION = '1.999815';
our @ISA = ('Math::BigInt::Lib');
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print "1..0 # SKIP these tests are for testing by the author\n";
exit;
}
}
use strict;
use warnings;
use Test::More tests => 69001;
###############################################################################
# Read and load configuration file and backend library.
use Config::Tiny;
use Scalar::Util qw< refaddr >;
my $config_file = 't/author-lib.ini';
my $config = Config::Tiny -> read('t/author-lib.ini')
or die Config::Tiny -> errstr();
# Read the library to test.
our $LIB = $config->{_}->{lib};
die "No library defined in file '$config_file'"
unless defined $LIB;
die "Invalid library name '$LIB' in file '$config_file'"
unless $LIB =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Read the reference type(s) the library uses.
our $REF = $config->{_}->{ref};
die "No reference type defined in file '$config_file'"
unless defined $REF;
die "Invalid reference type '$REF' in file '$config_file'"
unless $REF =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Load the library.
eval "require $LIB";
die $@ if $@;
###############################################################################
can_ok($LIB, '_and');
my @data;
# Add data in data file.
(my $datafile = $0) =~ s/\.t/.dat/;
open DATAFILE, $datafile or die "$datafile: can't open file for reading: $!";
while (<DATAFILE>) {
s/\s+\z//;
next if /^#/ || ! /\S/;
push @data, [ split /:/ ];
}
# List context.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
my ($in0, $in1, $in2, $in3, $out0, $out1) = @{ $data[$i] };
my ($x, $y, @got);
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\$y = $LIB->_new("$in2"); |
. qq|\@got = $LIB->_sand(\$x, "$in1", \$y, "$in3");|;
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
cmp_ok(scalar @got, '==', 2,
"'$test' gives two output args");
# First output arg.
is(ref($got[0]), $REF,
"'$test' first output arg is a $REF");
is($LIB->_check($got[0]), 0,
"'$test' first output arg is valid");
is($LIB->_str($got[0]), $out0,
"'$test' first output arg has the right value");
isnt(refaddr($got[0]), refaddr($y),
"'$test' first output arg is not the third input arg");
is(ref($x), $REF,
"'$test' first input arg is still a $REF");
my $strx = $LIB->_str($x);
if ($strx eq $in0 || $strx eq $out0) {
pass("'$test' first input value is unmodified or equal" .
" to the output value");
} else {
fail("'$test' first input value is unmodified or equal" .
" to the output value");
diag(" got: '", $strx, "'");
if ($in0 eq $out0) {
diag(" expected: '$in0' (first input and output value)");
} else {
diag(" expected: '$in0' (first input value) or '$out0'",
" (first output value)");
}
}
# Second output arg.
is(ref($got[1]), "",
"'$test' second output arg is a scalar");
is($got[1], $out1,
"'$test' second output arg has the right value");
# Other tests.
is(ref($y), $REF,
"'$test' third input arg is still a $REF");
is($LIB->_str($y), $in2,
"'$test' third input arg is unmodified");
}
This diff is collapsed.
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print "1..0 # SKIP these tests are for testing by the author\n";
exit;
}
}
use strict;
use warnings;
use Test::More tests => 69001;
###############################################################################
# Read and load configuration file and backend library.
use Config::Tiny;
use Scalar::Util qw< refaddr >;
my $config_file = 't/author-lib.ini';
my $config = Config::Tiny -> read('t/author-lib.ini')
or die Config::Tiny -> errstr();
# Read the library to test.
our $LIB = $config->{_}->{lib};
die "No library defined in file '$config_file'"
unless defined $LIB;
die "Invalid library name '$LIB' in file '$config_file'"
unless $LIB =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Read the reference type(s) the library uses.
our $REF = $config->{_}->{ref};
die "No reference type defined in file '$config_file'"
unless defined $REF;
die "Invalid reference type '$REF' in file '$config_file'"
unless $REF =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Load the library.
eval "require $LIB";
die $@ if $@;
###############################################################################
can_ok($LIB, '_and');
my @data;
# Add data in data file.
(my $datafile = $0) =~ s/\.t/.dat/;
open DATAFILE, $datafile or die "$datafile: can't open file for reading: $!";
while (<DATAFILE>) {
s/\s+\z//;
next if /^#/ || ! /\S/;
push @data, [ split /:/ ];
}
# List context.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
my ($in0, $in1, $in2, $in3, $out0, $out1) = @{ $data[$i] };
my ($x, $y, @got);
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\$y = $LIB->_new("$in2"); |
. qq|\@got = $LIB->_sor(\$x, "$in1", \$y, "$in3");|;
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
cmp_ok(scalar @got, '==', 2,
"'$test' gives two output args");
# First output arg.
is(ref($got[0]), $REF,
"'$test' first output arg is a $REF");
is($LIB->_check($got[0]), 0,
"'$test' first output arg is valid");
is($LIB->_str($got[0]), $out0,
"'$test' first output arg has the right value");
isnt(refaddr($got[0]), refaddr($y),
"'$test' first output arg is not the third input arg");
is(ref($x), $REF,
"'$test' first input arg is still a $REF");
my $strx = $LIB->_str($x);
if ($strx eq $in0 || $strx eq $out0) {
pass("'$test' first input value is unmodified or equal" .
" to the output value");
} else {
fail("'$test' first input value is unmodified or equal" .
" to the output value");
diag(" got: '", $strx, "'");
if ($in0 eq $out0) {
diag(" expected: '$in0' (first input and output value)");
} else {
diag(" expected: '$in0' (first input value) or '$out0'",
" (first output value)");
}
}
# Second output arg.
is(ref($got[1]), "",
"'$test' second output arg is a scalar");
is($got[1], $out1,
"'$test' second output arg has the right value");
# Other tests.
is(ref($y), $REF,
"'$test' third input arg is still a $REF");
is($LIB->_str($y), $in2,
"'$test' third input arg is unmodified");
}
This diff is collapsed.
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print "1..0 # SKIP these tests are for testing by the author\n";
exit;
}
}
use strict;
use warnings;
use Test::More tests => 69001;
###############################################################################
# Read and load configuration file and backend library.
use Config::Tiny;
use Scalar::Util qw< refaddr >;
my $config_file = 't/author-lib.ini';
my $config = Config::Tiny -> read('t/author-lib.ini')
or die Config::Tiny -> errstr();
# Read the library to test.
our $LIB = $config->{_}->{lib};
die "No library defined in file '$config_file'"
unless defined $LIB;
die "Invalid library name '$LIB' in file '$config_file'"
unless $LIB =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Read the reference type(s) the library uses.
our $REF = $config->{_}->{ref};
die "No reference type defined in file '$config_file'"
unless defined $REF;
die "Invalid reference type '$REF' in file '$config_file'"
unless $REF =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Load the library.
eval "require $LIB";
die $@ if $@;
###############################################################################
can_ok($LIB, '_and');
my @data;
# Add data in data file.
(my $datafile = $0) =~ s/\.t/.dat/;
open DATAFILE, $datafile or die "$datafile: can't open file for reading: $!";
while (<DATAFILE>) {
s/\s+\z//;
next if /^#/ || ! /\S/;
push @data, [ split /:/ ];
}
# List context.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
my ($in0, $in1, $in2, $in3, $out0, $out1) = @{ $data[$i] };
my ($x, $y, @got);
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\$y = $LIB->_new("$in2"); |
. qq|\@got = $LIB->_sxor(\$x, "$in1", \$y, "$in3");|;
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
cmp_ok(scalar @got, '==', 2,
"'$test' gives two output args");
# First output arg.
is(ref($got[0]), $REF,
"'$test' first output arg is a $REF");
is($LIB->_check($got[0]), 0,
"'$test' first output arg is valid");
is($LIB->_str($got[0]), $out0,
"'$test' first output arg has the right value");
isnt(refaddr($got[0]), refaddr($y),
"'$test' first output arg is not the third input arg");
is(ref($x), $REF,
"'$test' first input arg is still a $REF");
my $strx = $LIB->_str($x);
if ($strx eq $in0 || $strx eq $out0) {
pass("'$test' first input value is unmodified or equal" .
" to the output value");
} else {
fail("'$test' first input value is unmodified or equal" .
" to the output value");
diag(" got: '", $strx, "'");
if ($in0 eq $out0) {
diag(" expected: '$in0' (first input and output value)");
} else {
diag(" expected: '$in0' (first input value) or '$out0'",
" (first output value)");
}
}
# Second output arg.
is(ref($got[1]), "",
"'$test' second output arg is a scalar");
is($got[1], $out1,
"'$test' second output arg has the right value");
# Other tests.
is(ref($y), $REF,
"'$test' third input arg is still a $REF");
is($LIB->_str($y), $in2,
"'$test' third input arg is unmodified");
}
# Base 2
11111010:2:250
11111010:2:01:250
# Base 8
372:8:250
372:8:01234567:250
# Base 10 (in the last case, use a truncted collation sequence that does not
# include unused characters)
250:10:250
250:10:0123456789:250
250:10:012345:250
# Base 16
fa:16:250
FA:16:250
fa:16:0123456789abcdef:250
# Base 3
100021:3:250
100021:3:012:250
/|-:3:-/|:15
# Base 4
3322:4:250
3322:4:0123:250
# Base 5
2000:5:250
2000:5:01234:250
caaa:5:abcde:250
# when base is less than or equal to 36, case is ignored
6Y:36:250
6y:36:250
6S:37:250
7H:37:276
121:3:16
XYZ:36:44027
Why:62:125734
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
use strict;
use warnings;
use Test::More tests => 23777;
###############################################################################
# Read and load configuration file and backend library.
use Config::Tiny ();
my $config_file = 't/author-lib.ini';
my $config = Config::Tiny -> read('t/author-lib.ini')
or die Config::Tiny -> errstr();
# Read the library to test.
our $LIB = $config->{_}->{lib};
die "No library defined in file '$config_file'"
unless defined $LIB;
die "Invalid library name '$LIB' in file '$config_file'"
unless $LIB =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Read the reference type(s) the library uses.
our $REF = $config->{_}->{ref};
die "No reference type defined in file '$config_file'"
unless defined $REF;
die "Invalid reference type '$REF' in file '$config_file'"
unless $REF =~ /^[A-Za-z]\w*(::\w+)*\z/;
# Load the library.
eval "require $LIB";
die $@ if $@;
###############################################################################
can_ok($LIB, '_from_base');
my @data;
# Small numbers and other simple tests.
for (my $x = 0; $x <= 255 ; ++ $x) {
push @data, [ sprintf("%b", $x), 2, $x ];
push @data, [ sprintf("%o", $x), 8, $x ];
push @data, [ sprintf("%d", $x), 10, $x ];
push @data, [ sprintf("%X", $x), 16, $x ];
}
my $collseq = '0123456789' . 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
. 'abcdefghijklmnopqrstuvwxyz';
for my $base (2 .. 62) {
# Zero should be converted to zero, regardless of base and collation
# sequence.
push @data, [ "0", $base, "0" ];
push @data, [ "0", $base, $collseq, "0" ];
# Increasing integer powers of the base, with a collation sequence of
# "01..." should give "1", "10", "100", "1000", ...