summaryrefslogtreecommitdiff
path: root/dist/bignum/t/infnan.inc
diff options
context:
space:
mode:
authorFlorian Ragwitz <rafl@debian.org>2010-09-03 01:12:17 +0200
committerFlorian Ragwitz <rafl@debian.org>2010-09-03 01:20:47 +0200
commitc064d6c6600a09556bae5adafca518fb4e6da98a (patch)
treeffc648099a8cc0483c27e9592b37655008e4c6cd /dist/bignum/t/infnan.inc
parent9dc8ab6efae84d4eaf80f7e1c91f2d2d89ba516b (diff)
downloadperl-c064d6c6600a09556bae5adafca518fb4e6da98a.tar.gz
blead is upstream for bignum
Diffstat (limited to 'dist/bignum/t/infnan.inc')
-rw-r--r--dist/bignum/t/infnan.inc35
1 files changed, 35 insertions, 0 deletions
diff --git a/dist/bignum/t/infnan.inc b/dist/bignum/t/infnan.inc
new file mode 100644
index 0000000000..771b94e748
--- /dev/null
+++ b/dist/bignum/t/infnan.inc
@@ -0,0 +1,35 @@
+
+use strict;
+
+my ($x);
+
+###############################################################################
+# inf tests
+
+$x = 1+inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf');
+$x = 1*inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf');
+
+# these don't work without exporting inf()
+$x = inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf');
+$x = inf+inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf');
+$x = inf*inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'inf');
+
+###############################################################################
+# NaN tests
+
+$x = 1+NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+$x = 1*NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+
+# these don't work without exporting NaN()
+$x = NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+$x = NaN+NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+$x = NaN*NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+
+###############################################################################
+# mixed tests
+
+# these don't work without exporting NaN() or inf()
+$x = NaN+inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+$x = NaN*inf; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+$x = inf*NaN; ok (ref($x) =~ /^Math::BigInt/); ok ($x->bstr(),'NaN');
+