Add 16922 to list of bugs fixed.
[glibc.git] / localedata / tests-mbwc / tst_mbrlen.c
blobb8681b7215f4d20b2f73b33cbda77fabc28e4a9c
1 /*
2 MBRLEN: size_t mbrlen (char *s, size_t n, mbstate_t *ps)
3 */
5 #define TST_FUNCTION mbrlen
7 #include "tsp_common.c"
8 #include "dat_mbrlen.c"
11 int
12 tst_mbrlen (FILE * fp, int debug_flg)
14 TST_DECL_VARS (size_t);
15 char s_flg;
16 const char *s_in;
17 size_t n;
18 char t_flg;
19 char t_ini;
20 static mbstate_t s = { 0 };
21 mbstate_t *ps;
23 TST_DO_TEST (mbrlen)
25 TST_HEAD_LOCALE (mbrlen, S_MBRLEN);
26 TST_DO_REC (mbrlen)
28 if (mbrlen (NULL, 0, &s) != 0)
30 err_count++;
31 Result (C_FAILURE, S_MBRLEN, CASE_3,
32 "Initialization (external mbstate object) failed "
33 "- skipped this test case.");
34 continue;
37 TST_DO_SEQ (MBRLEN_SEQNUM)
39 TST_GET_ERRET_SEQ (mbrlen);
40 s_flg = TST_INPUT_SEQ (mbrlen).s_flg;
41 s_in = TST_INPUT_SEQ (mbrlen).s;
42 n = TST_INPUT_SEQ (mbrlen).n;
43 t_flg = TST_INPUT_SEQ (mbrlen).t_flg;
44 t_ini = TST_INPUT_SEQ (mbrlen).t_init;
45 if (s_flg == 0)
47 s_in = NULL;
50 if (n == USE_MBCURMAX) /* rewrite tst_mblen() like this */
52 n = MB_CUR_MAX;
55 ps = (t_flg == 0) ? NULL : &s;
57 if (t_ini != 0)
59 memset (&s, 0, sizeof (s));
60 mbrlen (NULL, 0, NULL);
63 TST_CLEAR_ERRNO;
64 ret = mbrlen (s_in, n, ps);
65 TST_SAVE_ERRNO;
67 if (debug_flg)
69 fprintf (stdout, "mbrlen() [ %s : %d : %d ] ret = %zd\n",
70 locale, rec + 1, seq_num + 1, ret);
71 fprintf (stdout, " errno = %d\n", errno_save);
74 TST_IF_RETURN (S_MBRLEN)
81 return err_count;