2 WCTOMB: int wctomb (char *s, wchar_t wc)
5 #define TST_FUNCTION wctomb
7 #include "tsp_common.c"
8 #include "dat_wctomb.c"
11 tst_wctomb (FILE * fp
, int debug_flg
)
15 char s
[MBSSIZE
], *s_in
, *s_ex
;
20 TST_HEAD_LOCALE (wctomb
, S_WCTOMB
);
23 TST_GET_ERRET (wctomb
);
24 wc
= TST_INPUT (wctomb
).wc
;
25 s_in
= ((TST_INPUT (wctomb
).s_flg
) == 0) ? (char *) NULL
: s
;
26 ret
= wctomb (s_in
, wc
);
30 fprintf (stdout
, "wctomb() [ %s : %d ] ret = %d\n", locale
,
34 TST_IF_RETURN (S_WCTOMB
)
36 if (s_in
== NULL
) /* state dependency */
38 if (ret_exp
== +1) /* state-dependent */
42 /* Non-zero means state-dependent encoding. */
43 Result (C_SUCCESS
, S_WCTOMB
, CASE_3
, MS_PASSED
);
48 Result (C_FAILURE
, S_WCTOMB
, CASE_3
,
49 "should be state-dependent encoding, "
50 "but a return value shows it is "
55 if (ret_exp
== 0) /* state-independent */
59 /* Non-zero means state-dependent encoding. */
60 Result (C_SUCCESS
, S_WCTOMB
, CASE_3
, MS_PASSED
);
65 Result (C_FAILURE
, S_WCTOMB
, CASE_3
,
66 "should be state-independent encoding, "
67 "but a return value shows it is state-dependent");
73 s_ex
= TST_EXPECT (wctomb
).s
;
77 for (i
= 0, err
= 0; *(s_ex
+ i
) != 0 && i
< MBSSIZE
; i
++)
79 if (s_in
[i
] != s_ex
[i
])
83 Result (C_FAILURE
, S_WCTOMB
, CASE_4
,
84 "copied string is different from an"
92 Result (C_SUCCESS
, S_WCTOMB
, CASE_4
, MS_PASSED
);