diff options
author | tjr <tjr@FreeBSD.org> | 2002-11-10 11:03:32 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-11-10 11:03:32 +0000 |
commit | b3f140b069f18b55e247bb2db421553802c0d62b (patch) | |
tree | cfbe8f351e82f8279d9d5210a36fd872d5f7ac88 /tools | |
parent | ca621988d2572c95badb1c0477e8f2a97bd7958d (diff) | |
download | FreeBSD-src-b3f140b069f18b55e247bb2db421553802c0d62b.zip FreeBSD-src-b3f140b069f18b55e247bb2db421553802c0d62b.tar.gz |
Add test cases for btowc() and wctob() in multibyte locales.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/lib/libc/locale/test-btowc.c | 15 |
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"); |