2
$Id: strtoul-3.c,v 1.1 2007/02/07 13:42:36 dmix Exp $
11
PROGMEM static struct t_s {
12
char s[35]; /* string to convert */
14
unsigned long ret; /* result must */
15
int err; /* errno must */
16
unsigned char len; /* endptr displacement must */
21
{ "-1", 2, -1, 0, 2 },
22
{ "10101010", 2, 0xaa, 0, 8 },
24
{ "1111111111111111111111111111110", 2, 0x7ffffffe, 0, 31 },
25
{ "1111111111111111111111111111111", 2, 0x7fffffff, 0, 31 },
26
{ "10000000000000000000000000000000", 2, 0x80000000, 0, 32 },
27
{ "10000000000000000000000000000001", 2, 0x80000001, 0, 32 },
28
{ "11111111111111111111111111111111", 2, 0xffffffff, 0, 32 },
29
{ "100000000000000000000000000000000", 2, 0xffffffff, ERANGE, 33 },
30
{ "100000000000000000000000000000001", 2, 0xffffffff, ERANGE, 33 },
32
{ "-1111111111111111111111111111111", 2, 0x80000001, 0, 32 },
33
{ "-10000000000000000000000000000000", 2, 0x80000000, 0, 33 },
34
{ "-10000000000000000000000000000001", 2, 0x7fffffff, 0, 33 },
35
{ "-10000000000000000000000000000010", 2, 0x7ffffffe, 0, 33 },
36
{ "-11111111111111111111111111111111", 2, 0x00000001, 0, 33 },
37
{ "-100000000000000000000000000000000", 2, 0xffffffff, ERANGE, 34 },
38
{ "-100000000000000000000000000000001", 2, 0xffffffff, ERANGE, 34 },
44
for (i = 0; i != (int)(sizeof(t)/sizeof(t[0])); i++) {
46
memcpy_P (&tt, t + i, sizeof(tt));
48
if (t_strtoul (p->s, p->base, p->ret, p->err, p->len))