Fixed compatibility of output.
[AROS.git] / test / clib / strtol.c
blob818b3e4e1c4bf74bb8082de3c96180da76b07def
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <errno.h>
9 #include "test.h"
11 int main(void)
13 TEST((strtol("0xff", NULL, 0) == 255UL))
14 TEST((strtol("0xff", NULL, 16) == 255UL))
15 TEST((strtol("0x0", NULL, 0) == 0UL))
16 TEST((strtol("0x0", NULL, 16) == 0UL))
17 TEST((strtol("0", NULL, 0) == 0UL))
18 TEST((strtol("0", NULL, 16) == 0UL))
19 TEST((strtol("0x0 ", NULL, 0) == 0UL))
20 TEST((strtol("0x0 ", NULL, 16) == 0UL))
21 TEST((strtol("0 ", NULL, 0) == 0UL))
22 TEST((strtol("0 ", NULL, 16) == 0UL))
23 TEST((strtol("0377", NULL, 0) == 255UL))
24 TEST((strtol("255", NULL, 0) == 255UL))
25 TEST((strtol("-1", NULL, 0) == -1UL))
26 TEST((strtol("-0xff", NULL, 0) == -255UL))
27 TEST((strtol("-0xff", NULL, 16) == -255UL))
28 TEST((strtol("-ff", NULL, 16) == -255UL))
29 TEST((strtol("-0377", NULL, 0) == -255UL))
30 TEST((strtol("-377", NULL, 8) == -255UL))
31 TEST((strtol("0x7FFFFFFE", NULL, 16) == 0x7FFFFFFE))
32 errno = 0;
33 TEST((strtol("0xFFFFFFFE", NULL, 16) == 0xFFFFFFFE || errno == ERANGE))
34 return OK;
37 void cleanup(void)