diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-11-11 21:07:18 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-11-11 21:07:18 +0000 |
commit | e745a66c2cdc9fa9305c81afdec93bddfb34aefd (patch) | |
tree | b16f73f8703a77c07a362f601ae72305e36746b1 /lib/Math/BigInt/t | |
parent | 86bbd6d19263a37b14c756874adb474fcee1ad0e (diff) | |
download | perl-e745a66c2cdc9fa9305c81afdec93bddfb34aefd.tar.gz |
Upgrade to Math::BigInt 1.46.
p4raw-id: //depot/perl@12945
Diffstat (limited to 'lib/Math/BigInt/t')
-rw-r--r-- | lib/Math/BigInt/t/bigfltpm.inc | 12 | ||||
-rwxr-xr-x | lib/Math/BigInt/t/bigfltpm.t | 30 | ||||
-rw-r--r-- | lib/Math/BigInt/t/bigintc.t | 14 | ||||
-rw-r--r-- | lib/Math/BigInt/t/calling.t | 26 | ||||
-rw-r--r-- | lib/Math/BigInt/t/mbimbf.t | 4 | ||||
-rwxr-xr-x | lib/Math/BigInt/t/sub_mbf.t | 46 | ||||
-rwxr-xr-x | lib/Math/BigInt/t/sub_mbi.t | 44 |
7 files changed, 99 insertions, 77 deletions
diff --git a/lib/Math/BigInt/t/bigfltpm.inc b/lib/Math/BigInt/t/bigfltpm.inc index c11a8d98c8..c4e21820e0 100644 --- a/lib/Math/BigInt/t/bigfltpm.inc +++ b/lib/Math/BigInt/t/bigfltpm.inc @@ -110,6 +110,7 @@ while (<DATA>) $try .= '$x % $y;'; } else { warn "Unknown op '$f'"; } } + # print "# Trying: '$try'\n"; $ans1 = eval $try; if ($ans =~ m|^/(.*)$|) { @@ -664,6 +665,12 @@ fdecNaN:NaN -1:-2 1.23:0.23 -1.23:-2.23 +100:99 +101:100 +-100:-101 +-99:-100 +-98:-99 +99:98 &finc fincNaN:NaN +inf:inf @@ -673,6 +680,11 @@ fincNaN:NaN -1:0 1.23:2.23 -1.23:-0.23 +100:101 +-100:-99 +-99:-98 +-101:-100 +99:100 &fadd abc:abc:NaN abc:+0:NaN diff --git a/lib/Math/BigInt/t/bigfltpm.t b/lib/Math/BigInt/t/bigfltpm.t index 6aa718131c..8d08d43d00 100755 --- a/lib/Math/BigInt/t/bigfltpm.t +++ b/lib/Math/BigInt/t/bigfltpm.t @@ -1,34 +1,16 @@ #!/usr/bin/perl -w -BEGIN { - $| = 1; - my $location = $0; - # to locate the testing files - $location =~ s/bigfltpm.t//i; - if ($ENV{PERL_CORE}) { - # testing with the core distribution - @INC = qw(../lib); - if (-d 't') { - chdir 't'; - require File::Spec; - unshift @INC, File::Spec->catdir(File::Spec->updir, $location); - } else { - unshift @INC, $location; - } - } else { - # for running manually with the CPAN distribution - unshift @INC, '../lib'; - $location =~ s/bigfltpm.t//; - } - print "# INC = @INC\n"; -} - use Test; use strict; BEGIN { - plan tests => 1277; + $| = 1; + unshift @INC, '../lib'; # for running manually + my $location = $0; $location =~ s/bigfltpm.t//; + unshift @INC, $location; # to locate the testing files + # chdir 't' if -d 't'; + plan tests => 1299; } use Math::BigInt; diff --git a/lib/Math/BigInt/t/bigintc.t b/lib/Math/BigInt/t/bigintc.t index 1f36cf7f7c..adac2d35c9 100644 --- a/lib/Math/BigInt/t/bigintc.t +++ b/lib/Math/BigInt/t/bigintc.t @@ -8,7 +8,7 @@ BEGIN $| = 1; # chdir 't' if -d 't'; unshift @INC, '../lib'; # for running manually - plan tests => 52; + plan tests => 56; } # testing of Math::BigInt::BitVect, primarily for interface/api and not for the @@ -114,6 +114,18 @@ $x = $C->_new(\"123"); $y = $C->_new(\"1111"); # _num $x = $C->_new(\"12345"); $x = $C->_num($x); ok (ref($x)||'',''); ok ($x,12345); +# _inc +$x = $C->_new(\"1000"); $C->_inc($x); ok (${$C->_str($x)},'1001'); +$C->_dec($x); ok (${$C->_str($x)},'1000'); + +my $BL = Math::BigInt::Calc::_base_len(); +$x = '1' . '0' x $BL; +$z = '1' . '0' x ($BL-1); $z .= '1'; +$x = $C->_new(\$x); $C->_inc($x); ok (${$C->_str($x)},$z); + +$x = '1' . '0' x $BL; $z = '9' x $BL; +$x = $C->_new(\$x); $C->_dec($x); ok (${$C->_str($x)},$z); + # should not happen: # $x = $C->_new(\"-2"); $y = $C->_new(\"4"); ok ($C->_acmp($x,$y),-1); diff --git a/lib/Math/BigInt/t/calling.t b/lib/Math/BigInt/t/calling.t index be1dc46a97..800b8798b5 100644 --- a/lib/Math/BigInt/t/calling.t +++ b/lib/Math/BigInt/t/calling.t @@ -8,8 +8,28 @@ use Test; BEGIN { $| = 1; - # chdir 't' if -d 't'; - unshift @INC, '../lib'; # for running manually + # to locate the testing files + my $location = $0; $location =~ s/calling.t//i; + if ($ENV{PERL_CORE}) + { + # testing with the core distribution + @INC = qw(../lib); + } + else + { + unshift @INC, '../lib'; + } + if (-d 't') + { + chdir 't'; + require File::Spec; + unshift @INC, File::Spec->catdir(File::Spec->updir, $location); + } + else + { + unshift @INC, $location; + } + print "# INC = @INC\n"; plan tests => 141; } @@ -33,7 +53,7 @@ use Math::BigInt; use Math::BigFloat; my ($x,$y,$z,$u); -my $version = '1.45'; # adjust manually to match latest release +my $version = '1.46'; # adjust manually to match latest release ############################################################################### # check whether op's accept normal strings, even when inherited by subclasses diff --git a/lib/Math/BigInt/t/mbimbf.t b/lib/Math/BigInt/t/mbimbf.t index c92eaa4618..ec20e65e11 100644 --- a/lib/Math/BigInt/t/mbimbf.t +++ b/lib/Math/BigInt/t/mbimbf.t @@ -440,8 +440,8 @@ $x = Math::BigInt->new(12345); $x->{_a} = 5; $x->bround(6); # must be no-op ok ($x,'12345'); -$x = Math::BigFloat->new(0.0061); $x->bfround(-2); -ok ($x,0.01); +$x = Math::BigFloat->new('0.0061'); $x->bfround(-2); +ok ($x,'0.01'); ############################################################################### # rounding with already set precision/accuracy diff --git a/lib/Math/BigInt/t/sub_mbf.t b/lib/Math/BigInt/t/sub_mbf.t index 0695ef2269..42d541add9 100755 --- a/lib/Math/BigInt/t/sub_mbf.t +++ b/lib/Math/BigInt/t/sub_mbf.t @@ -1,34 +1,32 @@ #!/usr/bin/perl -w -BEGIN { - $| = 1; - my $location = $0; - # to locate the testing files - $location =~ s/sub_mbf.t//i; - if ($ENV{PERL_CORE}) { - # testing with the core distribution - @INC = qw(../lib); - if (-d 't') { - chdir 't'; - require File::Spec; - unshift @INC, File::Spec->catdir(File::Spec->updir, $location); - } else { - unshift @INC, $location; - } - } else { - # for running manually with the CPAN distribution - unshift @INC, '../lib'; - $location =~ s/bigfltpm.t//; - } - print "# INC = @INC\n"; -} - use Test; use strict; BEGIN { - plan tests => 1277 + 4; # + 4 own tests + $| = 1; + # to locate the testing files + my $location = $0; $location =~ s/sub_mbf.t//i; + if ($ENV{PERL_CORE}) + { + # testing with the core distribution + @INC = qw(../lib); + } + unshift @INC, '../lib'; + if (-d 't') + { + chdir 't'; + require File::Spec; + unshift @INC, File::Spec->catdir(File::Spec->updir, $location); + } + else + { + unshift @INC, $location; + } + print "# INC = @INC\n"; + + plan tests => 1299 + 4; # + 4 own tests } use Math::BigFloat::Subclass; diff --git a/lib/Math/BigInt/t/sub_mbi.t b/lib/Math/BigInt/t/sub_mbi.t index 20b8b8d1a3..ddbedc8907 100755 --- a/lib/Math/BigInt/t/sub_mbi.t +++ b/lib/Math/BigInt/t/sub_mbi.t @@ -1,33 +1,31 @@ #!/usr/bin/perl -w -BEGIN { - $| = 1; - my $location = $0; - # to locate the testing files - $location =~ s/sub_mbi.t//i; - if ($ENV{PERL_CORE}) { - # testing with the core distribution - @INC = qw(../lib); - if (-d 't') { - chdir 't'; - require File::Spec; - unshift @INC, File::Spec->catdir(File::Spec->updir, $location); - } else { - unshift @INC, $location; - } - } else { - # for running manually with the CPAN distribution - unshift @INC, '../lib'; - $location =~ s/bigfltpm.t//; - } - print "# INC = @INC\n"; -} - use Test; use strict; BEGIN { + $| = 1; + $| = 1; + # to locate the testing files + my $location = $0; $location =~ s/sub_mbi.t//i; + if ($ENV{PERL_CORE}) + { + # testing with the core distribution + @INC = qw(../lib); + } + if (-d 't') + { + chdir 't'; + require File::Spec; + unshift @INC, File::Spec->catdir(File::Spec->updir, $location); + } + else + { + unshift @INC, $location; + } + print "# INC = @INC\n"; + plan tests => 1608 + 4; # +4 own tests } |