kernel32: Update Italian translation.
[wine/testsucceed.git] / dlls / msvcrt / tests / locale.c
blobcf51c4c7eed1d26f2612a7adcbbab0b70cb45423
1 /*
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
21 #include <locale.h>
23 #include "wine/test.h"
24 #include "winnls.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";
42 char *ret, buf[100];
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");
61 return;
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);
73 strcpy(buf, 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");
82 if(ret)
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");
87 if(ret)
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");
92 if(ret)
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");
97 if(ret)
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");
102 if(ret)
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");
107 if(ret)
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");
112 if(ret)
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");
118 if(ret)
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");
124 if(ret)
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");
130 if(ret)
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");
136 if(ret)
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");
142 if(ret)
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");
147 if(ret)
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");
152 if(ret)
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");
157 if(ret)
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");
162 if(ret)
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");
167 if(ret)
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");
172 if(ret)
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");
177 if(ret)
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");
182 if(ret)
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");
188 if(ret)
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");
194 if(ret)
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");
199 if(ret)
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");
205 if(ret)
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");
211 if(ret)
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");
216 if(ret)
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");
222 if(ret)
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");
227 if(ret)
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");
232 if(ret)
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");
238 if(ret)
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");
244 if(ret)
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");
250 if(ret)
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");
256 if(ret)
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");
261 if(ret)
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");
266 if(ret)
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");
271 if(ret)
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");
277 if(ret)
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");
283 if(ret)
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");
288 if(ret)
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");
293 if(ret)
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");
298 if(ret)
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");
304 if(ret)
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");
310 if(ret)
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");
315 if(ret)
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");
321 if(ret)
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");
327 if(ret)
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");
333 if(ret)
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");
339 if(ret)
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");
344 if(ret)
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");
350 if(ret)
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");
356 if(ret)
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");
361 if(ret)
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");
366 if(ret)
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");
371 if(ret)
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");
376 if(ret)
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");
381 if(ret)
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");
386 if(ret)
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");
391 if(ret)
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");
396 if(ret)
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");
401 if(ret)
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");
406 if(ret)
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");
411 if(ret)
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");
416 if(ret)
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");
421 if(ret)
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");
427 if(ret)
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");
432 if(ret)
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");
440 if(ret)
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");
446 if(ret)
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");
452 if(ret)
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");
460 if(ret)
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");
465 if(ret)
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");
470 if(ret)
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");
475 if(ret)
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");
480 if(ret)
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");
485 if(ret)
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");
490 if(ret)
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");
495 if(ret)
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");
500 if(ret)
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");
505 if(ret)
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");
510 if(ret)
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");
516 if(ret)
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");
522 if(ret)
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");
528 if(ret)
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");
533 if(ret)
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");
538 if(ret)
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");
543 if(ret)
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");
548 if(ret)
549 ok(!strcmp(ret, "Turkish_Turkey.1254"), "ret = %s\n", ret);
551 ret = setlocale(LC_ALL, "uk");
552 ok(ret != NULL, "ret == NULL\n");
553 if(ret)
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");
559 if(ret)
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");
564 if(ret)
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 };
578 WORD out_crt, out;
579 BOOL ret_crt, ret;
580 int i;
582 if(!p__crtGetStringTypeW) {
583 win_skip("Skipping __crtGetStringTypeW tests\n");
584 return;
587 if(!pmemcpy_s) {
588 win_skip("Too old version of msvcrt.dll\n");
589 return;
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");
613 START_TEST(locale)
615 init();
617 test_crtGetStringTypeW();
618 test_setlocale();