ubacktrace/uargp: remove unneeded and false linker scripts
[uclibc-ng.git] / test / locale-mbwc / dat_wctomb.c
blob0ec3a9c0d065b00c902833b5754e781303a9a5ad
1 /*
2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
4 * FILE: dat_wctomb.c
6 * WCTOMB: int wctomb (char *s, wchar_t wc)
7 */
11 * FUNCTION:
13 * int wctomb (char *s, wchar_t wc);
15 * return: the number of bytes
17 * NOTE:
19 * o When you feed a null pointer for a string (s) to the function,
20 * set s_flg=0 instead of putting just a 'NULL' there.
21 * Even if you put a 'NULL', it means a null string as well as "".
23 * o When s is a null pointer, the function checks state dependency.
25 * state-dependent encoding - return NON-zero
26 * state-independent encoding - return 0
28 * If state-dependent encoding is expected, set
30 * s_flg = 0, ret_flg = 0, ret_val = +1
32 * If state-independent encoding is expected, set
34 * s_flg = 0, ret_flg = 0, ret_val = 0
37 * When you set ret_flg=1, the test program simply compares an
38 * actual return value with an expected value. You can check
39 * state-independent case (return value is 0) in that way, but
40 * you can not check state-dependent case. So when you check
41 * state- dependency in this test function: tst_wctomb(), set
42 * ret_flg=0 always. It's a special case, and the test
43 * function takes care of it.
45 * Input Expect
47 * s_flg=0 ret_flg=0
48 * | |
49 * { 0, 0 }, { 0, 0, 0, x, "" }
50 * | |
51 * not used ret_val: 0/+1
52 * (expected val)
56 TST_WCTOMB tst_wctomb_loc [] = {
58 { Twctomb, TST_LOC_de },
60 /* #01 : normal case */
61 { /*input.*/ { 1, 0x00C4 },
62 /*expect*/ { 0,1,1, "Ä" },
64 /* #02 : normal case */
65 { /*input.*/ { 1, 0x00DC },
66 /*expect*/ { 0,1,1, "Ü" },
68 /* #03 : normal case */
69 { /*input.*/ { 1, 0x0092 },
70 /*expect*/ { 0,1,1, "\222" },
72 /* #04 : error case */
73 { /*input.*/ { 1, 0x3041 },
74 /*expect*/ { 0,1,-1, "" },
76 /* #05 : state dependency */
77 { /*input.*/ { 0, 0x0000 },
78 /*expect*/ { 0,0,0, "" },
80 { .is_last = 1 }
84 { Twctomb, TST_LOC_enUS },
86 /* #01 : normal case */
87 { /*input.*/ { 1, 0x0041 },
88 /*expect*/ { 0,1,1, "A" },
90 /* #02 : normal case */
91 { /*input.*/ { 1, 0x0042 },
92 /*expect*/ { 0,1,1, "B" },
94 /* #03 : error case */
95 /* <WAIVER> */
96 { /*input.*/ { 1, 0x00C4 },
97 /*expect*/ { 0,1,-1, "" },
99 /* #04 : error case */
100 { /*input.*/ { 1, 0x30A4 },
101 /*expect*/ { 0,1,-1, "" },
103 /* #05 : state dependency */
104 { /*input.*/ { 0, 0x0000 },
105 /*expect*/ { 0,0,0, "" },
107 { .is_last = 1 }
110 #if 0
112 { Twctomb, TST_LOC_eucJP },
114 /* #01 : normal case */
115 { /*input.*/ { 1, 0x3042 },
116 /*expect*/ { 0,1,2, "\244\242" },
118 /* #02 : normal case */
119 { /*input.*/ { 1, 0x3044 },
120 /*expect*/ { 0,1,2, "\244\244" },
122 /* #03 : normal case */
123 { /*input.*/ { 1, 0x008E },
124 /*expect*/ { 0,1,-1, "" },
126 /* #04 : jisX0212 */
127 { /*input.*/ { 1, 0x00C4 },
128 /*expect*/ { 0,1,3, "\217\252\243" }, /* jisx0210 returns 3 */
130 /* #05 : state dependency */
131 { /*input.*/ { 0, 0x008E },
132 /*expect*/ { 0,0,0, "" },
134 { .is_last = 1 }
137 #else
139 { Twctomb, TST_LOC_ja_UTF8 },
141 /* #01 : normal case */
142 { /*input.*/ { 1, 0x3042 },
143 /*expect*/ { 0,1,3, "\343\201\202" },
145 /* #02 : normal case */
146 { /*input.*/ { 1, 0x3044 },
147 /*expect*/ { 0,1,3, "\343\201\204" },
149 /* #03 : normal case */
150 { /*input.*/ { 1, 0x008E },
151 /*expect*/ { 0,1,2, "\302\216" },
153 /* #04 : jisX0212 */
154 { /*input.*/ { 1, 0x00C4 },
155 /*expect*/ { 0,1,2, "\303\204" }, /* jisx0210 returns 3 */
157 /* #05 : state dependency */
158 { /*input.*/ { 0, 0x008E },
159 /*expect*/ { 0,0,0, "" },
161 { .is_last = 1 }
164 #endif
166 { Twctomb, TST_LOC_end }