2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
10 #include <aros/debug.h>
12 #define TESTNUMBER1 11
13 #define TESTNUMBER1STRLEN 2
14 #define TEST1RESULT "11"
15 #define TEST2RESULT "11"
16 #define TEST3RESULT "11"
20 static const char TEST4RESULT
[] = {-1, ' ', 'e', 't', 'c', '.', '\0'};
24 static void cleanbuffer(char * buf
)
26 memset(buf
, 0xff, BUFSIZE
);
29 static int stringsame(const char *c1
, const char *c2
, int size
)
32 for(i
= 0; i
< size
; i
++)
33 if (c1
[i
] != c2
[i
]) return 0;
39 char buf
[BUFSIZE
], high_ch
= TEST4CHAR
;
41 long long n2
= TESTNUMBER1
;
42 long long n3
= TESTNUMBER1
;
44 /* check standard %d conversion */
46 TEST((sprintf(buf
, "%d", n1
) == TESTNUMBER1STRLEN
));
47 TEST((stringsame(buf
, TEST1RESULT
, TESTNUMBER1STRLEN
) == 1));
49 /* check standard %qd conversion */
51 TEST((sprintf(buf
, "%qd", n2
) == TESTNUMBER1STRLEN
));
52 TEST((stringsame(buf
, TEST2RESULT
, TESTNUMBER1STRLEN
) == 1));
54 /* check standard %lld conversion */
56 TEST((sprintf(buf
, "%lld", n3
) == TESTNUMBER1STRLEN
));
57 TEST((stringsame(buf
, TEST3RESULT
, TESTNUMBER1STRLEN
) == 1));
59 /* check standard %c insertion */
61 TEST((sprintf(buf
, "%c etc.", high_ch
) == TEST4STRLEN
));
62 TEST((stringsame(buf
, TEST4RESULT
, TEST4STRLEN
) == 1));