summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/regression/lib/libc/locale/test-btowc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/regression/lib/libc/locale/test-btowc.c b/tools/regression/lib/libc/locale/test-btowc.c
index 3e077f0..a28e4f5 100644
--- a/tools/regression/lib/libc/locale/test-btowc.c
+++ b/tools/regression/lib/libc/locale/test-btowc.c
@@ -28,7 +28,7 @@
* Test program for btowc() and wctob() as specified by IEEE Std. 1003.1-2001
* and ISO/IEC 9899:1999.
*
- * The function is tested in only the "C" locale.
+ * The function is tested in the "C" and "ja_JP.eucJP" locales.
*/
#include <sys/cdefs.h>
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <assert.h>
#include <limits.h>
+#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
@@ -45,11 +46,23 @@ main(int argc, char *argv[])
{
int i;
+ /*
+ * C/POSIX locale.
+ */
assert(btowc(EOF) == WEOF);
assert(wctob(WEOF) == EOF);
for (i = 0; i < UCHAR_MAX; i++)
assert(btowc(i) == (wchar_t)i && i == (int)wctob(i));
+ /*
+ * Japanese (EUC) locale.
+ */
+
+ assert(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0);
+ assert(MB_CUR_MAX > 1);
+ assert(btowc('A') == L'A' && wctob(L'A') == 'A');
+ assert(btowc(0xa3) == WEOF && wctob(0xa3c1) == EOF);
+
printf("PASS btowc()\n");
printf("PASS wctob()\n");
OpenPOWER on IntegriCloud