summaryrefslogtreecommitdiff
path: root/lib/bignum
diff options
context:
space:
mode:
authorTels <nospam-abuse@bloodgate.com>2005-01-01 19:59:51 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-01-04 08:36:50 +0000
commitb68b7ab1e328997a801e104fc190aa117fc75775 (patch)
tree40601ec203bce143a7c0b70593e8f236f7972227 /lib/bignum
parent755db5d606be076ff7c6dcb6af89e15fb080c85e (diff)
downloadperl-b68b7ab1e328997a801e104fc190aa117fc75775.tar.gz
Math::BigInt v1.74, Math::BigRat v0.14, bignum v0.16
Message-Id: <200501011859.52858@bloodgate.com> p4raw-id: //depot/perl@23739
Diffstat (limited to 'lib/bignum')
-rwxr-xr-xlib/bignum/t/option_a.t16
-rwxr-xr-xlib/bignum/t/option_l.t12
-rwxr-xr-xlib/bignum/t/option_p.t21
-rw-r--r--lib/bignum/t/ratopt_a.t34
4 files changed, 65 insertions, 18 deletions
diff --git a/lib/bignum/t/option_a.t b/lib/bignum/t/option_a.t
index 2ab00bb074..2086f9a8d8 100755
--- a/lib/bignum/t/option_a.t
+++ b/lib/bignum/t/option_a.t
@@ -2,7 +2,7 @@
###############################################################################
-use Test;
+use Test::More;
use strict;
BEGIN
@@ -15,11 +15,17 @@ BEGIN
use bignum a => '12';
-ok (Math::BigInt->accuracy(),12);
-ok (Math::BigFloat->accuracy(),12);
+my @C = qw/Math::BigInt Math::BigFloat/;
+
+foreach my $c (@C)
+ {
+ is ($c->accuracy(),12, "$c accuracy = 12");
+ }
bignum->import( accuracy => '23');
-ok (Math::BigInt->accuracy(),23);
-ok (Math::BigFloat->accuracy(),23);
+foreach my $c (@C)
+ {
+ is ($c->accuracy(), 23, "$c accuracy = 23");
+ }
diff --git a/lib/bignum/t/option_l.t b/lib/bignum/t/option_l.t
index 134dd7cd8e..f5341830c9 100755
--- a/lib/bignum/t/option_l.t
+++ b/lib/bignum/t/option_l.t
@@ -1,8 +1,6 @@
#!/usr/bin/perl -w
-###############################################################################
-
-use Test;
+use Test::More;
use strict;
BEGIN
@@ -16,18 +14,18 @@ BEGIN
use bignum;
my $rc = eval ('bignum->import( "l" => "foo" );');
-ok ($@,''); # shouldn't die
+is ($@,''); # shouldn't die
$rc = eval ('bignum->import( "lib" => "foo" );');
-ok ($@,''); # ditto
+is ($@,''); # ditto
$rc = eval ('bignum->import( "foo" => "bar" );');
-ok ($@ =~ /^Unknown option foo/i,1); # should die
+like ($@, qr/^Unknown option foo/i, 'died'); # should die
# test that options are only lowercase (don't see a reason why allow UPPER)
foreach (qw/L LIB Lib T Trace TRACE V Version VERSION/)
{
$rc = eval ('bignum->import( "$_" => "bar" );');
- ok ($@ =~ /^Unknown option $_/i,1); # should die
+ like ($@, qr/^Unknown option $_/i, 'died'); # should die
}
diff --git a/lib/bignum/t/option_p.t b/lib/bignum/t/option_p.t
index c6df4ad1f4..b84883be4b 100755
--- a/lib/bignum/t/option_p.t
+++ b/lib/bignum/t/option_p.t
@@ -1,8 +1,6 @@
#!/usr/bin/perl -w
-###############################################################################
-
-use Test;
+use Test::More;
use strict;
BEGIN
@@ -10,11 +8,22 @@ BEGIN
$| = 1;
chdir 't' if -d 't';
unshift @INC, '../lib';
- plan tests => 2;
+ plan tests => 4;
}
+my @C = qw/Math::BigInt Math::BigFloat/;
+
use bignum p => '12';
-ok (Math::BigInt->precision(),12);
-ok (Math::BigFloat->precision(),12);
+foreach my $c (@C)
+ {
+ is ($c->precision(),12, "$c precision = 12");
+ }
+
+bignum->import( p => '42' );
+
+foreach my $c (@C)
+ {
+ is ($c->precision(),42, "$c precision = 42");
+ }
diff --git a/lib/bignum/t/ratopt_a.t b/lib/bignum/t/ratopt_a.t
new file mode 100644
index 0000000000..f004afe428
--- /dev/null
+++ b/lib/bignum/t/ratopt_a.t
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+
+###############################################################################
+
+use Test::More;
+use strict;
+
+BEGIN
+ {
+ $| = 1;
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+ plan tests => 7;
+ }
+
+my @C = qw/Math::BigInt Math::BigFloat Math::BigRat/;
+
+# bigrat (bug until v0.15)
+use bigrat a => 2;
+
+foreach my $c (@C)
+ {
+ is ($c->accuracy(), 2, "$c accuracy = 2");
+ }
+
+eval { bigrat->import( accuracy => '42') };
+
+is ($@, '', 'no error');
+
+foreach my $c (@C)
+ {
+ is ($c->accuracy(), 42, "$c accuracy = 42");
+ }
+