2.9
[glibc/nacl-glibc.git] / localedata / tests-mbwc / tst_towctrans.c
blob1d874dc0f71762058d63d6a93dd7dbf79cf78beb
1 /*
2 TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc);
3 */
5 #define TST_FUNCTION towctrans
7 #include "tsp_common.c"
8 #include "dat_towctrans.c"
11 int
12 tst_towctrans (FILE *fp, int debug_flg)
14 TST_DECL_VARS (wint_t);
15 wint_t wc;
16 const char *ts;
17 #if SHOJI_IS_RIGHT
18 int dummy=0;
19 #endif
20 wctrans_t wto;
22 TST_DO_TEST (towctrans)
24 TST_HEAD_LOCALE (towctrans, S_TOWCTRANS);
25 TST_DO_REC (towctrans)
27 TST_GET_ERRET (towctrans);
28 wc = TST_INPUT (towctrans).wc;
29 ts = TST_INPUT (towctrans).ts;
31 #if SHOJI_IS_RIGHT
32 if ((wto = wctrans (ts)) == (wctrans_t) 0)
34 #if 0
35 result (fp, C_IGNORED, S_TOWCTRANS, locale, rec+1, seq_num+1, 3,
36 "Skip this data because the wctrans object is not invalid.");
37 warn_count++;
38 continue;
39 #else
40 wto = &dummy; /* not good ... */
41 #endif
42 if (debug_flg)
44 fprintf (stdout, "towctrans() ------ wctrans() returnd 0.\n");
47 #else
48 wto = wctrans (ts);
49 #endif
51 TST_CLEAR_ERRNO;
52 ret = towctrans (wc, wto);
53 TST_SAVE_ERRNO;
55 if (debug_flg)
57 fprintf (stdout, "towctrans() [ %s : %d ] ret = 0x%x\n",
58 locale, rec+1, ret);
59 fprintf (stdout, " errno = %d\n",
60 errno_save);
63 TST_IF_RETURN (S_TOWCTRANS)
65 if (ret != 0)
67 result (fp, C_SUCCESS, S_TOWCTRANS, locale, rec+1,
68 seq_num+1, 3, MS_PASSED);
70 else
72 err_count++;
73 result (fp, C_FAILURE, S_TOWCTRANS, locale, rec+1,
74 seq_num+1, 3,
75 "the function returned 0, but should be non-zero");
81 return err_count;