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")), "ret = %s\n", ret
);
122 ret
= setlocale(LC_ALL
, "chinese-traditional");
123 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
125 todo_wine
ok(!strcmp(ret
, "Chinese (Traditional)_Taiwan.950")
126 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
128 ret
= setlocale(LC_ALL
, "chs");
129 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
131 todo_wine
ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
132 || broken(!strcmp(ret
, "Chinese_People's Republic of China.936")), "ret = %s\n", ret
);
134 ret
= setlocale(LC_ALL
, "cht");
135 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
137 todo_wine
ok(!strcmp(ret
, "Chinese (Traditional)_Taiwan.950")
138 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
140 ret
= setlocale(LC_ALL
, "csy");
141 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
143 ok(!strcmp(ret
, "Czech_Czech Republic.1250"), "ret = %s\n", ret
);
145 ret
= setlocale(LC_ALL
, "czech");
146 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
148 ok(!strcmp(ret
, "Czech_Czech Republic.1250"), "ret = %s\n", ret
);
150 ret
= setlocale(LC_ALL
, "dan");
151 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
153 ok(!strcmp(ret
, "Danish_Denmark.1252"), "ret = %s\n", ret
);
155 ret
= setlocale(LC_ALL
, "danish");
156 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
158 ok(!strcmp(ret
, "Danish_Denmark.1252"), "ret = %s\n", ret
);
160 ret
= setlocale(LC_ALL
, "dea");
161 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
163 ok(!strcmp(ret
, "German_Austria.1252"), "ret = %s\n", ret
);
165 ret
= setlocale(LC_ALL
, "des");
166 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
168 ok(!strcmp(ret
, "German_Switzerland.1252"), "ret = %s\n", ret
);
170 ret
= setlocale(LC_ALL
, "deu");
171 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
173 ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
175 ret
= setlocale(LC_ALL
, "dutch");
176 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
178 ok(!strcmp(ret
, "Dutch_Netherlands.1252"), "ret = %s\n", ret
);
180 ret
= setlocale(LC_ALL
, "dutch-belgian");
181 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
183 ok(!strcmp(ret
, "Dutch_Belgium.1252")
184 || broken(!strcmp(ret
, "Dutch_Netherlands.1252")), "ret = %s\n", ret
);
186 ret
= setlocale(LC_ALL
, "ena");
187 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
189 ok(!strcmp(ret
, "English_Australia.1252")
190 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
192 ret
= setlocale(LC_ALL
, "ell");
193 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
195 ok(!strcmp(ret
, "Greek_Greece.1253"), "ret = %s\n", ret
);
197 ret
= setlocale(LC_ALL
, "enc");
198 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
200 ok(!strcmp(ret
, "English_Canada.1252")
201 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
203 ret
= setlocale(LC_ALL
, "eng");
204 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
206 ok(!strcmp(ret
, "English_United Kingdom.1252")
207 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
209 ret
= setlocale(LC_ALL
, "enu");
210 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
212 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
214 ret
= setlocale(LC_ALL
, "enz");
215 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
217 ok(!strcmp(ret
, "English_New Zealand.1252")
218 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
220 ret
= setlocale(LC_ALL
, "english");
221 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
223 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
225 ret
= setlocale(LC_ALL
, "english-american");
226 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
228 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
230 ret
= setlocale(LC_ALL
, "english-aus");
231 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
233 ok(!strcmp(ret
, "English_Australia.1252")
234 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
236 ret
= setlocale(LC_ALL
, "english-can");
237 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
239 ok(!strcmp(ret
, "English_Canada.1252")
240 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
242 ret
= setlocale(LC_ALL
, "english-nz");
243 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
245 ok(!strcmp(ret
, "English_New Zealand.1252")
246 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
248 ret
= setlocale(LC_ALL
, "english-uk");
249 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
251 ok(!strcmp(ret
, "English_United Kingdom.1252")
252 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
254 ret
= setlocale(LC_ALL
, "english-us");
255 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
257 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
259 ret
= setlocale(LC_ALL
, "english-usa");
260 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
262 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
264 ret
= setlocale(LC_ALL
, "esm");
265 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
267 ok(!strcmp(ret
, "Spanish_Mexico.1252"), "ret = %s\n", ret
);
269 ret
= setlocale(LC_ALL
, "esn");
270 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
272 ok(!strcmp(ret
, "Spanish_Spain.1252")
273 || broken(!strcmp(ret
, "Spanish - Modern Sort_Spain.1252")), "ret = %s\n", ret
);
275 ret
= setlocale(LC_ALL
, "esp");
276 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
278 ok(!strcmp(ret
, "Spanish_Spain.1252")
279 || broken(!strcmp(ret
, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret
);
281 ret
= setlocale(LC_ALL
, "fin");
282 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
284 ok(!strcmp(ret
, "Finnish_Finland.1252"), "ret = %s\n", ret
);
286 ret
= setlocale(LC_ALL
, "finnish");
287 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
289 ok(!strcmp(ret
, "Finnish_Finland.1252"), "ret = %s\n", ret
);
291 ret
= setlocale(LC_ALL
, "fra");
292 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
294 ok(!strcmp(ret
, "French_France.1252"), "ret = %s\n", ret
);
296 ret
= setlocale(LC_ALL
, "frb");
297 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
299 ok(!strcmp(ret
, "French_Belgium.1252")
300 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
302 ret
= setlocale(LC_ALL
, "frc");
303 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
305 ok(!strcmp(ret
, "French_Canada.1252")
306 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
308 ret
= setlocale(LC_ALL
, "french");
309 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
311 ok(!strcmp(ret
, "French_France.1252"), "ret = %s\n", ret
);
313 ret
= setlocale(LC_ALL
, "french-belgian");
314 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
316 ok(!strcmp(ret
, "French_Belgium.1252")
317 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
319 ret
= setlocale(LC_ALL
, "french-canadian");
320 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
322 ok(!strcmp(ret
, "French_Canada.1252")
323 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
325 ret
= setlocale(LC_ALL
, "french-swiss");
326 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
328 ok(!strcmp(ret
, "French_Switzerland.1252")
329 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
331 ret
= setlocale(LC_ALL
, "frs");
332 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
334 ok(!strcmp(ret
, "French_Switzerland.1252")
335 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
337 ret
= setlocale(LC_ALL
, "german");
338 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
340 ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
342 ret
= setlocale(LC_ALL
, "german-austrian");
343 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
345 ok(!strcmp(ret
, "German_Austria.1252")
346 || broken(!strcmp(ret
, "German_Germany.1252")), "ret = %s\n", ret
);
348 ret
= setlocale(LC_ALL
, "german-swiss");
349 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
351 ok(!strcmp(ret
, "German_Switzerland.1252")
352 || broken(!strcmp(ret
, "German_Germany.1252")), "ret = %s\n", ret
);
354 ret
= setlocale(LC_ALL
, "greek");
355 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
357 ok(!strcmp(ret
, "Greek_Greece.1253"), "ret = %s\n", ret
);
359 ret
= setlocale(LC_ALL
, "hun");
360 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
362 ok(!strcmp(ret
, "Hungarian_Hungary.1250"), "ret = %s\n", ret
);
364 ret
= setlocale(LC_ALL
, "hungarian");
365 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
367 ok(!strcmp(ret
, "Hungarian_Hungary.1250"), "ret = %s\n", ret
);
369 ret
= setlocale(LC_ALL
, "icelandic");
370 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
372 ok(!strcmp(ret
, "Icelandic_Iceland.1252"), "ret = %s\n", ret
);
374 ret
= setlocale(LC_ALL
, "isl");
375 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
377 ok(!strcmp(ret
, "Icelandic_Iceland.1252"), "ret = %s\n", ret
);
379 ret
= setlocale(LC_ALL
, "ita");
380 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
382 ok(!strcmp(ret
, "Italian_Italy.1252"), "ret = %s\n", ret
);
384 ret
= setlocale(LC_ALL
, "italian");
385 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
387 ok(!strcmp(ret
, "Italian_Italy.1252"), "ret = %s\n", ret
);
389 ret
= setlocale(LC_ALL
, "italian-swiss");
390 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
392 ok(!strcmp(ret
, "Italian_Switzerland.1252") || broken(!strcmp(ret
, "Italian_Italy.1252")), "ret = %s\n", ret
);
394 ret
= setlocale(LC_ALL
, "its");
395 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
397 ok(!strcmp(ret
, "Italian_Switzerland.1252") || broken(!strcmp(ret
, "Italian_Italy.1252")), "ret = %s\n", ret
);
399 ret
= setlocale(LC_ALL
, "japanese");
400 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
402 ok(!strcmp(ret
, "Japanese_Japan.932"), "ret = %s\n", ret
);
404 ret
= setlocale(LC_ALL
, "jpn");
405 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
407 ok(!strcmp(ret
, "Japanese_Japan.932"), "ret = %s\n", ret
);
409 ret
= setlocale(LC_ALL
, "korean");
410 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
412 ok(!strcmp(ret
, "Korean_Korea.949"), "ret = %s\n", ret
);
414 ret
= setlocale(LC_ALL
, "korean");
415 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
417 ok(!strcmp(ret
, "Korean_Korea.949"), "ret = %s\n", ret
);
419 ret
= setlocale(LC_ALL
, "nlb");
420 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
422 ok(!strcmp(ret
, "Dutch_Belgium.1252")
423 || broken(!strcmp(ret
, "Dutch_Netherlands.1252")), "ret = %s\n", ret
);
425 ret
= setlocale(LC_ALL
, "nld");
426 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
428 ok(!strcmp(ret
, "Dutch_Netherlands.1252"), "ret = %s\n", ret
);
430 ret
= setlocale(LC_ALL
, "non");
431 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
433 todo_wine
ok((!strcmp( ret
, "Norwegian-Nynorsk_Norway.1252"))
434 || broken(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252"))
435 || broken(!strcmp(ret
, "Norwegian_Norway.1252"))
436 || broken(!strcmp(ret
, "Norwegian (Nynorsk)_Norway.1252")), "ret = %s\n", ret
);
438 ret
= setlocale(LC_ALL
, "nor");
439 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
441 ok(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252")
442 || broken(!strcmp(ret
, "Norwegian_Norway.1252")), "ret = %s\n", ret
);
444 ret
= setlocale(LC_ALL
, "norwegian-bokmal");
445 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
447 ok(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252")
448 || broken(!strcmp(ret
, "Norwegian_Norway.1252")), "ret = %s\n", ret
);
450 ret
= setlocale(LC_ALL
, "norwegian-nynorsk");
451 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
453 todo_wine
ok(!strcmp(ret
, "Norwegian-Nynorsk_Norway.1252")
454 || broken(!strcmp(ret
, "Norwegian_Norway.1252"))
455 || broken(!strcmp(ret
, "Norwegian (Nynorsk)_Norway.1252"))
456 || broken(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252")), "ret = %s\n", ret
);
458 ret
= setlocale(LC_ALL
, "plk");
459 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
461 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
463 ret
= setlocale(LC_ALL
, "polish");
464 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
466 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
468 ret
= setlocale(LC_ALL
, "portugese");
469 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
471 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
473 ret
= setlocale(LC_ALL
, "portuguese-brazil");
474 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
476 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
478 ret
= setlocale(LC_ALL
, "ptb");
479 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
481 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
483 ret
= setlocale(LC_ALL
, "ptg");
484 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
486 ok(!strcmp(ret
, "Portuguese_Portugal.1252"), "ret = %s\n", ret
);
488 ret
= setlocale(LC_ALL
, "rus");
489 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
491 ok(!strcmp(ret
, "Russian_Russia.1251"), "ret = %s\n", ret
);
493 ret
= setlocale(LC_ALL
, "russian");
494 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
496 ok(!strcmp(ret
, "Russian_Russia.1251"), "ret = %s\n", ret
);
498 ret
= setlocale(LC_ALL
, "sky");
499 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
501 ok(!strcmp(ret
, "Slovak_Slovakia.1250"), "ret = %s\n", ret
);
503 ret
= setlocale(LC_ALL
, "slovak");
504 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
506 ok(!strcmp(ret
, "Slovak_Slovakia.1250"), "ret = %s\n", ret
);
508 ret
= setlocale(LC_ALL
, "spanish");
509 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
511 ok(!strcmp(ret
, "Spanish_Spain.1252")
512 || broken(!strcmp(ret
, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret
);
514 ret
= setlocale(LC_ALL
, "spanish-mexican");
515 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
517 ok(!strcmp(ret
, "Spanish_Mexico.1252")
518 || broken(!strcmp(ret
, "Spanish_Spain.1252")), "ret = %s\n", ret
);
520 ret
= setlocale(LC_ALL
, "spanish-modern");
521 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
523 todo_wine
ok(!strcmp(ret
, "Spanish - Modern Sort_Spain.1252")
524 || broken(!strcmp(ret
, "Spanish_Spain.1252")), "ret = %s\n", ret
);
526 ret
= setlocale(LC_ALL
, "sve");
527 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
529 ok(!strcmp(ret
, "Swedish_Sweden.1252"), "ret = %s\n", ret
);
531 ret
= setlocale(LC_ALL
, "swedish");
532 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
534 ok(!strcmp(ret
, "Swedish_Sweden.1252"), "ret = %s\n", ret
);
536 ret
= setlocale(LC_ALL
, "swiss");
537 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
539 ok(!strcmp(ret
, "German_Switzerland.1252"), "ret = %s\n", ret
);
541 ret
= setlocale(LC_ALL
, "trk");
542 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
544 ok(!strcmp(ret
, "Turkish_Turkey.1254"), "ret = %s\n", ret
);
546 ret
= setlocale(LC_ALL
, "turkish");
547 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
549 ok(!strcmp(ret
, "Turkish_Turkey.1254"), "ret = %s\n", ret
);
551 ret
= setlocale(LC_ALL
, "uk");
552 ok(ret
!= NULL
, "ret == NULL\n");
554 ok(!strcmp(ret
, "English_United Kingdom.1252")
555 || broken(!strcmp(ret
, "Ukrainian_Ukraine.1251")), "ret = %s\n", ret
);
557 ret
= setlocale(LC_ALL
, "us");
558 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
560 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
562 ret
= setlocale(LC_ALL
, "usa");
563 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
565 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
568 static void test_crtGetStringTypeW(void)
570 static const wchar_t str0
[] = { '0', '\0' };
571 static const wchar_t strA
[] = { 'A', '\0' };
572 static const wchar_t str_space
[] = { ' ', '\0' };
573 static const wchar_t str_null
[] = { '\0', '\0' };
574 static const wchar_t str_rand
[] = { 1234, '\0' };
576 const wchar_t *str
[] = { str0
, strA
, str_space
, str_null
, str_rand
};
582 if(!p__crtGetStringTypeW
) {
583 win_skip("Skipping __crtGetStringTypeW tests\n");
588 win_skip("Too old version of msvcrt.dll\n");
592 for(i
=0; i
<sizeof(str
)/sizeof(*str
); i
++) {
593 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE1
, str
[i
], 1, &out_crt
);
594 ret
= GetStringTypeW(CT_CTYPE1
, str
[i
], 1, &out
);
595 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
596 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
598 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE2
, str
[i
], 1, &out_crt
);
599 ret
= GetStringTypeW(CT_CTYPE2
, str
[i
], 1, &out
);
600 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
601 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
603 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE3
, str
[i
], 1, &out_crt
);
604 ret
= GetStringTypeW(CT_CTYPE3
, str
[i
], 1, &out
);
605 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
606 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
609 ret
= p__crtGetStringTypeW(0, 3, str
[0], 1, &out
);
610 ok(!ret
, "ret == TRUE\n");
617 test_crtGetStringTypeW();