summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-03-17 15:12:24 +1100
committerJames E Keenan <jkeenan@cpan.org>2021-03-19 18:51:13 -0400
commit2e63b51a1ce2243da015983e9253835ebea2bee7 (patch)
treef01c39fd781617e200b183500d4f5ddd9df27408 /t
parent5bf30e64ab9d93057d4cd01c9846b3a9dab788d6 (diff)
downloadperl-2e63b51a1ce2243da015983e9253835ebea2bee7.tar.gz
Split Config-dependent tests in t/opbasic/arith.t to t/op/arith2.t
Some tests in t/opbasic/arith.t used to depend on the perl configuration, but t/opbasic/* is so basic tests that it should not depend on Config.pm. Now these tests are splitted into separate test file under t/op/.
Diffstat (limited to 't')
-rw-r--r--t/op/arith2.t72
-rw-r--r--t/opbasic/arith.t57
2 files changed, 73 insertions, 56 deletions
diff --git a/t/op/arith2.t b/t/op/arith2.t
new file mode 100644
index 0000000000..fdd38938d7
--- /dev/null
+++ b/t/op/arith2.t
@@ -0,0 +1,72 @@
+#!./perl
+
+# These Config-dependent tests were originally in t/opbasic/arith.t,
+# but moved here because t/opbasic/* should not depend on sophisticated
+# constructs like "use Config;".
+
+BEGIN {
+ chdir 't' if -d 't';
+ require './test.pl';
+ set_up_inc('../lib');
+}
+
+use Config;
+
+sub try ($$$) {
+ print +($_[1] ? "ok" : "not ok") . " $_[0] - $_[2]\n";
+}
+
+my $T = 1;
+print "1..9\n";
+
+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 {
+ # 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,
+ # so we don't test for it; all we care is that we don't die.
+ #
+ # Perl considers it to be an error if SIGFPE is raised.
+ # Chances are the interpreter will die, since it doesn't set
+ # up a handler for SIGFPE. That's why this test is last; to
+ # minimize the number of test failures. --PG
+
+ my $n = 5000;
+ my $v = 2;
+ while (--$n)
+ {
+ $v *= 2;
+ }
+ print "ok ", $T++, " - infinity\n";
+}
+
+
+# [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';
+# For flush-to-zero systems this may flush-to-zero, see PERL_SYS_FPU_INIT
+try $T++, 2.2250738585072014e-308 != 0.0, 'min double';
+}
diff --git a/t/opbasic/arith.t b/t/opbasic/arith.t
index bbf7100dcb..7f4f1f290b 100644
--- a/t/opbasic/arith.t
+++ b/t/opbasic/arith.t
@@ -14,7 +14,7 @@ BEGIN {
# functions imported from t/test.pl or Test::More, as those programs/libraries
# use operators which are what is being tested in this file.
-print "1..189\n";
+print "1..180\n";
sub try ($$$) {
print +($_[1] ? "ok" : "not ok") . " $_[0] - $_[2]\n";
@@ -433,61 +433,6 @@ $a = (97656250000000000 % $1);
$b = (97656250000000000 % "$1");
print "not "x($a ne $b), "ok ", $T++, qq ' - something % \$1 vs "\$1"\n';
-my $vms_no_ieee;
-if ($^O eq 'VMS') {
- eval { require Config };
- $vms_no_ieee = 1 unless defined($Config::Config{useieee});
-}
-
-if ($^O eq 'vos') {
- print "not ok ", $T++, " # TODO VOS raises SIGFPE instead of producing infinity.\n";
-}
-elsif ($vms_no_ieee || !$Config::Config{d_double_has_inf}) {
- # note Config.pm is only loaded under VMS and via a require.
- 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 {
- # 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,
- # so we don't test for it; all we care is that we don't die.
- #
- # Perl considers it to be an error if SIGFPE is raised.
- # Chances are the interpreter will die, since it doesn't set
- # up a handler for SIGFPE. That's why this test is last; to
- # minimize the number of test failures. --PG
-
- my $n = 5000;
- my $v = 2;
- while (--$n)
- {
- $v *= 2;
- }
- print "ok ", $T++, " - infinity\n";
-}
-
-
-# [perl #120426]
-# small numbers shouldn't round to zero if they have extra floating digits
-
-# note Config.pm is only loaded under VMS and via a require.
-unless ($Config::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';
-# For flush-to-zero systems this may flush-to-zero, see PERL_SYS_FPU_INIT
-try $T++, 2.2250738585072014e-308 != 0.0, 'min double';
-}
-
# string-to-nv should equal float literals
try $T++, "1.23" + 0 == 1.23, '1.23';
try $T++, " 1.23" + 0 == 1.23, '1.23 with leading space';