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 (&, |, ^, ~, <<, >>, vec) 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 32+ bit
17 # shifts and vector sizes doesn't cause noise
18 no warning 'overflow';
28 $x = unpack "q", pack "q", $q;
29 print "not " unless $x == $q && $x > $f;
33 $x = sprintf("%d", 12345678901);
34 print "not " unless $x eq $q && $x > $f;
38 $x = sprintf("%d", $q);
39 print "not " unless $x == $q && $x eq $q && $x > $f;
42 $x = sprintf("%lld", $q);
43 print "not " unless $x == $q && $x eq $q && $x > $f;
46 $x = sprintf("%Ld", $q);
47 print "not " unless $x == $q && $x eq $q && $x > $f;
50 $x = sprintf("%qd", $q);
51 print "not " unless $x == $q && $x eq $q && $x > $f;
55 $x = sprintf("%x", $q);
56 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
59 $x = sprintf("%llx", $q);
60 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
63 $x = sprintf("%Lx", $q);
64 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
67 $x = sprintf("%qx", $q);
68 print "not " unless hex($x) == 0x2dfdc1c35 && hex($x) > $f;
72 $x = sprintf("%o", $q);
73 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
76 $x = sprintf("%llo", $q);
77 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
80 $x = sprintf("%Lo", $q);
81 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
84 $x = sprintf("%qo", $q);
85 print "not " unless oct("0$x") == 0133767016065 && oct($x) > $f;
89 $x = sprintf("%b", $q);
90 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
94 $x = sprintf("%llb", $q);
95 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
99 $x = sprintf("%Lb", $q);
100 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
104 $x = sprintf("%qb", $q);
105 print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101 &&
110 $x = sprintf("%u", 12345678901);
111 print "not " unless $x eq $q && $x > $f;
114 $x = sprintf("%u", $q);
115 print "not " unless $x == $q && $x eq $q && $x > $f;
118 $x = sprintf("%llu", $q);
119 print "not " unless $x == $q && $x eq $q && $x > $f;
122 $x = sprintf("%Lu", $q);
123 print "not " unless $x == $q && $x eq $q && $x > $f;
127 $x = sprintf("%D", $q);
128 print "not " unless $x == $q && $x eq $q && $x > $f;
131 $x = sprintf("%U", $q);
132 print "not " unless $x == $q && $x eq $q && $x > $f;
135 $x = sprintf("%O", $q);
136 print "not " unless oct($x) == $q && oct($x) > $f;
141 print "not " unless $x == 35802467913 && $x > $f;
145 print "not " unless $x == -11111110111 && -$x > $f;
149 print "not " unless $x == 15241567763770867 && $x > $f;
153 print "not " unless $x == $q && $x > $f;
156 $x = 98765432109 % 12345678901;
157 print "not " unless $x == 901;
160 # The following six adapted from op/inc.
162 $a = 9223372036854775807;
164 print "not " unless $a == 9223372036854775808;
167 $a = 9223372036854775807;
169 print "not " unless $a == 9223372036854775808;
172 $a = 9223372036854775807;
174 print "not " unless $a == 9223372036854775808;
177 $a = -9223372036854775808;
179 print "not " unless $a == -9223372036854775809;
182 $a = -9223372036854775808;
184 print "not " unless $a == -9223372036854775809;
187 $a = -9223372036854775808;
189 print "not " unless $a == -9223372036854775809;