Commit d7bc4027 authored by Angel Abad's avatar Angel Abad

Merge tag 'upstream/1.999807'

Upstream version 1.999807

# gpg: Firmado el sáb 24 dic 2016 10:08:34 CET
# gpg:                usando RSA clave 4A0897191621CCF7FBEEF752A6D58816010A1096
# gpg:                issuer "angelabad@gmail.com"
# gpg: Firma correcta de "Angel Abad <angelabad@gmail.com>" [desconocido]
# gpg:                 alias "Angel Abad <angel@debian.org>" [desconocido]
# gpg:                 alias "Angel Abad <angelabad@ubuntu.com>" [desconocido]
# gpg: ATENCIÓN: ¡Esta clave no está certificada por una firma de confianza!
# gpg:           No hay indicios de que la firma pertenezca al propietario.
# Huellas dactilares de la clave primaria: 4A08 9719 1621 CCF7 FBEE  F752 A6D5 8816 010A 1096
parents e759b0ea d799d7e7
2016-12-23 v1.999807 pjacklam
* Add a message to Makefile.PL recommending upgrade if old libraries are
installed. This message is more or less equivalent to the one appearing in
Math-BigInt up until v1.997.
* Improve the documentation (POD) in Math::BigInt::Lib.
* Speed up _sqrt() and _root() in Math::BigInt::Lib.
* Remove checking for exception cases (cases that would return +Inf, -Inf, or
NaN) in Math::BigInt::Lib. It has been documented for a long time that such
checking should be done by the caller.
* Add library methods _to_bin(), _to_oct(), _to_hex(), which are equivalent to
the _as_bin(), _as_oct(), and _as_hex() methods respectively, except that
the _to_*() methods don't use a prefix in the output. This removes the need
for the frequent removal of the various prefixes. Now each _as_*() method
calls the equivalent _to_*() method, adds a prefix, and returns the output.
The _to_*() methods are faster than the equivalent _as_*() methods were.
* Add author test files for the methods _to_bin(), _to_oct(), and _to_hex().
* Add library method _to_bytes(). The method _as_bytes() would have been
called _to_bytes() if I had thought of it earlier. The method _as_bytes() is
now just an alias to _to_bytes(). The _to_bytes() method also fixes a bug
that was present in the _as_bytes() method. (CPAN RT #119346).
* Add author test files for the method _to_bytes().
* Add more tests for library methods _inc() and _dec(). When trying to bring
the Math::BigInt::BitVect library back to life I realized that the test
suite didn't catch certain errors in _inc() and _dec().
* Die if trying to use as_bytes() or from_bytes() with a backend library that
doesn't support the corresponding library methods.
* Correct minor errors in the output messages in the test files.
* Improve/correct various comments in the source code.
* More diagnostic output is displayed by the author test files if the
AUTHOR_DEBUGGING environment variable is set.
2016-12-13 v1.999806 pjacklam
* Add more logic to Makefile.PL regarding INSTALLDIRS (CPAN RT #119199
......
......@@ -60,9 +60,11 @@ t/author-lib-arithmetic-ternary-_modpow.dat
t/author-lib-arithmetic-ternary-_modpow.t
t/author-lib-arithmetic-ternary-_rsft.dat
t/author-lib-arithmetic-ternary-_rsft.t
t/author-lib-arithmetic-unary-_dec.dat
t/author-lib-arithmetic-unary-_dec.t
t/author-lib-arithmetic-unary-_fac.dat
t/author-lib-arithmetic-unary-_fac.t
t/author-lib-arithmetic-unary-_inc.dat
t/author-lib-arithmetic-unary-_inc.t
t/author-lib-arithmetic-unary-_sqrt.dat
t/author-lib-arithmetic-unary-_sqrt.t
......@@ -103,6 +105,14 @@ 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_bin.dat
t/author-lib-convert-string-_to_bin.t
t/author-lib-convert-string-_to_bytes.dat
t/author-lib-convert-string-_to_bytes.t
t/author-lib-convert-string-_to_hex.dat
t/author-lib-convert-string-_to_hex.t
t/author-lib-convert-string-_to_oct.dat
t/author-lib-convert-string-_to_oct.t
t/author-lib-misc-_check.t
t/author-lib-misc-api_version.t
t/author-lib-property-_alen.t
......
......@@ -39,6 +39,6 @@
}
},
"release_status" : "stable",
"version" : "1.999806",
"version" : "1.999807",
"x_serialization_backend" : "JSON::PP version 2.27400"
}
......@@ -21,5 +21,5 @@ requires:
Math::Complex: '1.39'
Test::More: '0.94'
perl: '5.006001'
version: '1.999806'
version: '1.999807'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
......@@ -4,6 +4,53 @@ use strict;
use warnings;
use ExtUtils::MakeMaker;
# This is a list of known backend libraries and the version number when these
# libraries became subclasses of Math::BigInt::Lib. New library methods are
# added to Math::BigInt::Lib first. Later, optimized versions are implemented
# for the specific libraries. In the meantime, these new methods won't be
# available to libraries that aren't a subclass of Math::BigInt::Lib.
my $recommend_versions =
{
'Math::BigInt::Calc' => '1.999800',
'Math::BigInt::FastCalc' => '0.5000',
'Math::BigInt::GMP' => '1.6000',
'Math::BigInt::Pari' => '1.3000',
'Math::BigInt::BitVect' => '1.13',
#'Math::BigInt::GMPz' => '0.001',
};
my $recommend_update = [];
while (my ($module, $recommend_version) = each %$recommend_versions) {
next unless eval "require $module";
my $version = $module -> VERSION();
next if $version >= $recommend_version;
push @$recommend_update, [ $module, $recommend_version, $version ];
}
if (@$recommend_update) {
print <<"EOF";
##########################################################################
#
# Certain methods will not work unless the following installed modules are
# updated. It is recommended that after installing this distribution, you
# update these modules to at least the recommended version listed below.
#
# Module Recommended Installed
# ------ ----------- ---------
EOF
for my $entry (@$recommend_update) {
printf "# %-30s %-14s %s\n", @$entry;
}
print <<"EOF";
#
##########################################################################
Sleeping for a few seconds ...
EOF
sleep 5;
}
my %WriteMakefileArgs =
(
'NAME' => 'Math::BigInt',
......
This diff is collapsed.
......@@ -19,7 +19,7 @@ use warnings;
use Carp ();
use Math::BigInt ();
our $VERSION = '1.999806';
our $VERSION = '1.999807';
require Exporter;
our @ISA = qw/Math::BigInt/;
......
......@@ -20,7 +20,7 @@ use warnings;
use Carp ();
our $VERSION = '1.999806';
our $VERSION = '1.999807';
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(objectify bgcd blcm);
......@@ -884,6 +884,9 @@ sub from_bytes {
return if $selfref && $self->modify('from_bytes');
Carp::croak("from_bytes() requires a newer version of the $CALC library.")
unless $CALC->can('_from_bytes');
my $str = shift;
# If called as a class method, initialize a new object.
......@@ -3527,6 +3530,10 @@ sub as_bytes {
Carp::croak("as_bytes() requires a finite, non-negative integer")
if $x -> is_neg() || ! $x -> is_int();
Carp::croak("as_bytes() requires a newer version of the $CALC library.")
unless $CALC->can('_as_bytes');
return $CALC->_as_bytes($x->{value});
}
......
......@@ -7,7 +7,7 @@ use warnings;
use Carp;
use Math::BigInt::Lib;
our $VERSION = '1.999806';
our $VERSION = '1.999807';
our @ISA = ('Math::BigInt::Lib');
......@@ -1889,7 +1889,7 @@ sub _sqrt {
}
sub _root {
# Take n'th root of $x in place (n >= 2)
# Take n'th root of $x in place.
my ($c, $x, $n) = @_;
......@@ -1915,8 +1915,8 @@ sub _root {
return $x;
}
# If $n is a power of two, we take sqrt($x) repeatedly and find the proper
# result, because, e.g., sqrt(sqrt($x)) == root($x, 4)
# If $n is a power of two, take sqrt($x) repeatedly, e.g., root($x, 4) =
# sqrt(sqrt($x)), root($x, 8) = sqrt(sqrt(sqrt($x))).
my $b = $c -> _as_bin($n);
if ($b =~ /0b1(0+)$/) {
......
......@@ -4,7 +4,7 @@ use 5.006001;
use strict;
use warnings;
our $VERSION = '1.999806';
our $VERSION = '1.999807';
package Math::BigInt;
......
This diff is collapsed.
......@@ -117,6 +117,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_add(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -164,6 +166,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_add(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -87,6 +87,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_div(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -151,6 +153,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_div(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -79,6 +79,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_gcd(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -131,6 +133,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_gcd(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -79,6 +79,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_lcm(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -131,6 +133,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_lcm(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -86,7 +86,7 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_log_int(\$x, \$y);|;
note "\n$test\n\n";
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -87,6 +87,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_mod(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -134,6 +136,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_mod(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -79,6 +79,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$m = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_modinv(\$x, \$m);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -115,6 +115,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_mul(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -162,6 +164,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_mul(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -79,6 +79,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_nok(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -126,6 +128,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_nok(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -11,7 +11,7 @@ BEGIN {
use strict;
use warnings;
use Test::More tests => 1405;
use Test::More tests => 1357;
###############################################################################
# Read and load configuration file and backend library.
......@@ -74,7 +74,7 @@ for (my $p = 0; $p <= 10 ; ++ $p) {
my $x = "1" . ("0" x $p);
my $y = "1" . ("0" x $q);
my $zn = $p * $y;
next if $zn > 1e5;
next if $zn >= 1e4;
my $z = "1" . ("0" x $zn);
push @data, [ $x, $y, $z ];
}
......@@ -91,6 +91,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_pow(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -138,6 +140,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_pow(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -79,7 +79,7 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_root(\$x, \$y);|;
note "\n$test\n\n";
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -128,6 +128,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_root(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -11,7 +11,7 @@ BEGIN {
use strict;
use warnings;
use Test::More tests => 3605;
use Test::More tests => 7209;
###############################################################################
# Read and load configuration file and backend library.
......@@ -76,7 +76,7 @@ while (<DATAFILE>) {
}
close DATAFILE or die "$datafile: can't close file after reading: $!";
# List context.
# List context without swap flag.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
my ($in0, $in1, $out0) = @{ $data[$i] };
......@@ -87,6 +87,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_sub(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -123,7 +125,7 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
};
}
# Scalar context.
# Scalar context without swap flag.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
my ($in0, $in1, $out0) = @{ $data[$i] };
......@@ -134,6 +136,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_sub(\$x, \$y);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -166,3 +170,94 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
"'$test' second input arg is unmodified");
};
}
# List context with swap flag.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
my ($in0, $in1, $out0) = @{ $data[$i] };
my ($x, $y, @got);
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_sub(\$x, \$y, 1);|;
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
subtest "_sub() in list context: $test", sub {
plan tests => $scalar_util_ok ? 9 : 8;
cmp_ok(scalar @got, '==', 1,
"'$test' gives one output arg");
is(ref($got[0]), $REF,
"'$test' output arg is a $REF");
is($LIB->_check($got[0]), 0,
"'$test' output is valid");
is($LIB->_str($got[0]), $out0,
"'$test' output arg has the right value");
isnt(refaddr($got[0]), refaddr($x),
"'$test' output arg is not the first input arg")
if $scalar_util_ok;
is(ref($x), $REF,
"'$test' first input arg is still a $REF");
is($LIB->_str($x), $in0,
"'$test' first input arg is unmodified");
is(ref($y), $REF,
"'$test' second input arg is still a $REF");
ok($LIB->_str($y) eq $out0 || $LIB->_str($y) eq $in1,
"'$test' second input arg has the correct value");
};
}
# Scalar context with swap flag.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
my ($in0, $in1, $out0) = @{ $data[$i] };
my ($x, $y, $got);
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_sub(\$x, \$y, 1);|;
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
subtest "_sub() in scalar context: $test", sub {
plan tests => $scalar_util_ok ? 8 : 7;
is(ref($got), $REF,
"'$test' output arg is a $REF");
is($LIB->_check($got), 0,
"'$test' output is valid");
is($LIB->_str($got), $out0,
"'$test' output arg has the right value");
isnt(refaddr($got), refaddr($x),
"'$test' output arg is not the first input arg")
if $scalar_util_ok;
is(ref($x), $REF,
"'$test' first input arg is still a $REF");
is($LIB->_str($x), $in0,
"'$test' first input arg is unmodified");
is(ref($y), $REF,
"'$test' second input arg is still a $REF");
ok($LIB->_str($y) eq $out0 || $LIB->_str($y) eq $in1,
"'$test' second input arg has the correct value");
};
}
......@@ -91,6 +91,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_lsft(\$x, \$y, $in2);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -135,6 +137,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_lsft(\$x, \$y, $in2);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -160,7 +164,7 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
is(ref($y), $REF,
"'$test' second input arg is still a $REF");
is($LIB->_str($x), $out0,
"'$test' output arg has the correct value");
is($LIB->_str($y), $in1,
"'$test' second input arg is unmodified");
};
}
......@@ -80,6 +80,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$m = $LIB->_new("$in2"); |
. qq|\@got = $LIB->_modpow(\$x, \$y, \$m);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -138,6 +140,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$m = $LIB->_new("$in2"); |
. qq|\$got = $LIB->_modpow(\$x, \$y, \$m);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -90,6 +90,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\@got = $LIB->_rsft(\$x, \$y, $in2);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -134,6 +136,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
. qq|\$y = $LIB->_new("$in1"); |
. qq|\$got = $LIB->_rsft(\$x, \$y, $in2);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -159,7 +163,7 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
is(ref($y), $REF,
"'$test' second input arg is still a $REF");
is($LIB->_str($x), $out0,
"'$test' output arg has the correct value");
is($LIB->_str($y), $in1,
"'$test' second input arg is unmodified");
};
}
This diff is collapsed.
......@@ -11,7 +11,7 @@ BEGIN {
use strict;
use warnings;
use Test::More tests => 2601;
use Test::More tests => 5469;
###############################################################################
# Read and load configuration file and backend library.
......@@ -53,7 +53,7 @@ my @data;
# Small numbers.
for (my $x = 1; $x <= 500 ; ++ $x) {
for (my $x = 1; $x <= 512 ; ++ $x) {
push @data, [ $x, $x - 1 ];
}
......@@ -81,6 +81,17 @@ for (my $p = 1; $p <= 50 ; ++ $p) {
push @data, [ $x, $y ];
}
# 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 /:/ ];
}
close DATAFILE or die "$datafile: can't close file after reading: $!";
# List context.
for (my $i = 0 ; $i <= $#data ; ++ $i) {
......@@ -91,6 +102,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\@got = $LIB->_dec(\$x);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -127,6 +140,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\$got = $LIB->_dec(\$x);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
......@@ -72,6 +72,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\@got = $LIB->_fac(\$x);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......@@ -108,6 +110,8 @@ for (my $i = 0 ; $i <= $#data ; ++ $i) {
my $test = qq|\$x = $LIB->_new("$in0"); |
. qq|\$got = $LIB->_fac(\$x);|;
diag("\n$test\n\n") if $ENV{AUTHOR_DEBUGGING};
eval $test;
is($@, "", "'$test' gives emtpy \$\@");
......
This diff is collapsed.
......@@ -11,7 +11,7 @@ BEGIN {
use strict;
use warnings;
use Test::More tests => 2605;
use Test::More tests => 5473;