summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-08-13 09:56:46 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-08-13 09:56:46 +0000
commit20fe1ea270754ae158cd9b7b3775ec869e80438c (patch)
treed1f0e0f1dc8f3790e49cc3df6ad5dc84ad5933f9 /t
parenta015af24b2d0b1531a3fb6be319dee296ef92ba5 (diff)
downloadperl-20fe1ea270754ae158cd9b7b3775ec869e80438c.tar.gz
Make the 64-bit tests more paranoid.
p4raw-id: //depot/cfgperl@3978
Diffstat (limited to 't')
-rw-r--r--t/op/64bit.t65
1 files changed, 35 insertions, 30 deletions
diff --git a/t/op/64bit.t b/t/op/64bit.t
index 97c1b03eb1..3e6ea06026 100644
--- a/t/op/64bit.t
+++ b/t/op/64bit.t
@@ -13,137 +13,142 @@ BEGIN {
# Nota bene: bit operations (&, |, ^, ~, <<, >>, vec) are not 64-bit clean.
# See the beginning of pp.c and the explanation next to IBW/UBW.
-no warning 'overflow';
+no warning 'overflow'; # so that using > 0xfffffff constants doesn't whine
print "1..30\n";
my $q = 12345678901;
my $r = 23456789012;
+my $f = 0xffffffff;
my $x;
$x = unpack "q", pack "q", $q;
-print "not " unless $x == $q;
+print "not " unless $x == $q && $x > $f;
print "ok 1\n";
$x = sprintf("%d", 12345678901);
-print "not " unless $x eq "$q";
+print "not " unless $x eq $q && $x > $f;
print "ok 2\n";
$x = sprintf("%d", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 3\n";
$x = sprintf("%lld", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 4\n";
$x = sprintf("%Ld", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 5\n";
$x = sprintf("%qd", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 6\n";
$x = sprintf("%x", $q);
-print "not " unless hex($x) == 0x2dfdc1c35;
+print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
print "ok 7\n";
$x = sprintf("%llx", $q);
-print "not " unless hex($x) == 0x2dfdc1c35;
+print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
print "ok 8\n";
$x = sprintf("%Lx", $q);
-print "not " unless hex($x) == 0x2dfdc1c35;
+print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
print "ok 9\n";
$x = sprintf("%qx", $q);
-print "not " unless hex($x) == 0x2dfdc1c35;
+print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
print "ok 10\n";
$x = sprintf("%o", $q);
-print "not " unless oct("0$x") == 0133767016065;
+print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
print "ok 11\n";
$x = sprintf("%llo", $q);
-print "not " unless oct("0$x") == 0133767016065;
+print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
print "ok 12\n";
$x = sprintf("%Lo", $q);
-print "not " unless oct("0$x") == 0133767016065;
+print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
print "ok 13\n";
$x = sprintf("%qo", $q);
-print "not " unless oct("0$x") == 0133767016065;
+print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
print "ok 14\n";
$x = sprintf("%b", $q);
-print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101;
+print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
+ oct("0b$x") > $f;
print "ok 15\n";
$x = sprintf("%llb", $q);
-print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101;
+print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
+ oct("0b$x") > $f;
print "ok 16\n";
$x = sprintf("%Lb", $q);
-print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101;
+print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
+ oct("0b$x") > $f;
print "ok 17\n";
$x = sprintf("%qb", $q);
-print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101;
+print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
+ oct("0b$x") > $f;
print "ok 18\n";
$x = sprintf("%u", 12345678901);
-print "not " unless $x eq "$q";
+print "not " unless $x eq $q && $x > $f;
print "ok 19\n";
$x = sprintf("%u", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 20\n";
$x = sprintf("%llu", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 21\n";
$x = sprintf("%Lu", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 22\n";
$x = sprintf("%D", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 23\n";
$x = sprintf("%U", $q);
-print "not " unless $x == $q && $x eq $q;
+print "not " unless $x == $q && $x eq $q && $x > $f;
print "ok 24\n";
$x = sprintf("%O", $q);
-print "not " unless oct($x) == $q;
+print "not " unless oct($x) == $q && oct($x) > $f;
print "ok 25\n";
$x = $q + $r;
-print "not " unless $x == 35802467913;
+print "not " unless $x == 35802467913 && $x > $f;
print "ok 26\n";
$x = $q - $r;
-print "not " unless $x == -11111110111;
+print "not " unless $x == -11111110111 && -$x > $f;
print "ok 27\n";
$x = $q * $r;
-print "not " unless $x == 289589985190657035812;
+print "not " unless $x == 289589985190657035812 && $x > $f;
print "ok 28\n";
$x /= $r;
-print "not " unless $x == $q;
+print "not " unless $x == $q && $x > $f;
print "ok 29\n";
$x = 98765432109 % 12345678901;