1 /* 2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY 3 * 4 * FILE: dat_wcswidth.c 5 * 6 * WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n); 7 */ 8 9 TST_WCSWIDTH tst_wcswidth_loc [] = { 10 { 11 { Twcswidth, TST_LOC_de }, 12 { 13 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0 }, /* 01 */ 14 /*expect*/ { 0,1,0 }, 15 }, 16 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 1 }, /* 02 */ 17 /*expect*/ { 0,1,1 }, 18 }, 19 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 2 }, /* 03 */ 20 /*expect*/ { 0,1,2 }, 21 }, 22 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 3 }, /* 04 */ 23 /*expect*/ { 0,1,3 }, 24 }, 25 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 4 }, /* 05 */ 26 /*expect*/ { 0,1,3 }, 27 }, 28 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */ 29 /*expect*/ { 0,1,0 }, 30 }, 31 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 07 */ 32 /*expect*/ { 0,1,-1 }, 33 }, 34 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 1 }, /* 08 */ 35 /*expect*/ { 0,1,1 }, 36 }, 37 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 09 */ 38 /*expect*/ { 0,1,-1 }, 39 }, 40 { /*input.*/ { { 0x00C1,0x0092,0x0000 }, 2 }, /* 10 */ 41 /*expect*/ { 0,1,-1 }, 42 }, 43 { /*input.*/ { { 0x00C1,0x0020,0x0000 }, 2 }, /* 11 */ 44 /*expect*/ { 0,1,2 }, 45 }, 46 { /*input.*/ { { 0x00C1,0x0021,0x0000 }, 2 }, /* 12 */ 47 /*expect*/ { 0,1,2 }, 48 }, 49 { /*input.*/ { { 0x00C1,0x007E,0x0000 }, 2 }, /* 13 */ 50 /*expect*/ { 0,1,2 }, 51 }, 52 { /*input.*/ { { 0x00C1,0x007F,0x0000 }, 2 }, /* 14 */ 53 /*expect*/ { 0,1,-1 }, 54 }, 55 { /*input.*/ { { 0x00C1,0x0080,0x0000 }, 2 }, /* 15 */ 56 /*expect*/ { 0,1,-1 }, 57 }, 58 { /*input.*/ { { 0x00C1,0x00A0,0x0000 }, 2 }, /* 16 */ 59 #ifdef SHOJI_IS_RIGHT 60 /*expect*/ { 0,1,-1 }, 61 #else 62 /*expect*/ { 0,1,2 }, 63 #endif 64 }, 65 { /*input.*/ { { 0x00C1,0x00A1,0x0000 }, 2 }, /* 17 */ 66 /*expect*/ { 0,1,2 }, 67 }, 68 { /*input.*/ { { 0x00C1,0x00FF,0x0000 }, 2 }, /* 18 */ 69 /*expect*/ { 0,1,2 }, 70 }, 71 { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */ 72 /*expect*/ { 0,1,-1 }, 73 }, 74 { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */ 75 /*expect*/ { 0,1,-1 }, 76 }, 77 { .is_last = 1 } 78 } 79 }, 80 { 81 { Twcswidth, TST_LOC_enUS }, 82 { 83 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 0 }, /* 01 */ 84 /*expect*/ { 0,1,0 }, 85 }, 86 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 1 }, /* 02 */ 87 /*expect*/ { 0,1,1 }, 88 }, 89 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 2 }, /* 03 */ 90 /*expect*/ { 0,1,2 }, 91 }, 92 #ifdef SHOJI_IS_RIGHT 93 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */ 94 /*expect*/ { 0,1,3 }, 95 }, 96 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 4 }, /* 05 */ 97 /*expect*/ { 0,1,3 }, 98 }, 99 #else 100 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */ 101 /*expect*/ { 0,1,-1 }, 102 }, 103 { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* 05 */ 104 /*expect*/ { 0,1,3 }, 105 }, 106 #endif 107 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */ 108 /*expect*/ { 0,1,0 }, 109 }, 110 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 07 */ 111 /*expect*/ { 0,1,-1 }, 112 }, 113 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 1 }, /* 08 */ 114 /*expect*/ { 0,1,1 }, 115 }, 116 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 09 */ 117 /*expect*/ { 0,1,-1 }, 118 }, 119 { /*input.*/ { { 0x0041,0x0092,0x0000 }, 2 }, /* 10 */ 120 /*expect*/ { 0,1,-1 }, 121 }, 122 { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 11 */ 123 /*expect*/ { 0,1,2 }, 124 }, 125 { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */ 126 /*expect*/ { 0,1,2 }, 127 }, 128 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */ 129 /*expect*/ { 0,1,2 }, 130 }, 131 { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */ 132 /*expect*/ { 0,1,-1 }, 133 }, 134 { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */ 135 /*expect*/ { 0,1,-1 }, 136 }, 137 { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */ 138 /*expect*/ { 0,1,-1 }, 139 }, 140 #ifdef SHOJI_IS_RIGHT 141 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ 142 /*expect*/ { 0,1,2 }, 143 }, 144 { /*input.*/ { { 0x0041,0x00FF,0x0000 }, 2 }, /* 18 */ 145 /*expect*/ { 0,1,2 }, 146 }, 147 #else 148 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 17 */ 149 /*expect*/ { 0,1,2 }, 150 }, 151 { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 18 */ 152 /*expect*/ { 0,1,2 }, 153 }, 154 #endif 155 { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */ 156 /*expect*/ { 0,1,-1 }, 157 }, 158 { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */ 159 /*expect*/ { 0,1,-1 }, 160 }, 161 { .is_last = 1 } 162 } 163 }, 164 { 165 #if 0 166 { Twcswidth, TST_LOC_eucJP }, 167 #else 168 { Twcswidth, TST_LOC_ja_UTF8 }, 169 #endif 170 { 171 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0 }, /* 01 */ 172 /*expect*/ { 0,1,0 }, 173 }, 174 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 1 }, /* 02 */ 175 /*expect*/ { 0,1,2 }, 176 }, 177 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* 03 */ 178 /*expect*/ { 0,1,4 }, 179 }, 180 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* 04 */ 181 /*expect*/ { 0,1,6 }, 182 }, 183 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* 05 */ 184 /*expect*/ { 0,1,6 }, 185 }, 186 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */ 187 /*expect*/ { 0,1,0 }, 188 }, 189 { /*input.*/ { { 0x008E,0x0001,0x0000 }, 2 }, /* 07 */ 190 /*expect*/ { 0,1,-1 }, 191 }, 192 { /*input.*/ { { 0x3041,0x008E,0x0000 }, 1 }, /* 08 */ 193 /*expect*/ { 0,1,2 }, 194 }, 195 { /*input.*/ { { 0x3041,0x008E,0x0000 }, 2 }, /* 09 */ 196 /*expect*/ { 0,1,-1 }, 197 }, 198 { /*input.*/ { { 0x3041,0x0001,0x0000 }, 2 }, /* 10 */ 199 /*expect*/ { 0,1,-1 }, 200 }, 201 { /*input.*/ { { 0x3041,0x3000,0x0000 }, 2 }, /* 11 */ 202 /*expect*/ { 0,1,4 }, 203 }, 204 { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */ 205 /*expect*/ { 0,1,2 }, 206 }, 207 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */ 208 /*expect*/ { 0,1,2 }, 209 }, 210 { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */ 211 /*expect*/ { 0,1,-1 }, 212 }, 213 { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */ 214 /*expect*/ { 0,1,-1 }, 215 }, 216 #if 0 217 { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */ 218 /*expect*/ { 0,1,-1 }, 219 }, 220 #ifdef NO_WAIVER 221 /* <NO_WAIVER> */ /* returns 3 */ 222 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ 223 /*expect*/ { 0,1,-1 }, 224 }, 225 #else 226 /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */ 227 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ 228 /*expect*/ { 0,1,3 }, 229 }, 230 #endif 231 #else 232 /* XXX U00A0 i UTF8 is valid -> /xc2/xa0 */ 233 { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */ 234 /*expect*/ { 0,1,2 }, 235 }, 236 #ifdef NO_WAIVER 237 /* <NO_WAIVER> */ /* returns 3 */ 238 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ 239 /*expect*/ { 0,1,-1 }, 240 }, 241 #else 242 /* XXX U00A1 in UTF-8 is valid -> /xc2/xa1 */ 243 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ 244 /*expect*/ { 0,1,2 }, 245 }, 246 #endif 247 #endif 248 { /*input.*/ { { 0x0041,0xFF71,0x0000 }, 2 }, /* 18 */ 249 /*expect*/ { 0,1,2 }, 250 }, 251 { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */ 252 /*expect*/ { 0,1,3 }, 253 }, 254 { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */ 255 /*expect*/ { 0,1,3 }, 256 }, 257 { .is_last = 1 } 258 } 259 }, 260 { 261 { Twcswidth, TST_LOC_end } 262 } 263 }; 264