2 * Unit test suite for locale functions.
4 * Copyright 2010 Piotr Caban for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/test.h"
26 static BOOL (__cdecl *p__crtGetStringTypeW)(DWORD, DWORD, const wchar_t*, int, WORD*);
27 static int (__cdecl *pmemcpy_s)(void *, size_t, void*, size_t);
29 static void init(void)
31 HMODULE hmod = GetModuleHandleA("msvcrt.dll");
33 p__crtGetStringTypeW = (void*)GetProcAddress(hmod, "__crtGetStringTypeW");
34 pmemcpy_s = (void*)GetProcAddress(hmod, "memcpy_s");
37 static void test_setlocale(void)
39 static const char lc_all[] = "LC_COLLATE=C;LC_CTYPE=C;"
40 "LC_MONETARY=Greek_Greece.1253;LC_NUMERIC=Polish_Poland.1250;LC_TIME=C";
44 ret = setlocale(20, "C");
45 ok(ret == NULL, "ret = %s\n", ret);
47 ret = setlocale(LC_ALL, "");
48 ok(ret != NULL, "ret == NULL\n");
50 ret = setlocale(LC_ALL, "C");
51 ok(!strcmp(ret, "C"), "ret = %s\n", ret);
53 ret = setlocale(LC_ALL, NULL);
54 ok(!strcmp(ret, "C"), "ret = %s\n", ret);
56 if(!setlocale(LC_NUMERIC, "Polish")
57 || !setlocale(LC_NUMERIC, "Greek")
58 || !setlocale(LC_NUMERIC, "German")
59 || !setlocale(LC_NUMERIC, "English")) {
60 win_skip("System with limited locales\n");
64 ret = setlocale(LC_NUMERIC, "Polish");
65 ok(!strcmp(ret, "Polish_Poland.1250"), "ret = %s\n", ret);
67 ret = setlocale(LC_MONETARY, "Greek");
68 ok(!strcmp(ret, "Greek_Greece.1253"), "ret = %s\n", ret);
70 ret = setlocale(LC_ALL, NULL);
71 ok(!strcmp(ret, lc_all), "ret = %s\n", ret);
74 ret = setlocale(LC_ALL, buf);
75 ok(!strcmp(ret, lc_all), "ret = %s\n", ret);
77 ret = setlocale(LC_ALL, "German");
78 ok(!strcmp(ret, "German_Germany.1252"), "ret = %s\n", ret);
80 ret = setlocale(LC_ALL, "american");
81 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
83 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
85 ret = setlocale(LC_ALL, "american english");
86 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
88 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
90 ret = setlocale(LC_ALL, "american-english");
91 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
93 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
95 ret = setlocale(LC_ALL, "australian");
96 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
98 ok(!strcmp(ret, "English_Australia.1252"), "ret = %s\n", ret);
100 ret = setlocale(LC_ALL, "belgian");
101 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
103 ok(!strcmp(ret, "Dutch_Belgium.1252"), "ret = %s\n", ret);
105 ret = setlocale(LC_ALL, "canadian");
106 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
108 ok(!strcmp(ret, "English_Canada.1252"), "ret = %s\n", ret);
110 ret = setlocale(LC_ALL, "chinese");
111 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
113 ok(!strcmp(ret, "Chinese (Simplified)_People's Republic of China.936")
114 || broken(!strcmp(ret, "Chinese_Taiwan.950")), "ret = %s\n", ret);
116 ret = setlocale(LC_ALL, "chinese-simplified");
117 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
119 ok(!strcmp(ret, "Chinese (Simplified)_People's Republic of China.936")
120 || broken(!strcmp(ret, "Chinese_People's Republic of China.936"))
121 || broken(!strcmp(ret, "Chinese_Taiwan.950")), "ret = %s\n", ret);
123 ret = setlocale(LC_ALL, "chinese-traditional");
124 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
126 ok(!strcmp(ret, "Chinese (Traditional)_Taiwan.950")
127 || broken(!strcmp(ret, "Chinese_Taiwan.950")), "ret = %s\n", ret);
129 ret = setlocale(LC_ALL, "chs");
130 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
132 ok(!strcmp(ret, "Chinese (Simplified)_People's Republic of China.936")
133 || broken(!strcmp(ret, "Chinese_People's Republic of China.936")), "ret = %s\n", ret);
135 ret = setlocale(LC_ALL, "cht");
136 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
138 ok(!strcmp(ret, "Chinese (Traditional)_Taiwan.950")
139 || broken(!strcmp(ret, "Chinese_Taiwan.950")), "ret = %s\n", ret);
141 ret = setlocale(LC_ALL, "csy");
142 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
144 ok(!strcmp(ret, "Czech_Czech Republic.1250"), "ret = %s\n", ret);
146 ret = setlocale(LC_ALL, "czech");
147 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
149 ok(!strcmp(ret, "Czech_Czech Republic.1250"), "ret = %s\n", ret);
151 ret = setlocale(LC_ALL, "dan");
152 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
154 ok(!strcmp(ret, "Danish_Denmark.1252"), "ret = %s\n", ret);
156 ret = setlocale(LC_ALL, "danish");
157 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
159 ok(!strcmp(ret, "Danish_Denmark.1252"), "ret = %s\n", ret);
161 ret = setlocale(LC_ALL, "dea");
162 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
164 ok(!strcmp(ret, "German_Austria.1252"), "ret = %s\n", ret);
166 ret = setlocale(LC_ALL, "des");
167 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
169 ok(!strcmp(ret, "German_Switzerland.1252"), "ret = %s\n", ret);
171 ret = setlocale(LC_ALL, "deu");
172 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
174 ok(!strcmp(ret, "German_Germany.1252"), "ret = %s\n", ret);
176 ret = setlocale(LC_ALL, "dutch");
177 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
179 ok(!strcmp(ret, "Dutch_Netherlands.1252"), "ret = %s\n", ret);
181 ret = setlocale(LC_ALL, "dutch-belgian");
182 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
184 ok(!strcmp(ret, "Dutch_Belgium.1252")
185 || broken(!strcmp(ret, "Dutch_Netherlands.1252")), "ret = %s\n", ret);
187 ret = setlocale(LC_ALL, "ena");
188 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
190 ok(!strcmp(ret, "English_Australia.1252")
191 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
193 ret = setlocale(LC_ALL, "ell");
194 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
196 ok(!strcmp(ret, "Greek_Greece.1253"), "ret = %s\n", ret);
198 ret = setlocale(LC_ALL, "enc");
199 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
201 ok(!strcmp(ret, "English_Canada.1252")
202 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
204 ret = setlocale(LC_ALL, "eng");
205 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
207 ok(!strcmp(ret, "English_United Kingdom.1252")
208 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
210 ret = setlocale(LC_ALL, "enu");
211 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
213 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
215 ret = setlocale(LC_ALL, "enz");
216 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
218 ok(!strcmp(ret, "English_New Zealand.1252")
219 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
221 ret = setlocale(LC_ALL, "english");
222 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
224 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
226 ret = setlocale(LC_ALL, "english-american");
227 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
229 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
231 ret = setlocale(LC_ALL, "english-aus");
232 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
234 ok(!strcmp(ret, "English_Australia.1252")
235 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
237 ret = setlocale(LC_ALL, "english-can");
238 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
240 ok(!strcmp(ret, "English_Canada.1252")
241 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
243 ret = setlocale(LC_ALL, "english-nz");
244 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
246 ok(!strcmp(ret, "English_New Zealand.1252")
247 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
249 ret = setlocale(LC_ALL, "english-uk");
250 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
252 ok(!strcmp(ret, "English_United Kingdom.1252")
253 || broken(!strcmp(ret, "English_United States.1252")), "ret = %s\n", ret);
255 ret = setlocale(LC_ALL, "english-us");
256 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
258 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
260 ret = setlocale(LC_ALL, "english-usa");
261 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
263 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
265 ret = setlocale(LC_ALL, "esm");
266 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
268 ok(!strcmp(ret, "Spanish_Mexico.1252"), "ret = %s\n", ret);
270 ret = setlocale(LC_ALL, "esn");
271 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
273 ok(!strcmp(ret, "Spanish_Spain.1252")
274 || broken(!strcmp(ret, "Spanish - Modern Sort_Spain.1252")), "ret = %s\n", ret);
276 ret = setlocale(LC_ALL, "esp");
277 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
279 ok(!strcmp(ret, "Spanish_Spain.1252")
280 || broken(!strcmp(ret, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret);
282 ret = setlocale(LC_ALL, "fin");
283 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
285 ok(!strcmp(ret, "Finnish_Finland.1252"), "ret = %s\n", ret);
287 ret = setlocale(LC_ALL, "finnish");
288 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
290 ok(!strcmp(ret, "Finnish_Finland.1252"), "ret = %s\n", ret);
292 ret = setlocale(LC_ALL, "fra");
293 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
295 ok(!strcmp(ret, "French_France.1252"), "ret = %s\n", ret);
297 ret = setlocale(LC_ALL, "frb");
298 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
300 ok(!strcmp(ret, "French_Belgium.1252")
301 || broken(!strcmp(ret, "French_France.1252")), "ret = %s\n", ret);
303 ret = setlocale(LC_ALL, "frc");
304 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
306 ok(!strcmp(ret, "French_Canada.1252")
307 || broken(!strcmp(ret, "French_France.1252")), "ret = %s\n", ret);
309 ret = setlocale(LC_ALL, "french");
310 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
312 ok(!strcmp(ret, "French_France.1252"), "ret = %s\n", ret);
314 ret = setlocale(LC_ALL, "french-belgian");
315 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
317 ok(!strcmp(ret, "French_Belgium.1252")
318 || broken(!strcmp(ret, "French_France.1252")), "ret = %s\n", ret);
320 ret = setlocale(LC_ALL, "french-canadian");
321 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
323 ok(!strcmp(ret, "French_Canada.1252")
324 || broken(!strcmp(ret, "French_France.1252")), "ret = %s\n", ret);
326 ret = setlocale(LC_ALL, "french-swiss");
327 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
329 ok(!strcmp(ret, "French_Switzerland.1252")
330 || broken(!strcmp(ret, "French_France.1252")), "ret = %s\n", ret);
332 ret = setlocale(LC_ALL, "frs");
333 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
335 ok(!strcmp(ret, "French_Switzerland.1252")
336 || broken(!strcmp(ret, "French_France.1252")), "ret = %s\n", ret);
338 ret = setlocale(LC_ALL, "german");
339 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
341 ok(!strcmp(ret, "German_Germany.1252"), "ret = %s\n", ret);
343 ret = setlocale(LC_ALL, "german-austrian");
344 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
346 ok(!strcmp(ret, "German_Austria.1252")
347 || broken(!strcmp(ret, "German_Germany.1252")), "ret = %s\n", ret);
349 ret = setlocale(LC_ALL, "german-swiss");
350 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
352 ok(!strcmp(ret, "German_Switzerland.1252")
353 || broken(!strcmp(ret, "German_Germany.1252")), "ret = %s\n", ret);
355 ret = setlocale(LC_ALL, "greek");
356 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
358 ok(!strcmp(ret, "Greek_Greece.1253"), "ret = %s\n", ret);
360 ret = setlocale(LC_ALL, "hun");
361 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
363 ok(!strcmp(ret, "Hungarian_Hungary.1250"), "ret = %s\n", ret);
365 ret = setlocale(LC_ALL, "hungarian");
366 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
368 ok(!strcmp(ret, "Hungarian_Hungary.1250"), "ret = %s\n", ret);
370 ret = setlocale(LC_ALL, "icelandic");
371 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
373 ok(!strcmp(ret, "Icelandic_Iceland.1252"), "ret = %s\n", ret);
375 ret = setlocale(LC_ALL, "isl");
376 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
378 ok(!strcmp(ret, "Icelandic_Iceland.1252"), "ret = %s\n", ret);
380 ret = setlocale(LC_ALL, "ita");
381 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
383 ok(!strcmp(ret, "Italian_Italy.1252"), "ret = %s\n", ret);
385 ret = setlocale(LC_ALL, "italian");
386 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
388 ok(!strcmp(ret, "Italian_Italy.1252"), "ret = %s\n", ret);
390 ret = setlocale(LC_ALL, "italian-swiss");
391 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
393 ok(!strcmp(ret, "Italian_Switzerland.1252")
394 || broken(!strcmp(ret, "Italian_Italy.1252")), "ret = %s\n", ret);
396 ret = setlocale(LC_ALL, "its");
397 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
399 ok(!strcmp(ret, "Italian_Switzerland.1252")
400 || broken(!strcmp(ret, "Italian_Italy.1252")), "ret = %s\n", ret);
402 ret = setlocale(LC_ALL, "japanese");
403 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
405 ok(!strcmp(ret, "Japanese_Japan.932"), "ret = %s\n", ret);
407 ret = setlocale(LC_ALL, "jpn");
408 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
410 ok(!strcmp(ret, "Japanese_Japan.932"), "ret = %s\n", ret);
412 ret = setlocale(LC_ALL, "korean");
413 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
415 ok(!strcmp(ret, "Korean_Korea.949"), "ret = %s\n", ret);
417 ret = setlocale(LC_ALL, "korean");
418 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
420 ok(!strcmp(ret, "Korean_Korea.949"), "ret = %s\n", ret);
422 ret = setlocale(LC_ALL, "nlb");
423 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
425 ok(!strcmp(ret, "Dutch_Belgium.1252")
426 || broken(!strcmp(ret, "Dutch_Netherlands.1252")), "ret = %s\n", ret);
428 ret = setlocale(LC_ALL, "nld");
429 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
431 ok(!strcmp(ret, "Dutch_Netherlands.1252"), "ret = %s\n", ret);
433 ret = setlocale(LC_ALL, "non");
434 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
436 ok(!strcmp( ret, "Norwegian-Nynorsk_Norway.1252")
437 || !strcmp(ret, "Norwegian (Nynorsk)_Norway.1252")
438 || broken(!strcmp(ret, "Norwegian (Bokm\xe5l)_Norway.1252"))
439 || broken(!strcmp(ret, "Norwegian_Norway.1252")), "ret = %s\n", ret);
441 ret = setlocale(LC_ALL, "nor");
442 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
444 ok(!strcmp(ret, "Norwegian (Bokm\xe5l)_Norway.1252")
445 || !strcmp(ret, "Norwegian (Bokmal)_Norway.1252")
446 || broken(!strcmp(ret, "Norwegian_Norway.1252")), "ret = %s\n", ret);
448 ret = setlocale(LC_ALL, "norwegian-bokmal");
449 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
451 ok(!strcmp(ret, "Norwegian (Bokm\xe5l)_Norway.1252")
452 || !strcmp(ret, "Norwegian (Bokmal)_Norway.1252")
453 || broken(!strcmp(ret, "Norwegian_Norway.1252")), "ret = %s\n", ret);
455 ret = setlocale(LC_ALL, "norwegian-nynorsk");
456 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
458 ok(!strcmp(ret, "Norwegian-Nynorsk_Norway.1252")
459 || !strcmp(ret, "Norwegian (Nynorsk)_Norway.1252")
460 || broken(!strcmp(ret, "Norwegian_Norway.1252"))
461 || broken(!strcmp(ret, "Norwegian (Bokmal)_Norway.1252"))
462 || broken(!strcmp(ret, "Norwegian (Bokm\xe5l)_Norway.1252")), "ret = %s\n", ret);
464 ret = setlocale(LC_ALL, "plk");
465 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
467 ok(!strcmp(ret, "Polish_Poland.1250"), "ret = %s\n", ret);
469 ret = setlocale(LC_ALL, "polish");
470 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
472 ok(!strcmp(ret, "Polish_Poland.1250"), "ret = %s\n", ret);
474 ret = setlocale(LC_ALL, "portugese");
475 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
477 ok(!strcmp(ret, "Portuguese_Brazil.1252"), "ret = %s\n", ret);
479 ret = setlocale(LC_ALL, "portuguese-brazil");
480 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
482 ok(!strcmp(ret, "Portuguese_Brazil.1252"), "ret = %s\n", ret);
484 ret = setlocale(LC_ALL, "ptb");
485 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
487 ok(!strcmp(ret, "Portuguese_Brazil.1252"), "ret = %s\n", ret);
489 ret = setlocale(LC_ALL, "ptg");
490 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
492 ok(!strcmp(ret, "Portuguese_Portugal.1252"), "ret = %s\n", ret);
494 ret = setlocale(LC_ALL, "rus");
495 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
497 ok(!strcmp(ret, "Russian_Russia.1251"), "ret = %s\n", ret);
499 ret = setlocale(LC_ALL, "russian");
500 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
502 ok(!strcmp(ret, "Russian_Russia.1251"), "ret = %s\n", ret);
504 ret = setlocale(LC_ALL, "sky");
505 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
507 ok(!strcmp(ret, "Slovak_Slovakia.1250"), "ret = %s\n", ret);
509 ret = setlocale(LC_ALL, "slovak");
510 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
512 ok(!strcmp(ret, "Slovak_Slovakia.1250"), "ret = %s\n", ret);
514 ret = setlocale(LC_ALL, "spanish");
515 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
517 ok(!strcmp(ret, "Spanish_Spain.1252")
518 || broken(!strcmp(ret, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret);
520 ret = setlocale(LC_ALL, "spanish-mexican");
521 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
523 ok(!strcmp(ret, "Spanish_Mexico.1252")
524 || broken(!strcmp(ret, "Spanish_Spain.1252")), "ret = %s\n", ret);
526 ret = setlocale(LC_ALL, "spanish-modern");
527 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
529 ok(!strcmp(ret, "Spanish - Modern Sort_Spain.1252")
530 || !strcmp(ret, "Spanish_Spain.1252"), "ret = %s\n", ret);
532 ret = setlocale(LC_ALL, "sve");
533 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
535 ok(!strcmp(ret, "Swedish_Sweden.1252"), "ret = %s\n", ret);
537 ret = setlocale(LC_ALL, "swedish");
538 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
540 ok(!strcmp(ret, "Swedish_Sweden.1252"), "ret = %s\n", ret);
542 ret = setlocale(LC_ALL, "swiss");
543 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
545 ok(!strcmp(ret, "German_Switzerland.1252"), "ret = %s\n", ret);
547 ret = setlocale(LC_ALL, "trk");
548 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
550 ok(!strcmp(ret, "Turkish_Turkey.1254"), "ret = %s\n", ret);
552 ret = setlocale(LC_ALL, "turkish");
553 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
555 ok(!strcmp(ret, "Turkish_Turkey.1254"), "ret = %s\n", ret);
557 ret = setlocale(LC_ALL, "uk");
558 ok(ret != NULL, "ret == NULL\n");
560 ok(!strcmp(ret, "English_United Kingdom.1252")
561 || broken(!strcmp(ret, "Ukrainian_Ukraine.1251")), "ret = %s\n", ret);
563 ret = setlocale(LC_ALL, "us");
564 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
566 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
568 ret = setlocale(LC_ALL, "usa");
569 ok(ret != NULL || broken (ret == NULL), "ret == NULL\n");
571 ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
574 static void test_crtGetStringTypeW(void)
576 static const wchar_t str0[] = { '0', '\0' };
577 static const wchar_t strA[] = { 'A', '\0' };
578 static const wchar_t str_space[] = { ' ', '\0' };
579 static const wchar_t str_null[] = { '\0', '\0' };
580 static const wchar_t str_rand[] = { 1234, '\0' };
582 const wchar_t *str[] = { str0, strA, str_space, str_null, str_rand };
588 if(!p__crtGetStringTypeW) {
589 win_skip("Skipping __crtGetStringTypeW tests\n");
594 win_skip("Too old version of msvcrt.dll\n");
598 for(i=0; i<sizeof(str)/sizeof(*str); i++) {
599 ret_crt = p__crtGetStringTypeW(0, CT_CTYPE1, str[i], 1, &out_crt);
600 ret = GetStringTypeW(CT_CTYPE1, str[i], 1, &out);
601 ok(ret == ret_crt, "%d) ret_crt = %d\n", i, (int)ret_crt);
602 ok(out == out_crt, "%d) out_crt = %x, expected %x\n", i, (int)out_crt, (int)out);
604 ret_crt = p__crtGetStringTypeW(0, CT_CTYPE2, str[i], 1, &out_crt);
605 ret = GetStringTypeW(CT_CTYPE2, str[i], 1, &out);
606 ok(ret == ret_crt, "%d) ret_crt = %d\n", i, (int)ret_crt);
607 ok(out == out_crt, "%d) out_crt = %x, expected %x\n", i, (int)out_crt, (int)out);
609 ret_crt = p__crtGetStringTypeW(0, CT_CTYPE3, str[i], 1, &out_crt);
610 ret = GetStringTypeW(CT_CTYPE3, str[i], 1, &out);
611 ok(ret == ret_crt, "%d) ret_crt = %d\n", i, (int)ret_crt);
612 ok(out == out_crt, "%d) out_crt = %x, expected %x\n", i, (int)out_crt, (int)out);
615 ret = p__crtGetStringTypeW(0, 3, str[0], 1, &out);
616 ok(!ret, "ret == TRUE\n");
623 test_crtGetStringTypeW();