|
0
|
1 #include "printf.h"
|
|
|
2
|
|
|
3 #include <locale.h>
|
|
|
4 #include <stdlib.h> /* malloc */
|
|
|
5 #include <limits.h>
|
|
|
6 #include <stdint.h>
|
|
|
7 #include <float.h>
|
|
|
8
|
|
|
9 int test_fprintf(void);
|
|
|
10 int test_asprintf(void);
|
|
|
11 int test_snprintf(void);
|
|
|
12
|
|
|
13 int main(void)
|
|
|
14 {
|
|
|
15 /* :p */
|
|
|
16 setlocale(LC_ALL, "C.UTF-8");
|
|
|
17
|
|
|
18 if (test_asprintf() != 0) {
|
|
|
19 fprintf(stderr, "asprintf test failed!\n");
|
|
|
20 return 1;
|
|
|
21 }
|
|
|
22
|
|
|
23 if (test_snprintf() != 0) {
|
|
|
24 fprintf(stderr, "snprintf test failed!\n");
|
|
|
25 return 1;
|
|
|
26 }
|
|
|
27
|
|
|
28 if (test_fprintf() != 0) {
|
|
|
29 fprintf(stderr, "fprintf test failed!\n");
|
|
|
30 return 1;
|
|
|
31 }
|
|
|
32
|
|
|
33 /* print this too... */
|
|
|
34 my_printf(
|
|
|
35 #include "test.h"
|
|
|
36 );
|
|
|
37
|
|
|
38 printf("All tests succeeded.\n");
|
|
|
39 return 0;
|
|
|
40 } |