summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2001-08-29 19:21:56 +0100
committerAbhijit Menon-Sen <ams@wiw.org>2001-08-29 17:35:33 +0000
commit59d8ce6297a94889161c3324ccfdc9bb1a2d9d05 (patch)
treeb94758262b06c0e83fdd3159f28d814ce474b157 /t
parentd09712d887062ccb5a1104006dc798bcb5502153 (diff)
downloadperl-59d8ce6297a94889161c3324ccfdc9bb1a2d9d05.tar.gz
pass all tests when compiling with -DNO_PERL_PRESERVE_IVUV
Message-Id: <20010829182156.O4950@plum.flirble.org> p4raw-id: //depot/perl@11788
Diffstat (limited to 't')
-rw-r--r--t/op/64bitint.t19
-rwxr-xr-xt/op/numconvert.t8
2 files changed, 25 insertions, 2 deletions
diff --git a/t/op/64bitint.t b/t/op/64bitint.t
index e5ff95bf16..92b00d7783 100644
--- a/t/op/64bitint.t
+++ b/t/op/64bitint.t
@@ -14,10 +14,26 @@ BEGIN {
# so that using > 0xfffffff constants and
# 32+ bit integers don't cause noise
+use warnings;
no warnings qw(overflow portable);
print "1..59\n";
+# as 6 * 6 = 36, the last digit of 6**n will always be six. Hence the last
+# digit of 16**n will always be six. Hence 16**n - 1 will always end in 5.
+# Assumption is that UVs will always be a multiple of 4 bits long.
+
+my $UV_max = ~0;
+die "UV_max eq '$UV_max', doesn't end in 5; your UV isn't 4n bits long :-(."
+ unless $UV_max =~ /5$/;
+my $UV_max_less3 = $UV_max - 3;
+my $maths_preserves_UVs = $UV_max_less3 =~ /^\d+2$/; # 5 - 3 is 2.
+if ($maths_preserves_UVs) {
+ print "# This perl's maths preserves all bits of a UV.\n";
+} else {
+ print "# This perl's maths does not preserve all bits of a UV.\n";
+}
+
my $q = 12345678901;
my $r = 23456789012;
my $f = 0xffffffff;
@@ -327,7 +343,8 @@ print "ok 58\n";
# 0xFFFFFFFFFFFFFFFF == 1 * 3 * 5 * 17 * 257 * 641 * 65537 * 6700417'
$q = 0xFFFFFFFFFFFFFFFF / 3;
-if ($q == 0x5555555555555555 and $q != 0x5555555555555556) {
+if ($q == 0x5555555555555555 and ($q != 0x5555555555555556
+ or !$maths_preserves_UVs)) {
print "ok 59\n";
} else {
print "not ok 59 # 0xFFFFFFFFFFFFFFFF / 3 = $q\n";
diff --git a/t/op/numconvert.t b/t/op/numconvert.t
index 084092e534..fedef70d40 100755
--- a/t/op/numconvert.t
+++ b/t/op/numconvert.t
@@ -48,9 +48,11 @@ my $max_chain = $ENV{PERL_TEST_NUMCONVERTS} || 2;
my $max_uv1 = ~0;
my $max_uv2 = sprintf "%u", $max_uv1 ** 6; # 6 is an arbitrary number here
my $big_iv = do {use integer; $max_uv1 * 16}; # 16 is an arbitrary number here
+my $max_uv_less3 = $max_uv1 - 3;
print "# max_uv1 = $max_uv1, max_uv2 = $max_uv2, big_iv = $big_iv\n";
-if ($max_uv1 ne $max_uv2 or $big_iv > $max_uv1) {
+print "# max_uv_less3 = $max_uv_less3\n";
+if ($max_uv1 ne $max_uv2 or $big_iv > $max_uv1 or $max_uv1 == $max_uv_less3) {
print "1..0 # skipped: unsigned perl arithmetic is not sane";
eval { require Config; import Config };
use vars qw(%Config);
@@ -60,6 +62,10 @@ if ($max_uv1 ne $max_uv2 or $big_iv > $max_uv1) {
print "\n";
exit 0;
}
+if ($max_uv_less3 =~ tr/0-9//c) {
+ print "1..0 # skipped: this perl stringifies large unsigned integers using E notation\n";
+ exit 0;
+}
my $st_t = 4*4; # We try 4 initializers and 4 reporters