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);
28 static int (__cdecl
*p___mb_cur_max_func
)(void);
29 static int *(__cdecl
*p__p___mb_cur_max
)(void);
30 void* __cdecl
_Gettnames(void);
32 static void init(void)
34 HMODULE hmod
= GetModuleHandleA("msvcrt.dll");
36 p__crtGetStringTypeW
= (void*)GetProcAddress(hmod
, "__crtGetStringTypeW");
37 pmemcpy_s
= (void*)GetProcAddress(hmod
, "memcpy_s");
38 p___mb_cur_max_func
= (void*)GetProcAddress(hmod
, "___mb_cur_max_func");
39 p__p___mb_cur_max
= (void*)GetProcAddress(hmod
, "__p___mb_cur_max");
42 static void test_setlocale(void)
44 static const char lc_all
[] = "LC_COLLATE=C;LC_CTYPE=C;"
45 "LC_MONETARY=Greek_Greece.1253;LC_NUMERIC=Polish_Poland.1250;LC_TIME=C";
49 ret
= setlocale(20, "C");
50 ok(ret
== NULL
, "ret = %s\n", ret
);
52 ret
= setlocale(LC_ALL
, "C");
53 ok(!strcmp(ret
, "C"), "ret = %s\n", ret
);
55 ret
= setlocale(LC_ALL
, NULL
);
56 ok(!strcmp(ret
, "C"), "ret = %s\n", ret
);
58 if(!setlocale(LC_NUMERIC
, "Polish")
59 || !setlocale(LC_NUMERIC
, "Greek")
60 || !setlocale(LC_NUMERIC
, "German")
61 || !setlocale(LC_NUMERIC
, "English")) {
62 win_skip("System with limited locales\n");
66 ret
= setlocale(LC_NUMERIC
, "Polish");
67 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
69 ret
= setlocale(LC_MONETARY
, "Greek");
70 ok(!strcmp(ret
, "Greek_Greece.1253"), "ret = %s\n", ret
);
72 ret
= setlocale(LC_ALL
, NULL
);
73 ok(!strcmp(ret
, lc_all
), "ret = %s\n", ret
);
76 ret
= setlocale(LC_ALL
, buf
);
77 ok(!strcmp(ret
, lc_all
), "ret = %s\n", ret
);
79 ret
= setlocale(LC_ALL
, "German");
80 ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
82 ret
= setlocale(LC_ALL
, "american");
83 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
85 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
87 ret
= setlocale(LC_ALL
, "american english");
88 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
90 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
92 ret
= setlocale(LC_ALL
, "american-english");
93 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
95 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
97 ret
= setlocale(LC_ALL
, "australian");
98 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
100 ok(!strcmp(ret
, "English_Australia.1252"), "ret = %s\n", ret
);
102 ret
= setlocale(LC_ALL
, "belgian");
103 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
105 ok(!strcmp(ret
, "Dutch_Belgium.1252"), "ret = %s\n", ret
);
107 ret
= setlocale(LC_ALL
, "canadian");
108 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
110 ok(!strcmp(ret
, "English_Canada.1252"), "ret = %s\n", ret
);
112 ret
= setlocale(LC_ALL
, "chinese");
113 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
115 ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
116 || !strcmp(ret
, "Chinese (Simplified)_China.936")
117 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
119 ret
= setlocale(LC_ALL
, "chinese-simplified");
120 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
122 ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
123 || !strcmp(ret
, "Chinese (Simplified)_China.936")
124 || broken(!strcmp(ret
, "Chinese_People's Republic of China.936"))
125 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
127 ret
= setlocale(LC_ALL
, "chinese-traditional");
128 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 ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
137 || !strcmp(ret
, "Chinese (Simplified)_China.936")
138 || broken(!strcmp(ret
, "Chinese_People's Republic of China.936")), "ret = %s\n", ret
);
140 ret
= setlocale(LC_ALL
, "cht");
141 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
143 ok(!strcmp(ret
, "Chinese (Traditional)_Taiwan.950")
144 || broken(!strcmp(ret
, "Chinese_Taiwan.950")), "ret = %s\n", ret
);
146 ret
= setlocale(LC_ALL
, "Chinese_China.936");
148 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
152 ok(!strcmp(ret
, "Chinese (Simplified)_People's Republic of China.936")
153 || !strcmp(ret
, "Chinese (Simplified)_China.936")
154 || broken(!strcmp(ret
, "Chinese_People's Republic of China.936")), "ret = %s\n", ret
);
155 trace("ret is %s\n", ret
);
158 ret
= setlocale(LC_ALL
, "csy");
159 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
161 ok(!strcmp(ret
, "Czech_Czech Republic.1250"), "ret = %s\n", ret
);
163 ret
= setlocale(LC_ALL
, "czech");
164 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
166 ok(!strcmp(ret
, "Czech_Czech Republic.1250"), "ret = %s\n", ret
);
168 ret
= setlocale(LC_ALL
, "dan");
169 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
171 ok(!strcmp(ret
, "Danish_Denmark.1252"), "ret = %s\n", ret
);
173 ret
= setlocale(LC_ALL
, "danish");
174 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
176 ok(!strcmp(ret
, "Danish_Denmark.1252"), "ret = %s\n", ret
);
178 ret
= setlocale(LC_ALL
, "dea");
179 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
181 ok(!strcmp(ret
, "German_Austria.1252"), "ret = %s\n", ret
);
183 ret
= setlocale(LC_ALL
, "des");
184 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
186 ok(!strcmp(ret
, "German_Switzerland.1252"), "ret = %s\n", ret
);
188 ret
= setlocale(LC_ALL
, "deu");
189 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
191 ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
193 ret
= setlocale(LC_ALL
, "dutch");
194 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
196 ok(!strcmp(ret
, "Dutch_Netherlands.1252"), "ret = %s\n", ret
);
198 ret
= setlocale(LC_ALL
, "dutch-belgian");
199 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
201 ok(!strcmp(ret
, "Dutch_Belgium.1252")
202 || broken(!strcmp(ret
, "Dutch_Netherlands.1252")), "ret = %s\n", ret
);
204 ret
= setlocale(LC_ALL
, "ena");
205 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
207 ok(!strcmp(ret
, "English_Australia.1252")
208 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
210 ret
= setlocale(LC_ALL
, "ell");
211 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
213 ok(!strcmp(ret
, "Greek_Greece.1253"), "ret = %s\n", ret
);
215 ret
= setlocale(LC_ALL
, "enc");
216 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
218 ok(!strcmp(ret
, "English_Canada.1252")
219 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
221 ret
= setlocale(LC_ALL
, "eng");
222 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
224 ok(!strcmp(ret
, "English_United Kingdom.1252")
225 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
227 ret
= setlocale(LC_ALL
, "enu");
228 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
230 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
232 ret
= setlocale(LC_ALL
, "enz");
233 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
235 ok(!strcmp(ret
, "English_New Zealand.1252")
236 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
238 ret
= setlocale(LC_ALL
, "english");
239 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
241 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
243 ret
= setlocale(LC_ALL
, "english-american");
244 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
246 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
248 ret
= setlocale(LC_ALL
, "english-aus");
249 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
251 ok(!strcmp(ret
, "English_Australia.1252")
252 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
254 ret
= setlocale(LC_ALL
, "english-can");
255 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
257 ok(!strcmp(ret
, "English_Canada.1252")
258 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
260 ret
= setlocale(LC_ALL
, "english-nz");
261 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
263 ok(!strcmp(ret
, "English_New Zealand.1252")
264 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
266 ret
= setlocale(LC_ALL
, "english-uk");
267 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
269 ok(!strcmp(ret
, "English_United Kingdom.1252")
270 || broken(!strcmp(ret
, "English_United States.1252")), "ret = %s\n", ret
);
272 ret
= setlocale(LC_ALL
, "english-us");
273 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
275 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
277 ret
= setlocale(LC_ALL
, "english-usa");
278 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
280 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
282 ret
= setlocale(LC_ALL
, "esm");
283 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
285 ok(!strcmp(ret
, "Spanish_Mexico.1252"), "ret = %s\n", ret
);
287 ret
= setlocale(LC_ALL
, "esn");
288 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
290 ok(!strcmp(ret
, "Spanish_Spain.1252")
291 || broken(!strcmp(ret
, "Spanish - Modern Sort_Spain.1252")), "ret = %s\n", ret
);
293 ret
= setlocale(LC_ALL
, "esp");
294 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
296 ok(!strcmp(ret
, "Spanish_Spain.1252")
297 || broken(!strcmp(ret
, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret
);
299 ret
= setlocale(LC_ALL
, "fin");
300 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
302 ok(!strcmp(ret
, "Finnish_Finland.1252"), "ret = %s\n", ret
);
304 ret
= setlocale(LC_ALL
, "finnish");
305 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
307 ok(!strcmp(ret
, "Finnish_Finland.1252"), "ret = %s\n", ret
);
309 ret
= setlocale(LC_ALL
, "fra");
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
, "frb");
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
, "frc");
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");
327 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
329 ok(!strcmp(ret
, "French_France.1252"), "ret = %s\n", ret
);
331 ret
= setlocale(LC_ALL
, "french-belgian");
332 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
334 ok(!strcmp(ret
, "French_Belgium.1252")
335 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
337 ret
= setlocale(LC_ALL
, "french-canadian");
338 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
340 ok(!strcmp(ret
, "French_Canada.1252")
341 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
343 ret
= setlocale(LC_ALL
, "french-swiss");
344 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
346 ok(!strcmp(ret
, "French_Switzerland.1252")
347 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
349 ret
= setlocale(LC_ALL
, "frs");
350 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
352 ok(!strcmp(ret
, "French_Switzerland.1252")
353 || broken(!strcmp(ret
, "French_France.1252")), "ret = %s\n", ret
);
355 ret
= setlocale(LC_ALL
, "german");
356 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
358 ok(!strcmp(ret
, "German_Germany.1252"), "ret = %s\n", ret
);
360 ret
= setlocale(LC_ALL
, "german-austrian");
361 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
363 ok(!strcmp(ret
, "German_Austria.1252")
364 || broken(!strcmp(ret
, "German_Germany.1252")), "ret = %s\n", ret
);
366 ret
= setlocale(LC_ALL
, "german-swiss");
367 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
369 ok(!strcmp(ret
, "German_Switzerland.1252")
370 || broken(!strcmp(ret
, "German_Germany.1252")), "ret = %s\n", ret
);
372 ret
= setlocale(LC_ALL
, "greek");
373 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
375 ok(!strcmp(ret
, "Greek_Greece.1253"), "ret = %s\n", ret
);
377 ret
= setlocale(LC_ALL
, "hun");
378 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
380 ok(!strcmp(ret
, "Hungarian_Hungary.1250"), "ret = %s\n", ret
);
382 ret
= setlocale(LC_ALL
, "hungarian");
383 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
385 ok(!strcmp(ret
, "Hungarian_Hungary.1250"), "ret = %s\n", ret
);
387 ret
= setlocale(LC_ALL
, "icelandic");
388 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
390 ok(!strcmp(ret
, "Icelandic_Iceland.1252"), "ret = %s\n", ret
);
392 ret
= setlocale(LC_ALL
, "isl");
393 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
395 ok(!strcmp(ret
, "Icelandic_Iceland.1252"), "ret = %s\n", ret
);
397 ret
= setlocale(LC_ALL
, "ita");
398 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
400 ok(!strcmp(ret
, "Italian_Italy.1252"), "ret = %s\n", ret
);
402 ret
= setlocale(LC_ALL
, "italian");
403 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
405 ok(!strcmp(ret
, "Italian_Italy.1252"), "ret = %s\n", ret
);
407 ret
= setlocale(LC_ALL
, "italian-swiss");
408 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
410 ok(!strcmp(ret
, "Italian_Switzerland.1252")
411 || broken(!strcmp(ret
, "Italian_Italy.1252")), "ret = %s\n", ret
);
413 ret
= setlocale(LC_ALL
, "its");
414 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
416 ok(!strcmp(ret
, "Italian_Switzerland.1252")
417 || broken(!strcmp(ret
, "Italian_Italy.1252")), "ret = %s\n", ret
);
419 ret
= setlocale(LC_ALL
, "japanese");
420 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
422 ok(!strcmp(ret
, "Japanese_Japan.932"), "ret = %s\n", ret
);
424 ret
= setlocale(LC_ALL
, "jpn");
425 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
427 ok(!strcmp(ret
, "Japanese_Japan.932"), "ret = %s\n", ret
);
429 ret
= setlocale(LC_ALL
, "korean");
430 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
432 ok(!strcmp(ret
, "Korean_Korea.949"), "ret = %s\n", ret
);
434 ret
= setlocale(LC_ALL
, "korean");
435 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
437 ok(!strcmp(ret
, "Korean_Korea.949"), "ret = %s\n", ret
);
439 ret
= setlocale(LC_ALL
, "nlb");
440 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
442 ok(!strcmp(ret
, "Dutch_Belgium.1252")
443 || broken(!strcmp(ret
, "Dutch_Netherlands.1252")), "ret = %s\n", ret
);
445 ret
= setlocale(LC_ALL
, "nld");
446 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
448 ok(!strcmp(ret
, "Dutch_Netherlands.1252"), "ret = %s\n", ret
);
450 ret
= setlocale(LC_ALL
, "non");
451 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
453 ok(!strcmp( ret
, "Norwegian-Nynorsk_Norway.1252")
454 || !strcmp(ret
, "Norwegian (Nynorsk)_Norway.1252")
455 || broken(!strcmp(ret
, "Norwegian (Bokm\xe5l)_Norway.1252"))
456 || broken(!strcmp(ret
, "Norwegian_Norway.1252")), "ret = %s\n", ret
);
458 ret
= setlocale(LC_ALL
, "nor");
459 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
461 ok(!strcmp(ret
, "Norwegian (Bokm\xe5l)_Norway.1252")
462 || !strcmp(ret
, "Norwegian (Bokmal)_Norway.1252")
463 || broken(!strcmp(ret
, "Norwegian_Norway.1252")), "ret = %s\n", ret
);
465 ret
= setlocale(LC_ALL
, "norwegian-bokmal");
466 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
468 ok(!strcmp(ret
, "Norwegian (Bokm\xe5l)_Norway.1252")
469 || !strcmp(ret
, "Norwegian (Bokmal)_Norway.1252")
470 || broken(!strcmp(ret
, "Norwegian_Norway.1252")), "ret = %s\n", ret
);
472 ret
= setlocale(LC_ALL
, "norwegian-nynorsk");
473 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
475 ok(!strcmp(ret
, "Norwegian-Nynorsk_Norway.1252")
476 || !strcmp(ret
, "Norwegian (Nynorsk)_Norway.1252")
477 || broken(!strcmp(ret
, "Norwegian_Norway.1252"))
478 || broken(!strcmp(ret
, "Norwegian (Bokmal)_Norway.1252"))
479 || broken(!strcmp(ret
, "Norwegian (Bokm\xe5l)_Norway.1252")), "ret = %s\n", ret
);
481 ret
= setlocale(LC_ALL
, "plk");
482 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
484 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
486 ret
= setlocale(LC_ALL
, "polish");
487 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
489 ok(!strcmp(ret
, "Polish_Poland.1250"), "ret = %s\n", ret
);
491 ret
= setlocale(LC_ALL
, "portuguese");
492 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
494 ok(!strcmp(ret
, "Portuguese_Brazil.1252")
495 || broken(!strcmp(ret
, "Portuguese_Portugal.1252")) /* NT4 */, "ret = %s\n", ret
);
497 ret
= setlocale(LC_ALL
, "portuguese-brazil");
498 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
500 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
502 ret
= setlocale(LC_ALL
, "ptb");
503 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
505 ok(!strcmp(ret
, "Portuguese_Brazil.1252"), "ret = %s\n", ret
);
507 ret
= setlocale(LC_ALL
, "ptg");
508 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
510 ok(!strcmp(ret
, "Portuguese_Portugal.1252"), "ret = %s\n", ret
);
512 ret
= setlocale(LC_ALL
, "rus");
513 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
515 ok(!strcmp(ret
, "Russian_Russia.1251"), "ret = %s\n", ret
);
517 ret
= setlocale(LC_ALL
, "russian");
518 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
520 ok(!strcmp(ret
, "Russian_Russia.1251"), "ret = %s\n", ret
);
522 ret
= setlocale(LC_ALL
, "sky");
523 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
525 ok(!strcmp(ret
, "Slovak_Slovakia.1250"), "ret = %s\n", ret
);
527 ret
= setlocale(LC_ALL
, "slovak");
528 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
530 ok(!strcmp(ret
, "Slovak_Slovakia.1250"), "ret = %s\n", ret
);
532 ret
= setlocale(LC_ALL
, "spanish");
533 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
535 ok(!strcmp(ret
, "Spanish_Spain.1252")
536 || broken(!strcmp(ret
, "Spanish - Traditional Sort_Spain.1252")), "ret = %s\n", ret
);
538 ret
= setlocale(LC_ALL
, "spanish-mexican");
539 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
541 ok(!strcmp(ret
, "Spanish_Mexico.1252")
542 || broken(!strcmp(ret
, "Spanish_Spain.1252")), "ret = %s\n", ret
);
544 ret
= setlocale(LC_ALL
, "spanish-modern");
545 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
547 ok(!strcmp(ret
, "Spanish - Modern Sort_Spain.1252")
548 || !strcmp(ret
, "Spanish_Spain.1252"), "ret = %s\n", ret
);
550 ret
= setlocale(LC_ALL
, "sve");
551 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
553 ok(!strcmp(ret
, "Swedish_Sweden.1252"), "ret = %s\n", ret
);
555 ret
= setlocale(LC_ALL
, "swedish");
556 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
558 ok(!strcmp(ret
, "Swedish_Sweden.1252"), "ret = %s\n", ret
);
560 ret
= setlocale(LC_ALL
, "swiss");
561 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
563 ok(!strcmp(ret
, "German_Switzerland.1252"), "ret = %s\n", ret
);
565 ret
= setlocale(LC_ALL
, "trk");
566 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
568 ok(!strcmp(ret
, "Turkish_Turkey.1254"), "ret = %s\n", ret
);
570 ret
= setlocale(LC_ALL
, "turkish");
571 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
573 ok(!strcmp(ret
, "Turkish_Turkey.1254"), "ret = %s\n", ret
);
575 ret
= setlocale(LC_ALL
, "uk");
576 ok(ret
!= NULL
, "ret == NULL\n");
578 ok(!strcmp(ret
, "English_United Kingdom.1252")
579 || broken(!strcmp(ret
, "Ukrainian_Ukraine.1251")), "ret = %s\n", ret
);
581 ret
= setlocale(LC_ALL
, "us");
582 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
584 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
586 ret
= setlocale(LC_ALL
, "usa");
587 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
589 ok(!strcmp(ret
, "English_United States.1252"), "ret = %s\n", ret
);
591 ret
= setlocale(LC_ALL
, "English_United States.ACP");
592 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
594 strcpy(buf
, "English_United States.");
595 GetLocaleInfoA(MAKELCID(MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), SORT_DEFAULT
),
596 LOCALE_IDEFAULTANSICODEPAGE
, buf
+strlen(buf
), 80);
597 ok(!strcmp(ret
, buf
), "ret = %s, expected %s\n", ret
, buf
);
600 ret
= setlocale(LC_ALL
, "English_United States.OCP");
601 ok(ret
!= NULL
|| broken (ret
== NULL
), "ret == NULL\n");
603 strcpy(buf
, "English_United States.");
604 GetLocaleInfoA(MAKELCID(MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), SORT_DEFAULT
),
605 LOCALE_IDEFAULTCODEPAGE
, buf
+strlen(buf
), 80);
606 ok(!strcmp(ret
, buf
), "ret = %s, expected %s\n", ret
, buf
);
609 ret
= setlocale(LC_ALL
, "English_United States.UTF8");
610 ok(ret
== NULL
, "ret != NULL\n");
613 static void test_crtGetStringTypeW(void)
615 static const wchar_t str0
[] = { '0', '\0' };
616 static const wchar_t strA
[] = { 'A', '\0' };
617 static const wchar_t str_space
[] = { ' ', '\0' };
618 static const wchar_t str_null
[] = { '\0', '\0' };
619 static const wchar_t str_rand
[] = { 1234, '\0' };
621 const wchar_t *str
[] = { str0
, strA
, str_space
, str_null
, str_rand
};
627 if(!p__crtGetStringTypeW
) {
628 win_skip("Skipping __crtGetStringTypeW tests\n");
633 win_skip("Too old version of msvcrt.dll\n");
637 for(i
=0; i
<sizeof(str
)/sizeof(*str
); i
++) {
638 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE1
, str
[i
], 1, &out_crt
);
639 ret
= GetStringTypeW(CT_CTYPE1
, str
[i
], 1, &out
);
640 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
641 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
643 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE2
, str
[i
], 1, &out_crt
);
644 ret
= GetStringTypeW(CT_CTYPE2
, str
[i
], 1, &out
);
645 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
646 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
648 ret_crt
= p__crtGetStringTypeW(0, CT_CTYPE3
, str
[i
], 1, &out_crt
);
649 ret
= GetStringTypeW(CT_CTYPE3
, str
[i
], 1, &out
);
650 ok(ret
== ret_crt
, "%d) ret_crt = %d\n", i
, (int)ret_crt
);
651 ok(out
== out_crt
, "%d) out_crt = %x, expected %x\n", i
, (int)out_crt
, (int)out
);
654 ret
= p__crtGetStringTypeW(0, 3, str
[0], 1, &out
);
655 ok(!ret
, "ret == TRUE\n");
658 static void test__Gettnames(void)
670 if(!setlocale(LC_ALL
, "english"))
674 size
= ret
->data
-(char*)ret
;
675 /* Newer version of the structure stores both ascii and unicode strings.
676 * Unicode strings are only initialized on Windows 7
678 if(sizeof(void*) == 8)
679 ok(size
==0x2c0 || broken(size
==0x170), "strucure size: %x\n", size
);
681 ok(size
==0x164 || broken(size
==0xb8), "strucure size: %x\n", size
);
683 ok(!strcmp(ret
->str
[0], "Sun"), "ret->str[0] = %s\n", ret
->str
[0]);
684 ok(!strcmp(ret
->str
[1], "Mon"), "ret->str[1] = %s\n", ret
->str
[1]);
685 ok(!strcmp(ret
->str
[2], "Tue"), "ret->str[2] = %s\n", ret
->str
[2]);
686 ok(!strcmp(ret
->str
[3], "Wed"), "ret->str[3] = %s\n", ret
->str
[3]);
687 ok(!strcmp(ret
->str
[4], "Thu"), "ret->str[4] = %s\n", ret
->str
[4]);
688 ok(!strcmp(ret
->str
[5], "Fri"), "ret->str[5] = %s\n", ret
->str
[5]);
689 ok(!strcmp(ret
->str
[6], "Sat"), "ret->str[6] = %s\n", ret
->str
[6]);
690 ok(!strcmp(ret
->str
[7], "Sunday"), "ret->str[7] = %s\n", ret
->str
[7]);
691 ok(!strcmp(ret
->str
[8], "Monday"), "ret->str[8] = %s\n", ret
->str
[8]);
692 ok(!strcmp(ret
->str
[9], "Tuesday"), "ret->str[9] = %s\n", ret
->str
[9]);
693 ok(!strcmp(ret
->str
[10], "Wednesday"), "ret->str[10] = %s\n", ret
->str
[10]);
694 ok(!strcmp(ret
->str
[11], "Thursday"), "ret->str[11] = %s\n", ret
->str
[11]);
695 ok(!strcmp(ret
->str
[12], "Friday"), "ret->str[12] = %s\n", ret
->str
[12]);
696 ok(!strcmp(ret
->str
[13], "Saturday"), "ret->str[13] = %s\n", ret
->str
[13]);
697 ok(!strcmp(ret
->str
[14], "Jan"), "ret->str[14] = %s\n", ret
->str
[14]);
698 ok(!strcmp(ret
->str
[15], "Feb"), "ret->str[15] = %s\n", ret
->str
[15]);
699 ok(!strcmp(ret
->str
[16], "Mar"), "ret->str[16] = %s\n", ret
->str
[16]);
700 ok(!strcmp(ret
->str
[17], "Apr"), "ret->str[17] = %s\n", ret
->str
[17]);
701 ok(!strcmp(ret
->str
[18], "May"), "ret->str[18] = %s\n", ret
->str
[18]);
702 ok(!strcmp(ret
->str
[19], "Jun"), "ret->str[19] = %s\n", ret
->str
[19]);
703 ok(!strcmp(ret
->str
[20], "Jul"), "ret->str[20] = %s\n", ret
->str
[20]);
704 ok(!strcmp(ret
->str
[21], "Aug"), "ret->str[21] = %s\n", ret
->str
[21]);
705 ok(!strcmp(ret
->str
[22], "Sep"), "ret->str[22] = %s\n", ret
->str
[22]);
706 ok(!strcmp(ret
->str
[23], "Oct"), "ret->str[23] = %s\n", ret
->str
[23]);
707 ok(!strcmp(ret
->str
[24], "Nov"), "ret->str[24] = %s\n", ret
->str
[24]);
708 ok(!strcmp(ret
->str
[25], "Dec"), "ret->str[25] = %s\n", ret
->str
[25]);
709 ok(!strcmp(ret
->str
[26], "January"), "ret->str[26] = %s\n", ret
->str
[26]);
710 ok(!strcmp(ret
->str
[27], "February"), "ret->str[27] = %s\n", ret
->str
[27]);
711 ok(!strcmp(ret
->str
[28], "March"), "ret->str[28] = %s\n", ret
->str
[28]);
712 ok(!strcmp(ret
->str
[29], "April"), "ret->str[29] = %s\n", ret
->str
[29]);
713 ok(!strcmp(ret
->str
[30], "May"), "ret->str[30] = %s\n", ret
->str
[30]);
714 ok(!strcmp(ret
->str
[31], "June"), "ret->str[31] = %s\n", ret
->str
[31]);
715 ok(!strcmp(ret
->str
[32], "July"), "ret->str[32] = %s\n", ret
->str
[32]);
716 ok(!strcmp(ret
->str
[33], "August"), "ret->str[33] = %s\n", ret
->str
[33]);
717 ok(!strcmp(ret
->str
[34], "September"), "ret->str[34] = %s\n", ret
->str
[34]);
718 ok(!strcmp(ret
->str
[35], "October"), "ret->str[35] = %s\n", ret
->str
[35]);
719 ok(!strcmp(ret
->str
[36], "November"), "ret->str[36] = %s\n", ret
->str
[36]);
720 ok(!strcmp(ret
->str
[37], "December"), "ret->str[37] = %s\n", ret
->str
[37]);
721 ok(!strcmp(ret
->str
[38], "AM"), "ret->str[38] = %s\n", ret
->str
[38]);
722 ok(!strcmp(ret
->str
[39], "PM"), "ret->str[39] = %s\n", ret
->str
[39]);
723 ok(!strcmp(ret
->str
[40], "M/d/yyyy") || broken(!strcmp(ret
->str
[40], "M/d/yy"))/*NT*/,
724 "ret->str[40] = %s\n", ret
->str
[40]);
725 size
= GetLocaleInfoA(MAKELCID(LANG_ENGLISH
, SORT_DEFAULT
),
726 LOCALE_SLONGDATE
|LOCALE_NOUSEROVERRIDE
, buf
, sizeof(buf
));
727 ok(size
, "GetLocaleInfo failed: %x\n", GetLastError());
728 ok(!strcmp(ret
->str
[41], buf
), "ret->str[41] = %s, expected %s\n", ret
->str
[41], buf
);
731 if(!setlocale(LC_TIME
, "german"))
735 ok(!strcmp(ret
->str
[0], "So"), "ret->str[0] = %s\n", ret
->str
[0]);
736 ok(!strcmp(ret
->str
[1], "Mo"), "ret->str[1] = %s\n", ret
->str
[1]);
737 ok(!strcmp(ret
->str
[2], "Di"), "ret->str[2] = %s\n", ret
->str
[2]);
738 ok(!strcmp(ret
->str
[3], "Mi"), "ret->str[3] = %s\n", ret
->str
[3]);
739 ok(!strcmp(ret
->str
[4], "Do"), "ret->str[4] = %s\n", ret
->str
[4]);
740 ok(!strcmp(ret
->str
[5], "Fr"), "ret->str[5] = %s\n", ret
->str
[5]);
741 ok(!strcmp(ret
->str
[6], "Sa"), "ret->str[6] = %s\n", ret
->str
[6]);
742 ok(!strcmp(ret
->str
[7], "Sonntag"), "ret->str[7] = %s\n", ret
->str
[7]);
743 ok(!strcmp(ret
->str
[8], "Montag"), "ret->str[8] = %s\n", ret
->str
[8]);
744 ok(!strcmp(ret
->str
[9], "Dienstag"), "ret->str[9] = %s\n", ret
->str
[9]);
745 ok(!strcmp(ret
->str
[10], "Mittwoch"), "ret->str[10] = %s\n", ret
->str
[10]);
746 ok(!strcmp(ret
->str
[11], "Donnerstag"), "ret->str[11] = %s\n", ret
->str
[11]);
747 ok(!strcmp(ret
->str
[12], "Freitag"), "ret->str[12] = %s\n", ret
->str
[12]);
748 ok(!strcmp(ret
->str
[13], "Samstag"), "ret->str[13] = %s\n", ret
->str
[13]);
749 ok(!strcmp(ret
->str
[14], "Jan"), "ret->str[14] = %s\n", ret
->str
[14]);
750 ok(!strcmp(ret
->str
[15], "Feb"), "ret->str[15] = %s\n", ret
->str
[15]);
751 ok(!strcmp(ret
->str
[16], "Mrz"), "ret->str[16] = %s\n", ret
->str
[16]);
752 ok(!strcmp(ret
->str
[17], "Apr"), "ret->str[17] = %s\n", ret
->str
[17]);
753 ok(!strcmp(ret
->str
[18], "Mai"), "ret->str[18] = %s\n", ret
->str
[18]);
754 ok(!strcmp(ret
->str
[19], "Jun"), "ret->str[19] = %s\n", ret
->str
[19]);
755 ok(!strcmp(ret
->str
[20], "Jul"), "ret->str[20] = %s\n", ret
->str
[20]);
756 ok(!strcmp(ret
->str
[21], "Aug"), "ret->str[21] = %s\n", ret
->str
[21]);
757 ok(!strcmp(ret
->str
[22], "Sep"), "ret->str[22] = %s\n", ret
->str
[22]);
758 ok(!strcmp(ret
->str
[23], "Okt"), "ret->str[23] = %s\n", ret
->str
[23]);
759 ok(!strcmp(ret
->str
[24], "Nov"), "ret->str[24] = %s\n", ret
->str
[24]);
760 ok(!strcmp(ret
->str
[25], "Dez"), "ret->str[25] = %s\n", ret
->str
[25]);
761 ok(!strcmp(ret
->str
[26], "Januar"), "ret->str[26] = %s\n", ret
->str
[26]);
762 ok(!strcmp(ret
->str
[27], "Februar"), "ret->str[27] = %s\n", ret
->str
[27]);
763 ok(!strcmp(ret
->str
[29], "April"), "ret->str[29] = %s\n", ret
->str
[29]);
764 ok(!strcmp(ret
->str
[30], "Mai"), "ret->str[30] = %s\n", ret
->str
[30]);
765 ok(!strcmp(ret
->str
[31], "Juni"), "ret->str[31] = %s\n", ret
->str
[31]);
766 ok(!strcmp(ret
->str
[32], "Juli"), "ret->str[32] = %s\n", ret
->str
[32]);
767 ok(!strcmp(ret
->str
[33], "August"), "ret->str[33] = %s\n", ret
->str
[33]);
768 ok(!strcmp(ret
->str
[34], "September"), "ret->str[34] = %s\n", ret
->str
[34]);
769 ok(!strcmp(ret
->str
[35], "Oktober"), "ret->str[35] = %s\n", ret
->str
[35]);
770 ok(!strcmp(ret
->str
[36], "November"), "ret->str[36] = %s\n", ret
->str
[36]);
771 ok(!strcmp(ret
->str
[37], "Dezember"), "ret->str[37] = %s\n", ret
->str
[37]);
772 ok(!strcmp(ret
->str
[38], ""), "ret->str[38] = %s\n", ret
->str
[38]);
773 ok(!strcmp(ret
->str
[39], ""), "ret->str[39] = %s\n", ret
->str
[39]);
774 ok(!strcmp(ret
->str
[40], "dd.MM.yyyy") || broken(!strcmp(ret
->str
[40], "dd.MM.yy"))/*NT*/,
775 "ret->str[40] = %s\n", ret
->str
[40]);
776 ok(!strcmp(ret
->str
[41], "dddd, d. MMMM yyyy"), "ret->str[41] = %s\n", ret
->str
[41]);
779 setlocale(LC_ALL
, "C");
782 static void test___mb_cur_max_func(void)
786 setlocale(LC_ALL
, "C");
788 /* for newer Windows */
789 if(!p___mb_cur_max_func
)
790 win_skip("Skipping ___mb_cur_max_func tests\n");
792 mb_cur_max
= p___mb_cur_max_func();
793 ok(mb_cur_max
== 1, "mb_cur_max = %d, expected 1\n", mb_cur_max
);
795 /* some old Windows don't set chinese */
796 if (!setlocale(LC_ALL
, "chinese"))
797 win_skip("Skipping test with chinese locale\n");
799 mb_cur_max
= p___mb_cur_max_func();
800 ok(mb_cur_max
== 2, "mb_cur_max = %d, expected 2\n", mb_cur_max
);
801 setlocale(LC_ALL
, "C");
805 /* for older Windows */
806 if (!p__p___mb_cur_max
)
807 win_skip("Skipping __p___mb_cur_max tests\n");
809 mb_cur_max
= *p__p___mb_cur_max();
810 ok(mb_cur_max
== 1, "mb_cur_max = %d, expected 1\n", mb_cur_max
);
812 /* some old Windows don't set chinese */
813 if (!setlocale(LC_ALL
, "chinese"))
814 win_skip("Skipping test with chinese locale\n");
816 mb_cur_max
= *p__p___mb_cur_max();
817 ok(mb_cur_max
== 2, "mb_cur_max = %d, expected 2\n", mb_cur_max
);
818 setlocale(LC_ALL
, "C");
827 test_crtGetStringTypeW();
830 test___mb_cur_max_func();