6 eval { my $q = pack "q", 0 };
8 print "1..0\n# no 64-bit types\n";
12 unshift @INC, '../lib';
15 # This could use many more tests.
17 # so that using > 0xfffffff constants and
18 # 32+ bit integers don't cause noise
19 no warnings qw(overflow portable);
29 $x = unpack "q", pack "q", $q;
30 print "not " unless $x == $q && $x > $f;
34 $x = sprintf("%lld", 12345678901);
35 print "not " unless $x eq $q && $x > $f;
39 $x = sprintf("%lld", $q);
40 print "not " unless $x == $q && $x eq $q && $x > $f;
43 $x = sprintf("%Ld", $q);
44 print "not " unless $x == $q && $x eq $q && $x > $f;
47 $x = sprintf("%qd", $q);
48 print "not " unless $x == $q && $x eq $q && $x > $f;
52 $x = sprintf("%llx", $q);
53 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
56 $x = sprintf("%Lx", $q);
57 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
60 $x = sprintf("%qx", $q);
61 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
65 $x = sprintf("%llo", $q);
66 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
69 $x = sprintf("%Lo", $q);
70 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
73 $x = sprintf("%qo", $q);
74 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
78 $x = sprintf("%llb", $q);
79 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
83 $x = sprintf("%Lb", $q);
84 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
88 $x = sprintf("%qb", $q);
89 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
94 $x = sprintf("%llu", $q);
95 print "not " unless $x eq $q && $x > $f;
98 $x = sprintf("%Lu", $q);
99 print "not " unless $x == $q && $x eq $q && $x > $f;
102 $x = sprintf("%qu", $q);
103 print "not " unless $x == $q && $x eq $q && $x > $f;
107 $x = sprintf("%D", $q);
108 print "not " unless $x == $q && $x eq $q && $x > $f;
111 $x = sprintf("%U", $q);
112 print "not " unless $x == $q && $x eq $q && $x > $f;
115 $x = sprintf("%O", $q);
116 print "not " unless oct($x) == $q && oct($x) > $f;
121 print "not " unless $x == 35802467913 && $x > $f;
125 print "not " unless $x == -11111110111 && -$x > $f;
129 print "not " unless $x == 15241567763770867 && $x > $f;
133 print "not " unless $x == $q && $x > $f;
136 $x = 98765432109 % 12345678901;
137 print "not " unless $x == 901;
140 # The following 12 tests adapted from op/inc.
142 $a = 9223372036854775807;
144 print "not " unless $a == 9223372036854775808;
147 $a = 9223372036854775807;
149 print "not " unless $a == 9223372036854775808 && $c == $a;
152 $a = 9223372036854775807;
154 print "not " unless $a == 9223372036854775807 && $c == 9223372036854775808;
157 $a = -9223372036854775808;
159 print "not " unless $a == -9223372036854775809 && $c == -9223372036854775808;
162 $a = -9223372036854775808;
164 print "not " unless $a == -9223372036854775809 && $c == $a;
167 $a = -9223372036854775808;
169 print "not " unless $a == -9223372036854775808 && $c == -9223372036854775809;
172 $a = 9223372036854775808;
175 print "not " unless $a == -9223372036854775809 && $c == -9223372036854775808;
178 $a = 9223372036854775808;
181 print "not " unless $a == -9223372036854775809 && $c == $a;
184 $a = 9223372036854775808;
187 print "not " unless $a == -9223372036854775808 && $c == -9223372036854775809;
190 $a = 9223372036854775808;
193 print "not " unless $b == -$a-1 && $c == -$a;
196 $a = 9223372036854775808;
199 print "not " unless $b == -$a-1 && $c == $b;
202 $a = 9223372036854775808;
205 print "not " unless $b == -(++$a);
210 print "not " unless (vec($x, 1, 64) = $q) == $q;
213 print "not " unless vec($x, 1, 64) == $q && vec($x, 1, 64) > $f;
216 print "not " unless vec($x, 0, 64) == 0 && vec($x, 2, 64) == 0;
220 print "not " unless ~0 == 0xffffffffffffffff;
223 print "not " unless (0xffffffff<<32) == 0xffffffff00000000;
226 print "not " unless ((0xffffffff)<<32)>>32 == 0xffffffff;
229 print "not " unless 1<<63 == 0x8000000000000000;
232 print "not " unless (sprintf "%#Vx", 1<<63) eq '0x8000000000000000';
235 print "not " unless (0x8000000000000000 | 1) == 0x8000000000000001;
238 print "not " unless (0xf000000000000000 & 0x8000000000000000) == 0x8000000000000000;
241 print "not " unless (0xf000000000000000 ^ 0xfffffffffffffff0) == 0x0ffffffffffffff0;
245 print "not " unless (sprintf "%b", ~0) eq '1111111111111111111111111111111111111111111111111111111111111111';
248 print "not " unless (sprintf "%64b", ~0) eq '1111111111111111111111111111111111111111111111111111111111111111';
251 print "not " unless (sprintf "%d", ~0>>1) eq '9223372036854775807';
254 print "not " unless (sprintf "%u", ~0) eq '18446744073709551615';