blob: 705b1655735f3518e09711d8c7ec56eb97f9214e [file] [log] [blame]
Lev Walkin4eceeba2007-07-23 06:48:26 +00001#include <stdio.h>
2#include <assert.h>
3
Lev Walkin6cbed3d2017-10-07 16:42:41 -07004#include <asn_application.h>
Lev Walkin4eceeba2007-07-23 06:48:26 +00005#include <INTEGER.h>
Lev Walkinf15320b2004-06-03 03:38:44 +00006
Lev Walkin6cbed3d2017-10-07 16:42:41 -07007#define CHECK_XER(a,b,c) check_xer(__LINE__, a, b, c)
8
Lev Walkindb13f512004-07-19 17:30:25 +00009static char *shared_scratch_start;
10
11static int _print2buf(const void *buf, size_t size, void *key) {
12 (void)key;
13 memcpy(shared_scratch_start, buf, size);
14 shared_scratch_start += size;
15 *shared_scratch_start = '\0'; /* 0-termination */
16 return 0;
17}
18
Lev Walkinf15320b2004-06-03 03:38:44 +000019static void
Lev Walkin494fb702017-08-07 20:07:00 -070020check(uint8_t *buf, size_t size, long check_long, int check_ret) {
Lev Walkindb13f512004-07-19 17:30:25 +000021 char scratch[128];
22 char verify[32];
Lev Walkinf15320b2004-06-03 03:38:44 +000023 INTEGER_t val;
Lev Walkindb13f512004-07-19 17:30:25 +000024 uint8_t *buf_end = buf + size;
Lev Walkinf15320b2004-06-03 03:38:44 +000025 int ret;
26 long rlong = 123;
27
28 assert(buf);
Vasil Velichkov72b10442017-10-19 04:38:38 +030029 assert(size > 0);
Lev Walkinf15320b2004-06-03 03:38:44 +000030
31 val.buf = buf;
32 val.size = size;
33
Lev Walkindb13f512004-07-19 17:30:25 +000034 printf("Testing: [");
35 for(; buf < buf_end; buf++) {
36 if(buf != val.buf) printf(":");
37 printf("%02x", *buf);
38 }
39 printf("]: ");
Lev Walkinf15320b2004-06-03 03:38:44 +000040
Lev Walkin5e033762004-09-29 13:26:15 +000041 ret = asn_INTEGER2long(&val, &rlong);
Lev Walkindb13f512004-07-19 17:30:25 +000042 printf(" (%ld, %d) vs (%ld, %d)\n",
Lev Walkinf15320b2004-06-03 03:38:44 +000043 rlong, ret, check_long, check_ret);
44 assert(ret == check_ret);
Lev Walkin33700162004-10-26 09:03:31 +000045 printf("%ld %ld\n", rlong, check_long);
Lev Walkinf15320b2004-06-03 03:38:44 +000046 assert(rlong == check_long);
Lev Walkindb13f512004-07-19 17:30:25 +000047
Lev Walkinc698ee52004-10-21 11:19:51 +000048 if(check_ret == 0) {
49 INTEGER_t val2;
50 long rlong2;
51 val2.buf = 0;
52 val2.size = 0;
53 ret = asn_long2INTEGER(&val2, rlong);
54 assert(ret == 0);
55 assert(val2.buf);
56 assert(val2.size <= val.size); /* At least as compact */
57 ret = asn_INTEGER2long(&val, &rlong2);
58 assert(ret == 0);
59 assert(rlong == rlong2);
Lev Walkin229ad002017-09-18 20:13:49 -070060 ASN_STRUCT_RESET(asn_DEF_INTEGER, &val2);
Lev Walkinc698ee52004-10-21 11:19:51 +000061 }
62
Lev Walkindb13f512004-07-19 17:30:25 +000063 shared_scratch_start = scratch;
Lev Walkin5e033762004-09-29 13:26:15 +000064 ret = INTEGER_print(&asn_DEF_INTEGER, &val, 0, _print2buf, scratch);
Lev Walkindb13f512004-07-19 17:30:25 +000065 assert(shared_scratch_start < scratch + sizeof(scratch));
66 assert(ret == 0);
67 ret = snprintf(verify, sizeof(verify), "%ld", check_long);
Lev Walkin97363482016-01-24 19:23:02 -080068 assert(ret < 0 || (size_t)ret < sizeof(verify));
Lev Walkindb13f512004-07-19 17:30:25 +000069 ret = strcmp(scratch, verify);
70 printf(" [%s] vs [%s]: %d%s\n",
71 scratch, verify, ret,
72 (check_ret == -1)?" (expected to fail)":""
73 );
74 if(check_ret == -1) {
75 assert(strcmp(scratch, verify));
76 } else {
77 assert(strcmp(scratch, verify) == 0);
78 }
Lev Walkinf15320b2004-06-03 03:38:44 +000079}
80
Lev Walkin0be3a992004-10-21 12:11:57 +000081static void
Lev Walkin5c879db2007-11-06 06:23:31 +000082check_unsigned(uint8_t *buf, int size, unsigned long check_long, int check_ret) {
83 char scratch[128];
84 char verify[32];
85 INTEGER_t val;
86 uint8_t *buf_end = buf + size;
87 int ret;
88 unsigned long rlong = 123;
89
90 assert(buf);
91 assert(size >= 0);
92
93 val.buf = buf;
94 val.size = size;
95
96 printf("Testing: [");
97 for(; buf < buf_end; buf++) {
98 if(buf != val.buf) printf(":");
99 printf("%02x", *buf);
100 }
101 printf("]: ");
102
103 ret = asn_INTEGER2ulong(&val, &rlong);
104 printf(" (%lu, %d) vs (%lu, %d)\n",
105 rlong, ret, check_long, check_ret);
106 assert(ret == check_ret);
Lev Walkin5c879db2007-11-06 06:23:31 +0000107 assert(rlong == check_long);
108
109 if(check_ret == 0) {
110 INTEGER_t val2;
111 unsigned long rlong2;
112 val2.buf = 0;
113 val2.size = 0;
114 ret = asn_ulong2INTEGER(&val2, rlong);
115 assert(ret == 0);
116 assert(val2.buf);
117 if(val2.size > val.size) {
118 /* At least as compact */
119 printf("val2.size=%d, val.size=%d\n",
120 (int)val2.size, (int)val.size);
121 assert(val2.size <= val.size);
122 }
123 ret = asn_INTEGER2ulong(&val, &rlong2);
124 assert(ret == 0);
125 assert(rlong == rlong2);
Lev Walkin229ad002017-09-18 20:13:49 -0700126 ASN_STRUCT_RESET(asn_DEF_INTEGER, &val2);
Lev Walkin5c879db2007-11-06 06:23:31 +0000127 }
128
Lev Walkin97f8edc2013-03-28 04:38:41 -0700129 return;
130
Lev Walkin5c879db2007-11-06 06:23:31 +0000131 shared_scratch_start = scratch;
132 ret = INTEGER_print(&asn_DEF_INTEGER, &val, 0, _print2buf, scratch);
133 assert(shared_scratch_start < scratch + sizeof(scratch));
134 assert(ret == 0);
Lev Walkin043babe2012-01-22 18:06:59 -0800135 ret = snprintf(verify, sizeof(verify), "%lu", check_long);
Vasil Velichkov72b10442017-10-19 04:38:38 +0300136 assert(ret < (int)sizeof(verify));
Lev Walkin5c879db2007-11-06 06:23:31 +0000137 ret = strcmp(scratch, verify);
138 printf(" [%s] vs [%s]: %d%s\n",
139 scratch, verify, ret,
140 (check_ret == -1)?" (expected to fail)":""
141 );
142 if(check_ret == -1) {
143 assert(strcmp(scratch, verify));
144 } else {
145 assert(strcmp(scratch, verify) == 0);
146 }
147}
148
149static void
Lev Walkin6cbed3d2017-10-07 16:42:41 -0700150check_xer(int lineno, int tofail, char *xmldata, long orig_value) {
Lev Walkin0be3a992004-10-21 12:11:57 +0000151 INTEGER_t *st = 0;
152 asn_dec_rval_t rc;
153 long value;
154 int ret;
155
Lev Walkin6cbed3d2017-10-07 16:42:41 -0700156 printf("%03d: [%s] vs %ld: ", lineno, xmldata, orig_value);
Lev Walkin0be3a992004-10-21 12:11:57 +0000157
158 rc = xer_decode(0, &asn_DEF_INTEGER, (void *)&st,
159 xmldata, strlen(xmldata));
160 if(rc.code != RC_OK) {
161 assert(tofail);
162 printf("\tfailed, as expected\n");
Lev Walkin229ad002017-09-18 20:13:49 -0700163 ASN_STRUCT_FREE(asn_DEF_INTEGER, st);
Lev Walkin0be3a992004-10-21 12:11:57 +0000164 return;
165 }
Lev Walkin6cbed3d2017-10-07 16:42:41 -0700166 if(tofail) {
167 printf("\tnot failed, as expected!\n");
168 assert(!tofail);
169 }
Lev Walkin0be3a992004-10-21 12:11:57 +0000170
171 ret = asn_INTEGER2long(st, &value);
172 assert(ret == 0);
173
174 printf("\t%ld\n", value);
175
176 assert(value == orig_value);
177
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800178 ASN_STRUCT_FREE(asn_DEF_INTEGER, st);
Lev Walkin0be3a992004-10-21 12:11:57 +0000179}
180
Lev Walkin6495ca52019-08-10 20:07:39 -0700181static void
182check_strtoimax() {
183 const intmax_t intmax_max = ((~(uintmax_t)0) >> 1);
184 const intmax_t intmax_min = -((intmax_t)intmax_max) - 1;
185 char positive_max[32];
186 char negative_min[32];
187 const int len_pmax = snprintf(positive_max, sizeof(positive_max),
188 "+%" ASN_PRIdMAX, intmax_max);
189 const int len_nmin = snprintf(negative_min, sizeof(negative_min),
190 "%" ASN_PRIdMAX, intmax_min);
191 assert(len_pmax < (int)sizeof(positive_max));
192 assert(len_nmin < (int)sizeof(negative_min));
193
194 enum asn_strtox_result_e result;
195 intmax_t value;
196
197 /*
198 * Test edge values first.
199 */
200 // Positive.
201 const char *last_pmax = &positive_max[len_pmax];
202 result = asn_strtoimax_lim(positive_max, &last_pmax, &value);
203 assert(result == ASN_STRTOX_OK);
204 assert(last_pmax == &positive_max[len_pmax]);
205 assert(value == intmax_max);
206 // Negative.
207 const char *last_nmin = &negative_min[len_nmin];
208 result = asn_strtoimax_lim(negative_min, &last_nmin, &value);
209 assert(result == ASN_STRTOX_OK);
210 assert(last_nmin == &negative_min[len_nmin]);
211 assert(value == intmax_min);
212
213 /*
214 * Test one smaller than edge evalues.
215 */
216 positive_max[len_pmax - 1]--;
217 negative_min[len_nmin - 1]--;
218 // Positive.
219 result = asn_strtoimax_lim(positive_max, &last_pmax, &value);
220 assert(result == ASN_STRTOX_OK);
221 assert(last_pmax == &positive_max[len_pmax]);
222 assert(value == intmax_max - 1);
223 // Negative.
224 result = asn_strtoimax_lim(negative_min, &last_nmin, &value);
225 assert(result == ASN_STRTOX_OK);
226 assert(last_nmin == &negative_min[len_nmin]);
227 assert(value == intmax_min + 1);
228
229 /*
230 * Test one bigger than edge evalues.
231 */
232 positive_max[len_pmax - 1] += 2;
233 negative_min[len_nmin - 1] += 2;
234 // Positive.
235 value = 42;
236 result = asn_strtoimax_lim(positive_max, &last_pmax, &value);
237 assert(result == ASN_STRTOX_ERROR_RANGE);
238 assert(last_pmax == &positive_max[len_pmax - 1]);
239 assert(value == 42);
240 // Negative.
241 value = 42;
242 result = asn_strtoimax_lim(negative_min, &last_nmin, &value);
243 assert(result == ASN_STRTOX_ERROR_RANGE);
244 assert(last_nmin == &negative_min[len_nmin - 1]);
245 assert(value == 42);
246
247 /*
248 * Get back to the edge.
249 * Append an extra digit at the end.
250 */
251 positive_max[len_pmax - 1]--;
252 negative_min[len_nmin - 1]--;
253 assert(len_pmax < (int)sizeof(positive_max) - 1);
254 assert(len_nmin < (int)sizeof(negative_min) - 1);
255 strcat(positive_max, "0");
256 strcat(negative_min, "0");
257 last_pmax++;
258 last_nmin++;
259 value = 42;
260 result = asn_strtoimax_lim(positive_max, &last_pmax, &value);
261 assert(result == ASN_STRTOX_OK);
262 assert(value == intmax_max);
263 result = asn_strtoimax_lim(negative_min, &last_nmin, &value);
264 assert(result == ASN_STRTOX_OK);
265 assert(value == intmax_min);
266}
267
268/*
269 * Check that asn_strtoimax_lim() always reaches the end of the numeric
270 * sequence, even if it can't fit into the range.
271 */
272static void
273check_strtoimax_span() {
274 const intmax_t intmax_max = ((~(uintmax_t)0) >> 1);
275 const intmax_t almost_min = -((intmax_t)(intmax_max - 10));
276 char buf[64];
277 intmax_t value = 42;
278 enum asn_strtox_result_e result;
279
280 // Check a particular way to integer overflow.
281 // Check that we scan until the very end.
282 int len = snprintf(buf, sizeof(buf), "%" PRIdMAX "0</end>", almost_min);
283 assert(len < (int)sizeof(buf));
284 const char *nmlast = &buf[len];
285 result = asn_strtoimax_lim(buf, &nmlast, &value);
286 assert(*nmlast == '0');
287 assert((ptrdiff_t)(nmlast - buf) == (ptrdiff_t)(len - strlen("0</end>")));
288 assert(result == ASN_STRTOX_ERROR_RANGE);
289 assert(value == 42);
290
291 // Check a particular way to integer overflow.
292 // Check that we scan until the very end.
293 len = snprintf(buf, sizeof(buf), "%" PRIdMAX "</end>", almost_min);
294 assert(len < (int)sizeof(buf));
295 nmlast = &buf[len];
296 result = asn_strtoimax_lim(buf, &nmlast, &value);
297 assert(*nmlast == '<');
298 assert((ptrdiff_t)(nmlast - buf) == (ptrdiff_t)(len - strlen("</end>")));
299 assert(result == ASN_STRTOX_EXTRA_DATA);
300 assert(value == almost_min);
301
302}
303
Lev Walkinf15320b2004-06-03 03:38:44 +0000304int
Lev Walkin97363482016-01-24 19:23:02 -0800305main() {
Lev Walkinf15320b2004-06-03 03:38:44 +0000306 uint8_t buf1[] = { 1 };
307 uint8_t buf2[] = { 0xff };
308 uint8_t buf3[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
309 uint8_t buf4[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0 };
310 uint8_t buf5[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 };
311 uint8_t buf6[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
312 uint8_t buf7[] = { 0xff, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
313 uint8_t buf8[] = { 0x7f, 0x7e, 0x7d, 0x7c };
314 uint8_t buf9[] = { 0, 0x7f, 0x7e, 0x7d, 0x7c };
315 uint8_t buf10[] = { 0, 0, 0, 0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c };
Lev Walkinc698ee52004-10-21 11:19:51 +0000316 uint8_t buf11[] = { 0x80, 0, 0, 0 };
317 uint8_t buf12[] = { 0x80, 0 };
318 uint8_t buf13[] = { 0x80 };
Lev Walkin5c879db2007-11-06 06:23:31 +0000319 uint8_t buf14[] = { 0x00, 0x80, 0x00, 0x00 };
320 uint8_t buf15[] = { 0x00, 0x80, 0x00, 0x00, 0x00 };
321 uint8_t buf16[] = { 0x00, 0xff, 0xff, 0x00, 0x00 };
322
323#define UCHECK(buf, val, ret) check_unsigned(buf, sizeof(buf), val, ret)
Lev Walkinf15320b2004-06-03 03:38:44 +0000324
325#define CHECK(buf, val, ret) check(buf, sizeof(buf), val, ret)
326
327 CHECK(buf1, 1, 0);
328 CHECK(buf2, -1, 0);
329 CHECK(buf3, -1, 0);
330 CHECK(buf4, -16, 0);
331 CHECK(buf5, 257, 0);
332 CHECK(buf6, 123, -1);
333 CHECK(buf7, 123, -1);
334 CHECK(buf8, 0x7F7E7D7C, 0);
335 CHECK(buf9, 0x7F7E7D7C, 0);
336 CHECK(buf10, 0x7F7E7D7C, 0);
Lev Walkin5c879db2007-11-06 06:23:31 +0000337 UCHECK(buf10, 0x7F7E7D7C, 0);
Lev Walkin3f36e462005-08-15 01:02:47 +0000338 CHECK(buf11, -2147483647-1, 0); /* 0x80000000 */
Lev Walkinc698ee52004-10-21 11:19:51 +0000339 CHECK(buf12, -32768, 0);
340 CHECK(buf13, -128, 0);
Lev Walkin5c879db2007-11-06 06:23:31 +0000341 UCHECK(buf14, 0x800000, 0);
Lev Walkin043babe2012-01-22 18:06:59 -0800342 UCHECK(buf15, 0x80000000UL, 0);
343 UCHECK(buf16, 0xffff0000UL, 0);
Lev Walkinf15320b2004-06-03 03:38:44 +0000344
Lev Walkin6cbed3d2017-10-07 16:42:41 -0700345 CHECK_XER(-1, "", 0);
346 CHECK_XER(-1, "<INTEGER></INTEGER>", 0);
347 CHECK_XER(-1, "<INTEGER> </INTEGER>", 0);
348 CHECK_XER(-1, "<INTEGER>-</INTEGER>", 0);
349 CHECK_XER(-1, "<INTEGER>+</INTEGER>", 0);
350 CHECK_XER(-1, "<INTEGER>+-</INTEGER>", 0);
351 CHECK_XER(-1, "<INTEGER> -</INTEGER>", 0);
352 CHECK_XER(-1, "<INTEGER> +</INTEGER>", 0);
353 CHECK_XER(-1, "<INTEGER> +-</INTEGER>", 0);
354 CHECK_XER(-1, "<INTEGER>- </INTEGER>", 0);
355 CHECK_XER(-1, "<INTEGER>+ </INTEGER>", 0);
356 CHECK_XER(-1, "<INTEGER>+- </INTEGER>", 0);
357 CHECK_XER(-1, "<INTEGER> - </INTEGER>", 0);
358 CHECK_XER(-1, "<INTEGER> + </INTEGER>", 0);
359 CHECK_XER(-1, "<INTEGER> +- </INTEGER>", 0);
360 CHECK_XER(0, "<INTEGER>+0</INTEGER>", 0);
361 CHECK_XER(0, "<INTEGER>-0</INTEGER>", 0);
362 CHECK_XER(0, "<INTEGER>+1</INTEGER>", 1);
363 CHECK_XER(0, "<INTEGER>-1</INTEGER>", -1);
364 CHECK_XER(0, "<INTEGER>1</INTEGER>", 1);
365 CHECK_XER(0, "<INTEGER>-15</INTEGER>", -15);
366 CHECK_XER(0, "<INTEGER>+15</INTEGER>", 15);
367 CHECK_XER(0, "<INTEGER>15</INTEGER>", 15);
368 CHECK_XER(0, "<INTEGER> 15</INTEGER>", 15);
369 CHECK_XER(0, "<INTEGER> 15 </INTEGER>", 15);
370 CHECK_XER(0, "<INTEGER>15 </INTEGER>", 15);
371 CHECK_XER(0, "<INTEGER> +15 </INTEGER>", 15);
372 CHECK_XER(-1, "<INTEGER> +15 -</INTEGER>", 0);
373 CHECK_XER(-1, "<INTEGER> +15 1</INTEGER>", 0);
374 CHECK_XER(-1, "<INTEGER>+ 15</INTEGER>", 0);
375 CHECK_XER(-1, "<INTEGER>12<z>34</INTEGER>", 0);
376 CHECK_XER(-1, "<INTEGER>12 <z>34</INTEGER>", 0);
377 CHECK_XER(-1, "<INTEGER>12 <z></INTEGER>", 0);
378 CHECK_XER(0, "<INTEGER>1234</INTEGER>", 1234);
379 CHECK_XER(-1, "<INTEGER>1234 5678</INTEGER>", 0);
380 CHECK_XER(0, "<INTEGER>-2147483647</INTEGER>", -2147483647);
381 CHECK_XER(0, "<INTEGER>-2147483648</INTEGER>", -2147483647-1);
382 CHECK_XER(0, "<INTEGER>+2147483647</INTEGER>", 2147483647);
383 CHECK_XER(0, "<INTEGER>2147483647</INTEGER>", 2147483647);
Lev Walkine59f7672004-10-23 10:17:02 +0000384 if(sizeof(long) == 4) {
Lev Walkin6cbed3d2017-10-07 16:42:41 -0700385 CHECK_XER( 0, "<INTEGER>-2147483648</INTEGER>", -2147483648);
386 CHECK_XER(-1, "<INTEGER>-2147483649</INTEGER>", 0);
387 CHECK_XER(-1, "<INTEGER>2147483648</INTEGER>", 0);
388 CHECK_XER(-1, "<INTEGER>2147483649</INTEGER>", 0);
389 CHECK_XER(-1, "<INTEGER>3147483649</INTEGER>", 0);
390 CHECK_XER(-1, "<INTEGER>4147483649</INTEGER>", 0);
391 CHECK_XER(-1, "<INTEGER>5147483649</INTEGER>", 0); /* special */
392 CHECK_XER(-1, "<INTEGER>9147483649</INTEGER>", 0);
393 CHECK_XER(-1, "<INTEGER>9999999999</INTEGER>", 0);
394 CHECK_XER(-1, "<INTEGER>-5147483649</INTEGER>", 0);/* special */
395 CHECK_XER(-1, "<INTEGER>-9147483649</INTEGER>", 0);
396 CHECK_XER(-1, "<INTEGER>-9999999999</INTEGER>", 0);
Lev Walkina7d1fb32012-01-23 01:21:55 +0000397 }
Lev Walkin6cbed3d2017-10-07 16:42:41 -0700398#ifdef TEST_64BIT
Lev Walkina7d1fb32012-01-23 01:21:55 +0000399 if(sizeof(long) == 8) {
Lev Walkin6cbed3d2017-10-07 16:42:41 -0700400 CHECK_XER(0, "<INTEGER>2147483648</INTEGER>", 2147483648);
401 CHECK_XER(0, "<INTEGER>2147483649</INTEGER>", 2147483649);
402 CHECK_XER(0, "<INTEGER>3147483649</INTEGER>", 3147483649);
403 CHECK_XER(0, "<INTEGER>4147483649</INTEGER>", 4147483649);
404 CHECK_XER(0, "<INTEGER>5147483649</INTEGER>", 5147483649);
405 CHECK_XER(0, "<INTEGER>9147483649</INTEGER>", 9147483649);
406 CHECK_XER(0, "<INTEGER>9999999999</INTEGER>", 9999999999);
407 CHECK_XER(0, "<INTEGER>9223372036854775807</INTEGER>", 9223372036854775807);
408 CHECK_XER(-1, "<INTEGER>9223372036854775808</INTEGER>", 0);
409 CHECK_XER(-1, "<INTEGER>10223372036854775807</INTEGER>", 0);
410 CHECK_XER(-1, "<INTEGER>50223372036854775807</INTEGER>", 0);
411 CHECK_XER(-1, "<INTEGER>100223372036854775807</INTEGER>", 0);
412 CHECK_XER(-1, "<INTEGER>500223372036854775807</INTEGER>", 0);
413 CHECK_XER(0, "<INTEGER>-9223372036854775808</INTEGER>", -9223372036854775807-1);
414 CHECK_XER(-1, "<INTEGER>-9223372036854775809</INTEGER>", 0);
415 CHECK_XER(-1, "<INTEGER>-10223372036854775807</INTEGER>", 0);
416 CHECK_XER(-1, "<INTEGER>-50223372036854775807</INTEGER>", 0);
417 CHECK_XER(-1, "<INTEGER>-100223372036854775807</INTEGER>", 0);
418 CHECK_XER(-1, "<INTEGER>-500223372036854775807</INTEGER>", 0);
419 } else {
420 assert(sizeof(long) == 8);
421 }
422#endif
Lev Walkin0be3a992004-10-21 12:11:57 +0000423
Lev Walkin6495ca52019-08-10 20:07:39 -0700424 check_strtoimax();
425 check_strtoimax_span();
426
Lev Walkinf15320b2004-06-03 03:38:44 +0000427 return 0;
428}