5 main (int argc
, char *argv
[])
12 i
= mbstowcs (w
, "bar", 4);
13 if (!(i
== 3 && w
[1] == 'a'))
15 puts ("mbstowcs FAILED!");
19 mbstowcs (w
, "blah", 5);
20 i
= wcstombs (c
, w
, 10);
23 puts ("wcstombs FAILED!");
27 if (mblen ("foobar", 7) != 1)
29 puts ("mblen 1 FAILED!");
33 if (mblen ("", 1) != 0)
35 puts ("mblen 2 FAILED!");
45 mbc
= (char *) malloc (MB_CUR_MAX
);
49 if ((r
= mbtowc (&wc
, &c
, MB_CUR_MAX
)) <= 0)
51 printf ("conversion to wide failed, result: %d\n", r
);
56 printf ("wide value: 0x%04lx\n", (unsigned long) wc
);
58 if ((r
= wctomb (mbc
, wc
)) <= 0)
60 printf ("conversion to multibyte failed, result: %d\n", r
);
67 puts (lose
? "Test FAILED!" : "Test succeeded.");