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 todo_wine
ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
80 /* This test shows that _country_synonyms table is incorrect */
81 /* It translates "America" to "US" */
82 ret
= setlocale(LC_ALL
, "America");
83 ok(ret
== NULL
, "ret = %s\n", ret
);
85 ret
= setlocale(LC_ALL
, "american");
86 todo_wine
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 todo_wine
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
, "american-english");
96 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
98 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
100 ret
= setlocale(LC_ALL
, "australian");
101 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
103 ok(!strcmp(ret
, "English_Australia.1252"), "ret = %s\n", ret
);
105 ret
= setlocale(LC_ALL
, "belgian");
106 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
108 ok(!strcmp(ret
, "Dutch_Belgium.1252"), "ret = %s\n", ret
);
110 ret
= setlocale(LC_ALL
, "canadian");
111 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
113 ok(!strcmp(ret
, "English_Canada.1252"), "ret = %s\n", ret
);
115 ret
= setlocale(LC_ALL
, "chinese");
116 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
118 todo_wine
ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
119 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
121 ret
= setlocale(LC_ALL
, "chinese-simplified");
122 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
124 ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
125 || broken(!strcmp(ret
, "Chinese_People's Republic of China.936")), "ret = %s\n", ret
);
127 ret
= setlocale(LC_ALL
, "chinese-traditional");
128 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
130 ok(!strcmp(ret
, "Chinese (Traditional)_Taiwan.950")
131 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
133 ret
= setlocale(LC_ALL
, "chs");
134 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
136 todo_wine
ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
137 || broken(!strcmp(ret
, "Chinese_People's Republic of China.936")), "ret = %s\n", ret
);
139 ret
= setlocale(LC_ALL
, "cht");
140 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
142 todo_wine
ok(!strcmp(ret
, "Chinese (Traditional)_Taiwan.950")
143 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
145 ret
= setlocale(LC_ALL
, "csy");
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
, "czech");
151 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
153 ok(!strcmp(ret
, "Czech_Czech Republic.1250"), "ret = %s\n", ret
);
155 ret
= setlocale(LC_ALL
, "dan");
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
, "danish");
161 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
163 ok(!strcmp(ret
, "Danish_Denmark.1252"), "ret = %s\n", ret
);
165 ret
= setlocale(LC_ALL
, "dea");
166 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
168 todo_wine
ok(!strcmp(ret
, "German_Austria.1252"), "ret = %s\n", ret
);
170 ret
= setlocale(LC_ALL
, "des");
171 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
173 todo_wine
ok(!strcmp(ret
, "German_Switzerland.1252"), "ret = %s\n", ret
);
175 ret
= setlocale(LC_ALL
, "deu");
176 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
178 todo_wine
ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
180 ret
= setlocale(LC_ALL
, "dutch");
181 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
183 todo_wine
ok(!strcmp(ret
, "Dutch_Netherlands.1252"), "ret = %s\n", ret
);
185 ret
= setlocale(LC_ALL
, "dutch-belgian");
186 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
188 ok(!strcmp(ret
, "Dutch_Belgium.1252")
189 || broken(!strcmp(ret
, "Dutch_Netherlands.1252")), "ret = %s\n", ret
);
191 ret
= setlocale(LC_ALL
, "ena");
192 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
194 todo_wine
ok(!strcmp(ret
, "English_Australia.1252")
195 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
197 ret
= setlocale(LC_ALL
, "ell");
198 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
200 ok(!strcmp(ret
, "Greek_Greece.1253"), "ret = %s\n", ret
);
202 ret
= setlocale(LC_ALL
, "enc");
203 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
205 todo_wine
ok(!strcmp(ret
, "English_Canada.1252")
206 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
208 ret
= setlocale(LC_ALL
, "eng");
209 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
211 todo_wine
ok(!strcmp(ret
, "English_United Kingdom.1252")
212 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
214 ret
= setlocale(LC_ALL
, "enu");
215 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
217 todo_wine
ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
219 ret
= setlocale(LC_ALL
, "enz");
220 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
222 todo_wine
ok(!strcmp(ret
, "English_New Zealand.1252")
223 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
225 ret
= setlocale(LC_ALL
, "english");
226 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
228 todo_wine
ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
230 ret
= setlocale(LC_ALL
, "english-american");
231 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
233 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
235 ret
= setlocale(LC_ALL
, "english-aus");
236 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
238 ok(!strcmp(ret
, "English_Australia.1252")
239 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
241 ret
= setlocale(LC_ALL
, "english-can");
242 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
244 ok(!strcmp(ret
, "English_Canada.1252")
245 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
247 ret
= setlocale(LC_ALL
, "english-nz");
248 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
250 ok(!strcmp(ret
, "English_New Zealand.1252")
251 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
253 ret
= setlocale(LC_ALL
, "english-uk");
254 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
256 ok(!strcmp(ret
, "English_United Kingdom.1252")
257 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
259 ret
= setlocale(LC_ALL
, "english-us");
260 todo_wine
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
, "english-usa");
265 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
267 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
269 ret
= setlocale(LC_ALL
, "esm");
270 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
272 todo_wine
ok(!strcmp(ret
, "Spanish_Mexico.1252"), "ret = %s\n", ret
);
274 ret
= setlocale(LC_ALL
, "esn");
275 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
277 todo_wine
ok(!strcmp(ret
, "Spanish_Spain.1252")
278 || broken(!strcmp(ret
, "Spanish - Modern Sort_Spain.1252")), "ret = %s\n", ret
);
280 ret
= setlocale(LC_ALL
, "esp");
281 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
283 todo_wine
ok(!strcmp(ret
, "Spanish_Spain.1252")
284 || broken(!strcmp(ret
, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret
);
286 ret
= setlocale(LC_ALL
, "fin");
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
, "finnish");
292 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
294 ok(!strcmp(ret
, "Finnish_Finland.1252"), "ret = %s\n", ret
);
296 ret
= setlocale(LC_ALL
, "fra");
297 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
299 todo_wine
ok(!strcmp(ret
, "French_France.1252"), "ret = %s\n", ret
);
301 ret
= setlocale(LC_ALL
, "frb");
302 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
304 todo_wine
ok(!strcmp(ret
, "French_Belgium.1252")
305 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
307 ret
= setlocale(LC_ALL
, "frc");
308 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
310 todo_wine
ok(!strcmp(ret
, "French_Canada.1252")
311 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
313 ret
= setlocale(LC_ALL
, "french");
314 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
316 todo_wine
ok(!strcmp(ret
, "French_France.1252"), "ret = %s\n", ret
);
318 ret
= setlocale(LC_ALL
, "french-belgian");
319 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
321 ok(!strcmp(ret
, "French_Belgium.1252")
322 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
324 ret
= setlocale(LC_ALL
, "french-canadian");
325 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
327 ok(!strcmp(ret
, "French_Canada.1252")
328 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
330 ret
= setlocale(LC_ALL
, "french-swiss");
331 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
333 ok(!strcmp(ret
, "French_Switzerland.1252")
334 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
336 ret
= setlocale(LC_ALL
, "frs");
337 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
339 todo_wine
ok(!strcmp(ret
, "French_Switzerland.1252")
340 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
342 ret
= setlocale(LC_ALL
, "german");
343 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
345 todo_wine
ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
347 ret
= setlocale(LC_ALL
, "german-austrian");
348 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
350 ok(!strcmp(ret
, "German_Austria.1252")
351 || broken(!strcmp(ret
, "German_Germany.1252")), "ret = %s\n", ret
);
353 ret
= setlocale(LC_ALL
, "german-swiss");
354 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
356 ok(!strcmp(ret
, "German_Switzerland.1252")
357 || broken(!strcmp(ret
, "German_Germany.1252")), "ret = %s\n", ret
);
359 ret
= setlocale(LC_ALL
, "greek");
360 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
362 ok(!strcmp(ret
, "Greek_Greece.1253"), "ret = %s\n", ret
);
364 ret
= setlocale(LC_ALL
, "hun");
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
, "hungarian");
370 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
372 ok(!strcmp(ret
, "Hungarian_Hungary.1250"), "ret = %s\n", ret
);
374 ret
= setlocale(LC_ALL
, "icelandic");
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
, "isl");
380 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
382 ok(!strcmp(ret
, "Icelandic_Iceland.1252"), "ret = %s\n", ret
);
384 ret
= setlocale(LC_ALL
, "ita");
385 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
387 todo_wine
ok(!strcmp(ret
, "Italian_Italy.1252"), "ret = %s\n", ret
);
389 ret
= setlocale(LC_ALL
, "italian");
390 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
392 todo_wine
ok(!strcmp(ret
, "Italian_Italy.1252"), "ret = %s\n", ret
);
394 ret
= setlocale(LC_ALL
, "italian-swiss");
395 todo_wine
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
, "its");
400 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
402 todo_wine
ok(!strcmp(ret
, "Italian_Switzerland.1252") || broken(!strcmp(ret
, "Italian_Italy.1252")), "ret = %s\n", ret
);
404 ret
= setlocale(LC_ALL
, "japanese");
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
, "jpn");
410 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
412 ok(!strcmp(ret
, "Japanese_Japan.932"), "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
, "korean");
420 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
422 ok(!strcmp(ret
, "Korean_Korea.949"), "ret = %s\n", ret
);
424 ret
= setlocale(LC_ALL
, "nlb");
425 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
427 todo_wine
ok(!strcmp(ret
, "Dutch_Belgium.1252")
428 || broken(!strcmp(ret
, "Dutch_Netherlands.1252")), "ret = %s\n", ret
);
430 ret
= setlocale(LC_ALL
, "nld");
431 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
433 todo_wine
ok(!strcmp(ret
, "Dutch_Netherlands.1252"), "ret = %s\n", ret
);
435 ret
= setlocale(LC_ALL
, "non");
436 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
438 todo_wine
ok((!strcmp( ret
, "Norwegian-Nynorsk_Norway.1252"))
439 || broken(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252"))
440 || broken(!strcmp(ret
, "Norwegian (Nynorsk)_Norway.1252")), "ret = %s\n", ret
);
442 ret
= setlocale(LC_ALL
, "nor");
443 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
445 todo_wine
ok(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252"), "ret = %s\n", ret
);
447 ret
= setlocale(LC_ALL
, "norwegian-bokmal");
448 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
450 ok(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252"), "ret = %s\n", ret
);
452 ret
= setlocale(LC_ALL
, "norwegian-nynorsk");
453 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
455 ok(!strcmp(ret
, "Norwegian-Nynorsk_Norway.1252")
456 || broken(!strcmp( ret
, "Norwegian (Nynorsk)_Norway.1252"))
457 || broken(!strcmp(ret
, "Norwegian (Bokmål)_Norway.1252")), "ret = %s\n", ret
);
459 ret
= setlocale(LC_ALL
, "plk");
460 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
462 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
464 ret
= setlocale(LC_ALL
, "polish");
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
, "portugese");
470 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
472 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
474 ret
= setlocale(LC_ALL
, "portuguese-brazil");
475 todo_wine
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
, "ptb");
480 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
482 todo_wine
ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
484 ret
= setlocale(LC_ALL
, "ptg");
485 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
487 todo_wine
ok(!strcmp(ret
, "Portuguese_Portugal.1252"), "ret = %s\n", ret
);
489 ret
= setlocale(LC_ALL
, "rus");
490 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
492 ok(!strcmp(ret
, "Russian_Russia.1251"), "ret = %s\n", ret
);
494 ret
= setlocale(LC_ALL
, "russian");
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
, "sky");
500 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
502 ok(!strcmp(ret
, "Slovak_Slovakia.1250"), "ret = %s\n", ret
);
504 ret
= setlocale(LC_ALL
, "slovak");
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
, "spanish");
510 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
512 todo_wine
ok(!strcmp(ret
, "Spanish_Spain.1252")
513 || broken(!strcmp(ret
, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret
);
515 ret
= setlocale(LC_ALL
, "spanish-mexican");
516 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
518 ok(!strcmp(ret
, "Spanish_Mexico.1252")
519 || broken(!strcmp(ret
, "Spanish_Spain.1252")), "ret = %s\n", ret
);
521 ret
= setlocale(LC_ALL
, "spanish-modern");
522 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
524 ok(!strcmp(ret
, "Spanish - Modern Sort_Spain.1252")
525 || broken(!strcmp(ret
, "Spanish_Spain.1252")), "ret = %s\n", ret
);
527 ret
= setlocale(LC_ALL
, "sve");
528 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
530 ok(!strcmp(ret
, "Swedish_Sweden.1252"), "ret = %s\n", ret
);
532 ret
= setlocale(LC_ALL
, "swedish");
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
, "swiss");
538 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
540 ok(!strcmp(ret
, "German_Switzerland.1252"), "ret = %s\n", ret
);
542 ret
= setlocale(LC_ALL
, "trk");
543 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
545 ok(!strcmp(ret
, "Turkish_Turkey.1254"), "ret = %s\n", ret
);
547 ret
= setlocale(LC_ALL
, "turkish");
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
, "uk");
553 ok(ret
!= NULL
, "ret == NULL\n");
555 todo_wine
ok(!strcmp(ret
, "English_United Kingdom.1252")
556 || broken(!strcmp(ret
, "Ukrainian_Ukraine.1251")), "ret = %s\n", ret
);
558 ret
= setlocale(LC_ALL
, "us");
559 todo_wine
ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
561 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
563 ret
= setlocale(LC_ALL
, "usa");
564 todo_wine
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
, "US");
569 todo_wine
ok(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();