summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-03-17 16:02:40 +1100
committerJames E Keenan <jkeenan@cpan.org>2021-03-19 18:51:13 -0400
commit8a526a6ca63b03a8d4ae6de591d114f61b91726b (patch)
tree40c453db472b54d1824664240b67bb53d7aad092
parent89851ae5dcc65966e23aff9cd2b1abcb4a59953e (diff)
downloadperl-8a526a6ca63b03a8d4ae6de591d114f61b91726b.tar.gz
switch to using the test.pl test functions for op/arith2.t
... instead of roll-our-own
-rw-r--r--t/op/arith2.t55
1 files changed, 25 insertions, 30 deletions
diff --git a/t/op/arith2.t b/t/op/arith2.t
index 7b413e7278..517d565161 100644
--- a/t/op/arith2.t
+++ b/t/op/arith2.t
@@ -11,29 +11,26 @@ BEGIN {
}
use Config;
+use strict;
-sub try ($$$) {
- print +($_[1] ? "ok" : "not ok") . " $_[0] - $_[2]\n";
-}
-
-my $T = 1;
-print "1..9\n";
+plan tests => 9;
my $vms_no_ieee;
if ($^O eq 'VMS') {
$vms_no_ieee = 1 unless defined($Config{useieee});
}
-if ($^O eq 'vos') {
- print "not ok ", $T++, " # TODO VOS raises SIGFPE instead of producing infinity.\n";
-}
-elsif ($vms_no_ieee || !$Config{d_double_has_inf}) {
- print "ok ", $T++, " # SKIP -- the IEEE infinity model is unavailable in this configuration.\n"
-}
-elsif ($^O eq 'ultrix') {
- print "not ok ", $T++, " # TODO Ultrix enters deep nirvana instead of producing infinity.\n";
-}
-else {
+SKIP:
+{
+ if ($^O eq 'vos') {
+ skip "VOS raises SIGFPE instead of producing infinity", 1;
+ }
+ elsif ($vms_no_ieee || !$Config{d_double_has_inf}) {
+ skip "the IEEE infinity model is unavailable in this configuration", 1;
+ }
+ elsif ($^O eq 'ultrix') {
+ skip "Ultrix enters deep nirvana instead of producing infinity.", 1;
+ }
# The computation of $v should overflow and produce "infinity"
# on any system whose max exponent is less than 10**1506.
# The exact string used to represent infinity varies by OS,
@@ -49,25 +46,23 @@ else {
while (--$n) {
$v *= 2;
}
- print "ok ", $T++, " - infinity\n";
+ pass("infinity");
}
# [perl #120426]
# small numbers shouldn't round to zero if they have extra floating digits
-unless ($Config{d_double_style_ieee}) {
- for (1..8) {
- print "ok ", $T++, " # SKIP -- not IEEE\n"
- }
-} else {
- try $T++, 0.153e-305 != 0.0, '0.153e-305';
- try $T++, 0.1530e-305 != 0.0, '0.1530e-305';
- try $T++, 0.15300e-305 != 0.0, '0.15300e-305';
- try $T++, 0.153000e-305 != 0.0, '0.153000e-305';
- try $T++, 0.1530000e-305 != 0.0, '0.1530000e-305';
- try $T++, 0.1530001e-305 != 0.0, '0.1530001e-305';
- try $T++, 1.17549435100e-38 != 0.0, 'min single';
+SKIP:
+{
+ skip "not IEEE", 8 unless $Config{d_double_style_ieee};
+ ok 0.153e-305 != 0.0, '0.153e-305';
+ ok 0.1530e-305 != 0.0, '0.1530e-305';
+ ok 0.15300e-305 != 0.0, '0.15300e-305';
+ ok 0.153000e-305 != 0.0, '0.153000e-305';
+ ok 0.1530000e-305 != 0.0, '0.1530000e-305';
+ ok 0.1530001e-305 != 0.0, '0.1530001e-305';
+ ok 1.17549435100e-38 != 0.0, 'min single';
# For flush-to-zero systems this may flush-to-zero, see PERL_SYS_FPU_INIT
- try $T++, 2.2250738585072014e-308 != 0.0, 'min double';
+ ok 2.2250738585072014e-308 != 0.0, 'min double';
}