2 eval { my $q = pack "q", 0 };
4 print "1..0\n# no 64-bit types\n";
8 unshift @INC, '../lib';
11 # This could use a lot of more tests.
13 # Nota bene: bit operations (&, |, ^, ~, <<, >>) are not 64-bit clean.
14 # See the beginning of pp.c and the explanation next to IBW/UBW.
16 # so that using > 0xfffffff constants and
17 # 32+ bit integers don't cause noise
18 no warnings qw(overflow portable);
28 $x = unpack "q", pack "q", $q;
29 print "not " unless $x == $q && $x > $f;
33 $x = sprintf("%lld", 12345678901);
34 print "not " unless $x eq $q && $x > $f;
38 $x = sprintf("%lld", $q);
39 print "not " unless $x == $q && $x eq $q && $x > $f;
42 $x = sprintf("%Ld", $q);
43 print "not " unless $x == $q && $x eq $q && $x > $f;
46 $x = sprintf("%qd", $q);
47 print "not " unless $x == $q && $x eq $q && $x > $f;
51 $x = sprintf("%llx", $q);
52 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
55 $x = sprintf("%Lx", $q);
56 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
59 $x = sprintf("%qx", $q);
60 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
64 $x = sprintf("%llo", $q);
65 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
68 $x = sprintf("%Lo", $q);
69 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
72 $x = sprintf("%qo", $q);
73 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
77 $x = sprintf("%llb", $q);
78 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
82 $x = sprintf("%Lb", $q);
83 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
87 $x = sprintf("%qb", $q);
88 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
93 $x = sprintf("%llu", $q);
94 print "not " unless $x eq $q && $x > $f;
97 $x = sprintf("%Lu", $q);
98 print "not " unless $x == $q && $x eq $q && $x > $f;
101 $x = sprintf("%qu", $q);
102 print "not " unless $x == $q && $x eq $q && $x > $f;
106 $x = sprintf("%D", $q);
107 print "not " unless $x == $q && $x eq $q && $x > $f;
110 $x = sprintf("%U", $q);
111 print "not " unless $x == $q && $x eq $q && $x > $f;
114 $x = sprintf("%O", $q);
115 print "not " unless oct($x) == $q && oct($x) > $f;
120 print "not " unless $x == 35802467913 && $x > $f;
124 print "not " unless $x == -11111110111 && -$x > $f;
128 print "not " unless $x == 15241567763770867 && $x > $f;
132 print "not " unless $x == $q && $x > $f;
135 $x = 98765432109 % 12345678901;
136 print "not " unless $x == 901;
139 # The following six adapted from op/inc.
141 $a = 9223372036854775807;
143 print "not " unless $a == 9223372036854775808;
146 $a = 9223372036854775807;
148 print "not " unless $a == 9223372036854775808 && $c == $a;
151 $a = 9223372036854775807;
153 print "not " unless $a == 9223372036854775807 && $c == 9223372036854775808;
156 $a = -9223372036854775808;
158 print "not " unless $a == -9223372036854775809 && $c == -9223372036854775808;
161 $a = -9223372036854775808;
163 print "not " unless $a == -9223372036854775809 && $c == $a;
166 $a = -9223372036854775808;
168 print "not " unless $a == -9223372036854775808 && $c == -9223372036854775809;
173 print "not " unless (vec($x, 1, 64) = $q) == $q;
176 print "not " unless vec($x, 1, 64) == $q && vec($x, 1, 64) > $f;
179 print "not " unless vec($x, 0, 64) == 0 && vec($x, 2, 64) == 0;
183 print "not " unless ~0 == 0xffffffffffffffff;
186 print "not " unless (0xffffffff<<32) == 0xffffffff00000000;
189 print "not " unless ((0xffffffff)<<32)>>32 == 0xffffffff;
192 print "not " unless 1<<63 == 0x8000000000000000;
195 print "not " unless (sprintf "%#Vx", 1<<63) eq '0x8000000000000000';
198 print "not " unless (0x8000000000000000 | 1) == 0x8000000000000001;
201 print "not " unless (0xf000000000000000 & 0x8000000000000000) == 0x8000000000000000;
204 print "not " unless (0xf000000000000000 ^ 0xfffffffffffffff0) == 0x0ffffffffffffff0;