2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
10 #define TESTNUMBER1 11
11 #define TESTNUMBER1STRLEN 2
12 #define TEST1RESULT "11"
13 #define TEST2RESULT "11"
14 #define TEST3RESULT "11"
18 static const char TEST4RESULT
[] = {-1, ' ', 'e', 't', 'c', '.', '\0'};
22 static void cleanbuffer(char * buf
)
24 memset(buf
, 0xff, BUFSIZE
);
27 static int stringsame(const char *c1
, const char *c2
, int size
)
30 for(i
= 0; i
< size
; i
++)
31 if (c1
[i
] != c2
[i
]) return 0;
37 char buf
[BUFSIZE
], high_ch
= TEST4CHAR
;
39 long long n2
= TESTNUMBER1
;
40 long long n3
= TESTNUMBER1
;
42 /* check standard %d conversion */
44 TEST((sprintf(buf
, "%d", n1
) == TESTNUMBER1STRLEN
));
45 TEST((stringsame(buf
, TEST1RESULT
, TESTNUMBER1STRLEN
) == 1));
47 /* check standard %qd conversion */
49 TEST((sprintf(buf
, "%qd", n2
) == TESTNUMBER1STRLEN
));
50 TEST((stringsame(buf
, TEST2RESULT
, TESTNUMBER1STRLEN
) == 1));
52 /* check standard %lld conversion */
54 TEST((sprintf(buf
, "%lld", n3
) == TESTNUMBER1STRLEN
));
55 TEST((stringsame(buf
, TEST3RESULT
, TESTNUMBER1STRLEN
) == 1));
57 /* check standard %c insertion */
59 TEST((sprintf(buf
, "%c etc.", high_ch
) == TEST4STRLEN
));
60 TEST((stringsame(buf
, TEST4RESULT
, TEST4STRLEN
) == 1));