6 #define TESTNUMBER1STRLEN 2
7 #define TEST1RESULT "11"
8 #define TEST2RESULT "11"
9 #define TEST3RESULT "11"
13 static void cleanbuffer(char * buf
)
15 memset(buf
, 0xff, BUFSIZE
);
18 static int stringsame(char * c1
, char * c2
, int size
)
21 for(i
= 0; i
< size
; i
++)
22 if (c1
[i
] != c2
[i
]) return 0;
30 long long n2
= TESTNUMBER1
;
31 long long n3
= TESTNUMBER1
;
34 /* check standard %d conversion */
36 TEST((sprintf(buf
, "%d", n1
) == TESTNUMBER1STRLEN
));
37 TEST((stringsame(buf
, TEST1RESULT
, TESTNUMBER1STRLEN
) == 1));
39 /* check standard %qd conversion */
41 TEST((sprintf(buf
, "%qd", n2
) == TESTNUMBER1STRLEN
));
42 TEST((stringsame(buf
, TEST2RESULT
, TESTNUMBER1STRLEN
) == 1));
44 /* check standard %lld conversion */
46 TEST((sprintf(buf
, "%lld", n3
) == TESTNUMBER1STRLEN
));
47 TEST((stringsame(buf
, TEST3RESULT
, TESTNUMBER1STRLEN
) == 1));