Installed header hygiene (BZ#20366): Test of installed headers.
[glibc.git] / localedata / tests-mbwc / tsp_common.c
blobcd88274c570766259178832bcc8f85d81692fb5c
1 /*
2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
3 * Main driver
4 */
7 #define TST_FUNCTION_CALL(func) _TST_FUNCTION_CALL(func)
8 #define _TST_FUNCTION_CALL(func) tst ##_## func
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <locale.h>
14 #include <errno.h>
15 #include <signal.h>
17 #include "tst_types.h"
18 #include "tgn_locdef.h"
21 int
22 main (int argc, char *argv[])
24 int ret;
25 int debug;
27 debug = argc > 1 ? atoi (argv[1]) : 0;
29 if (debug)
31 fprintf (stdout, "\nTST_MBWC ===> %s ...\n", argv[0]);
33 ret = TST_FUNCTION_CALL (TST_FUNCTION) (stdout, debug);
35 return (ret != 0);
38 #define MAX_RESULT_REC 132
39 char result_rec[MAX_RESULT_REC];
42 int
43 result (FILE * fp, char res, const char *func, const char *loc, int rec_no,
44 int seq_no, int case_no, const char *msg)
46 if (fp == NULL
47 || strlen (func) + strlen (loc) + strlen (msg) + 32 > MAX_RESULT_REC)
49 fprintf (stderr,
50 "Warning: result(): can't write the result: %s:%s:%d:%d:%s\n",
51 func, loc, rec_no, case_no, msg);
52 return 0;
55 sprintf (result_rec, "%s:%s:%d:%d:%d:%c:%s\n", func, loc, rec_no, seq_no,
56 case_no, res, msg);
58 if (fputs (result_rec, fp) == EOF)
60 return 0;
63 return 1;