summaryrefslogtreecommitdiff
path: root/t/op/infnan.t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-08-31 12:04:46 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-08-31 12:14:25 -0400
commitd1877901c76d255ce8d75b4caeca181154b9dc50 (patch)
treeed3f233658db30735a7faa1dd65f34a245c93db1 /t/op/infnan.t
parent0fa5dd23a49906857fa01fff069436c5e15e6501 (diff)
downloadperl-d1877901c76d255ce8d75b4caeca181154b9dc50.tar.gz
Couple more infnan tests.
Diffstat (limited to 't/op/infnan.t')
-rw-r--r--t/op/infnan.t9
1 files changed, 7 insertions, 2 deletions
diff --git a/t/op/infnan.t b/t/op/infnan.t
index c147787850..3a8be8efb2 100644
--- a/t/op/infnan.t
+++ b/t/op/infnan.t
@@ -24,8 +24,8 @@ my @NaN = ("NAN", "nan", "qnan", "SNAN", "NanQ", "NANS",
my @num_fmt = qw(e f g a d u o b x p);
-my $inf_tests = 11 + @num_fmt + 8 + 3 * @PInf + 3 * @NInf + 5 + 3;
-my $nan_tests = 7 + @num_fmt + 4 + 2 * @NaN + 3;
+my $inf_tests = 13 + @num_fmt + 8 + 3 * @PInf + 3 * @NInf + 5 + 3;
+my $nan_tests = 8 + @num_fmt + 4 + 2 * @NaN + 3;
my $infnan_tests = 4;
@@ -54,6 +54,9 @@ SKIP: {
cmp_ok($PInf * 2, '==', $PInf, "twice Inf is Inf");
cmp_ok($PInf / 2, '==', $PInf, "half of Inf is Inf");
+ cmp_ok($PInf + 1, '==', $PInf, "Inf + one is Inf");
+ cmp_ok($NInf + 1, '==', $NInf, "-Inf + one is -Inf");
+
is(sprintf("%g", $PInf), "Inf", "$PInf sprintf %g is Inf");
is(sprintf("%a", $PInf), "Inf", "$PInf sprintf %a is Inf");
@@ -124,6 +127,8 @@ SKIP: {
is($NaN * 2, $NaN, "twice NaN is NaN");
is($NaN / 2, $NaN, "half of NaN is NaN");
+ is($NaN + 1, $NaN, "NaN + one is NaN");
+
for my $f (@num_fmt) {
is(sprintf("%$f", $NaN), "NaN", "$NaN sprintf %$f is NaN");
}