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 todo_wine
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 todo_wine
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 todo_wine
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 todo_wine
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 todo_wine
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") || broken(!strcmp(ret
, "Italian_Italy.1252")), "ret = %s\n", ret
);
395 ret
= setlocale(LC_ALL
, "its");
396 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
398 ok(!strcmp(ret
, "Italian_Switzerland.1252") || broken(!strcmp(ret
, "Italian_Italy.1252")), "ret = %s\n", ret
);
400 ret
= setlocale(LC_ALL
, "japanese");
401 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
403 ok(!strcmp(ret
, "Japanese_Japan.932"), "ret = %s\n", ret
);
405 ret
= setlocale(LC_ALL
, "jpn");
406 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
408 ok(!strcmp(ret
, "Japanese_Japan.932"), "ret = %s\n", ret
);
410 ret
= setlocale(LC_ALL
, "korean");
411 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
413 ok(!strcmp(ret
, "Korean_Korea.949"), "ret = %s\n", ret
);
415 ret
= setlocale(LC_ALL
, "korean");
416 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
418 ok(!strcmp(ret
, "Korean_Korea.949"), "ret = %s\n", ret
);
420 ret
= setlocale(LC_ALL
, "nlb");
421 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
423 ok(!strcmp(ret
, "Dutch_Belgium.1252")
424 || broken(!strcmp(ret
, "Dutch_Netherlands.1252")), "ret = %s\n", ret
);
426 ret
= setlocale(LC_ALL
, "nld");
427 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
429 ok(!strcmp(ret
, "Dutch_Netherlands.1252"), "ret = %s\n", ret
);
431 ret
= setlocale(LC_ALL
, "non");
432 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
434 todo_wine
ok((!strcmp( ret
, "Norwegian-Nynorsk_Norway.1252"))
435 || broken(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252"))
436 || broken(!strcmp(ret
, "Norwegian_Norway.1252"))
437 || broken(!strcmp(ret
, "Norwegian (Nynorsk)_Norway.1252")), "ret = %s\n", ret
);
439 ret
= setlocale(LC_ALL
, "nor");
440 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
442 ok(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252")
443 || broken(!strcmp(ret
, "Norwegian (Bokmal)_Norway.1252"))
444 || broken(!strcmp(ret
, "Norwegian_Norway.1252")), "ret = %s\n", ret
);
446 ret
= setlocale(LC_ALL
, "norwegian-bokmal");
447 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
449 ok(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252")
450 || broken(!strcmp(ret
, "Norwegian (Bokmal)_Norway.1252"))
451 || broken(!strcmp(ret
, "Norwegian_Norway.1252")), "ret = %s\n", ret
);
453 ret
= setlocale(LC_ALL
, "norwegian-nynorsk");
454 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
456 todo_wine
ok(!strcmp(ret
, "Norwegian-Nynorsk_Norway.1252")
457 || broken(!strcmp(ret
, "Norwegian_Norway.1252"))
458 || broken(!strcmp(ret
, "Norwegian (Nynorsk)_Norway.1252"))
459 || broken(!strcmp(ret
, "Norwegian (Bokmal)_Norway.1252"))
460 || broken(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252")), "ret = %s\n", ret
);
462 ret
= setlocale(LC_ALL
, "plk");
463 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
465 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
467 ret
= setlocale(LC_ALL
, "polish");
468 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
470 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
472 ret
= setlocale(LC_ALL
, "portugese");
473 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
475 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
477 ret
= setlocale(LC_ALL
, "portuguese-brazil");
478 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
480 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
482 ret
= setlocale(LC_ALL
, "ptb");
483 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
485 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
487 ret
= setlocale(LC_ALL
, "ptg");
488 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
490 ok(!strcmp(ret
, "Portuguese_Portugal.1252"), "ret = %s\n", ret
);
492 ret
= setlocale(LC_ALL
, "rus");
493 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
495 ok(!strcmp(ret
, "Russian_Russia.1251"), "ret = %s\n", ret
);
497 ret
= setlocale(LC_ALL
, "russian");
498 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
500 ok(!strcmp(ret
, "Russian_Russia.1251"), "ret = %s\n", ret
);
502 ret
= setlocale(LC_ALL
, "sky");
503 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
505 ok(!strcmp(ret
, "Slovak_Slovakia.1250"), "ret = %s\n", ret
);
507 ret
= setlocale(LC_ALL
, "slovak");
508 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
510 ok(!strcmp(ret
, "Slovak_Slovakia.1250"), "ret = %s\n", ret
);
512 ret
= setlocale(LC_ALL
, "spanish");
513 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
515 ok(!strcmp(ret
, "Spanish_Spain.1252")
516 || broken(!strcmp(ret
, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret
);
518 ret
= setlocale(LC_ALL
, "spanish-mexican");
519 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
521 ok(!strcmp(ret
, "Spanish_Mexico.1252")
522 || broken(!strcmp(ret
, "Spanish_Spain.1252")), "ret = %s\n", ret
);
524 ret
= setlocale(LC_ALL
, "spanish-modern");
525 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
527 todo_wine
ok(!strcmp(ret
, "Spanish - Modern Sort_Spain.1252")
528 || broken(!strcmp(ret
, "Spanish_Spain.1252")), "ret = %s\n", ret
);
530 ret
= setlocale(LC_ALL
, "sve");
531 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
533 ok(!strcmp(ret
, "Swedish_Sweden.1252"), "ret = %s\n", ret
);
535 ret
= setlocale(LC_ALL
, "swedish");
536 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
538 ok(!strcmp(ret
, "Swedish_Sweden.1252"), "ret = %s\n", ret
);
540 ret
= setlocale(LC_ALL
, "swiss");
541 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
543 ok(!strcmp(ret
, "German_Switzerland.1252"), "ret = %s\n", ret
);
545 ret
= setlocale(LC_ALL
, "trk");
546 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
548 ok(!strcmp(ret
, "Turkish_Turkey.1254"), "ret = %s\n", ret
);
550 ret
= setlocale(LC_ALL
, "turkish");
551 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
553 ok(!strcmp(ret
, "Turkish_Turkey.1254"), "ret = %s\n", ret
);
555 ret
= setlocale(LC_ALL
, "uk");
556 ok(ret
!= NULL
, "ret == NULL\n");
558 ok(!strcmp(ret
, "English_United Kingdom.1252")
559 || broken(!strcmp(ret
, "Ukrainian_Ukraine.1251")), "ret = %s\n", ret
);
561 ret
= setlocale(LC_ALL
, "us");
562 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
564 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
566 ret
= setlocale(LC_ALL
, "usa");
567 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
569 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
572 static void test_crtGetStringTypeW(void)
574 static const wchar_t str0
[] = { '0', '\0' };
575 static const wchar_t strA
[] = { 'A', '\0' };
576 static const wchar_t str_space
[] = { ' ', '\0' };
577 static const wchar_t str_null
[] = { '\0', '\0' };
578 static const wchar_t str_rand
[] = { 1234, '\0' };
580 const wchar_t *str
[] = { str0
, strA
, str_space
, str_null
, str_rand
};
586 if(!p__crtGetStringTypeW
) {
587 win_skip("Skipping __crtGetStringTypeW tests\n");
592 win_skip("Too old version of msvcrt.dll\n");
596 for(i
=0; i
<sizeof(str
)/sizeof(*str
); i
++) {
597 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE1
, str
[i
], 1, &out_crt
);
598 ret
= GetStringTypeW(CT_CTYPE1
, str
[i
], 1, &out
);
599 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
600 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
602 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE2
, str
[i
], 1, &out_crt
);
603 ret
= GetStringTypeW(CT_CTYPE2
, str
[i
], 1, &out
);
604 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
605 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
607 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE3
, str
[i
], 1, &out_crt
);
608 ret
= GetStringTypeW(CT_CTYPE3
, str
[i
], 1, &out
);
609 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
610 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
613 ret
= p__crtGetStringTypeW(0, 3, str
[0], 1, &out
);
614 ok(!ret
, "ret == TRUE\n");
621 test_crtGetStringTypeW();