Merge glibc-ports into ports/ directory.
[platform/upstream/glibc.git] / stdlib / testmb2.c
1 /* Test case by Miloslav Trmac <mitr@volny.cz>.  */
2 #include <locale.h>
3 #include <stdint.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6
7 int
8 main (void)
9 {
10   wchar_t wc;
11
12   if (setlocale (LC_CTYPE, "de_DE.UTF-8") == NULL)
13     {
14       puts ("setlocale failed");
15       return 1;
16     }
17
18   if (mbtowc (&wc, "\xc3\xa1", MB_CUR_MAX) != 2 || wc != 0xE1)
19     {
20       puts ("1st mbtowc failed");
21       return 1;
22     }
23
24   if (mbtowc (&wc, "\xc3\xa1", SIZE_MAX) != 2 || wc != 0xE1)
25     {
26       puts ("2nd mbtowc failed");
27       return 1;
28     }
29
30   return 0;
31 }