summaryrefslogtreecommitdiff
path: root/test/locale-mbwc
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-24 20:22:12 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-24 20:22:12 +0200
commit7988979a722b4cdf287b2093956a76a3f19b9897 (patch)
treed35e251d0472ceca55a2eef61cff261c8ee68fab /test/locale-mbwc
add uClibc-ng test directory
Diffstat (limited to 'test/locale-mbwc')
-rw-r--r--test/locale-mbwc/Makefile8
-rw-r--r--test/locale-mbwc/Makefile.in30
-rw-r--r--test/locale-mbwc/dat_isw-funcs.h37
-rw-r--r--test/locale-mbwc/dat_iswalnum.c196
-rw-r--r--test/locale-mbwc/dat_iswalpha.c169
-rw-r--r--test/locale-mbwc/dat_iswcntrl.c125
-rw-r--r--test/locale-mbwc/dat_iswctype.c667
-rw-r--r--test/locale-mbwc/dat_iswdigit.c125
-rw-r--r--test/locale-mbwc/dat_iswgraph.c167
-rw-r--r--test/locale-mbwc/dat_iswlower.c96
-rw-r--r--test/locale-mbwc/dat_iswprint.c170
-rw-r--r--test/locale-mbwc/dat_iswpunct.c155
-rw-r--r--test/locale-mbwc/dat_iswspace.c129
-rw-r--r--test/locale-mbwc/dat_iswupper.c94
-rw-r--r--test/locale-mbwc/dat_iswxdigit.c125
-rw-r--r--test/locale-mbwc/dat_mblen.c137
-rw-r--r--test/locale-mbwc/dat_mbrlen.c222
-rw-r--r--test/locale-mbwc/dat_mbrtowc.c140
-rw-r--r--test/locale-mbwc/dat_mbsrtowcs.c180
-rw-r--r--test/locale-mbwc/dat_mbstowcs.c190
-rw-r--r--test/locale-mbwc/dat_mbtowc.c444
-rw-r--r--test/locale-mbwc/dat_strcoll.c209
-rw-r--r--test/locale-mbwc/dat_strfmon.c268
-rw-r--r--test/locale-mbwc/dat_strxfrm.c147
-rw-r--r--test/locale-mbwc/dat_swscanf.c185
-rw-r--r--test/locale-mbwc/dat_tow-funcs.h24
-rw-r--r--test/locale-mbwc/dat_towctrans.c97
-rw-r--r--test/locale-mbwc/dat_towlower.c47
-rw-r--r--test/locale-mbwc/dat_towupper.c47
-rw-r--r--test/locale-mbwc/dat_wcrtomb.c122
-rw-r--r--test/locale-mbwc/dat_wcscat.c116
-rw-r--r--test/locale-mbwc/dat_wcschr.c94
-rw-r--r--test/locale-mbwc/dat_wcscmp.c137
-rw-r--r--test/locale-mbwc/dat_wcscoll.c210
-rw-r--r--test/locale-mbwc/dat_wcscpy.c44
-rw-r--r--test/locale-mbwc/dat_wcscspn.c164
-rw-r--r--test/locale-mbwc/dat_wcslen.c62
-rw-r--r--test/locale-mbwc/dat_wcsncat.c158
-rw-r--r--test/locale-mbwc/dat_wcsncmp.c144
-rw-r--r--test/locale-mbwc/dat_wcsncpy.c119
-rw-r--r--test/locale-mbwc/dat_wcspbrk.c176
-rw-r--r--test/locale-mbwc/dat_wcsrtombs.c272
-rw-r--r--test/locale-mbwc/dat_wcsspn.c179
-rw-r--r--test/locale-mbwc/dat_wcsstr.c175
-rw-r--r--test/locale-mbwc/dat_wcstod.c78
-rw-r--r--test/locale-mbwc/dat_wcstok.c138
-rw-r--r--test/locale-mbwc/dat_wcstombs.c271
-rw-r--r--test/locale-mbwc/dat_wcswidth.c263
-rw-r--r--test/locale-mbwc/dat_wcsxfrm.c102
-rw-r--r--test/locale-mbwc/dat_wctob.c61
-rw-r--r--test/locale-mbwc/dat_wctomb.c168
-rw-r--r--test/locale-mbwc/dat_wctrans.c99
-rw-r--r--test/locale-mbwc/dat_wctype.c189
-rw-r--r--test/locale-mbwc/dat_wcwidth.c149
-rw-r--r--test/locale-mbwc/tgn_funcdef.h160
-rw-r--r--test/locale-mbwc/tgn_locdef.h32
-rw-r--r--test/locale-mbwc/tsp_common.c64
-rw-r--r--test/locale-mbwc/tst2_mbrtowc.c21
-rw-r--r--test/locale-mbwc/tst_funcs.h294
-rw-r--r--test/locale-mbwc/tst_iswalnum.c10
-rw-r--r--test/locale-mbwc/tst_iswalpha.c10
-rw-r--r--test/locale-mbwc/tst_iswcntrl.c10
-rw-r--r--test/locale-mbwc/tst_iswctype.c53
-rw-r--r--test/locale-mbwc/tst_iswdigit.c11
-rw-r--r--test/locale-mbwc/tst_iswgraph.c10
-rw-r--r--test/locale-mbwc/tst_iswlower.c10
-rw-r--r--test/locale-mbwc/tst_iswprint.c10
-rw-r--r--test/locale-mbwc/tst_iswpunct.c10
-rw-r--r--test/locale-mbwc/tst_iswspace.c10
-rw-r--r--test/locale-mbwc/tst_iswupper.c10
-rw-r--r--test/locale-mbwc/tst_iswxdigit.c10
-rw-r--r--test/locale-mbwc/tst_mblen.c85
-rw-r--r--test/locale-mbwc/tst_mbrlen.c82
-rw-r--r--test/locale-mbwc/tst_mbrtowc.c96
-rw-r--r--test/locale-mbwc/tst_mbsrtowcs.c109
-rw-r--r--test/locale-mbwc/tst_mbstowcs.c98
-rw-r--r--test/locale-mbwc/tst_mbtowc.c130
-rw-r--r--test/locale-mbwc/tst_strcoll.c87
-rw-r--r--test/locale-mbwc/tst_strfmon.c74
-rw-r--r--test/locale-mbwc/tst_strxfrm.c136
-rw-r--r--test/locale-mbwc/tst_swscanf.c137
-rw-r--r--test/locale-mbwc/tst_towctrans.c82
-rw-r--r--test/locale-mbwc/tst_towlower.c11
-rw-r--r--test/locale-mbwc/tst_towupper.c10
-rw-r--r--test/locale-mbwc/tst_types.h729
-rw-r--r--test/locale-mbwc/tst_wcrtomb.c79
-rw-r--r--test/locale-mbwc/tst_wcscat.c78
-rw-r--r--test/locale-mbwc/tst_wcschr.c70
-rw-r--r--test/locale-mbwc/tst_wcscmp.c40
-rw-r--r--test/locale-mbwc/tst_wcscoll.c76
-rw-r--r--test/locale-mbwc/tst_wcscpy.c85
-rw-r--r--test/locale-mbwc/tst_wcscspn.c38
-rw-r--r--test/locale-mbwc/tst_wcslen.c31
-rw-r--r--test/locale-mbwc/tst_wcsncat.c75
-rw-r--r--test/locale-mbwc/tst_wcsncmp.c40
-rw-r--r--test/locale-mbwc/tst_wcsncpy.c93
-rw-r--r--test/locale-mbwc/tst_wcspbrk.c80
-rw-r--r--test/locale-mbwc/tst_wcsrtombs.c127
-rw-r--r--test/locale-mbwc/tst_wcsspn.c38
-rw-r--r--test/locale-mbwc/tst_wcsstr.c86
-rw-r--r--test/locale-mbwc/tst_wcstod.c69
-rw-r--r--test/locale-mbwc/tst_wcstok.c96
-rw-r--r--test/locale-mbwc/tst_wcstombs.c115
-rw-r--r--test/locale-mbwc/tst_wcswidth.c39
-rw-r--r--test/locale-mbwc/tst_wcsxfrm.c122
-rw-r--r--test/locale-mbwc/tst_wctob.c37
-rw-r--r--test/locale-mbwc/tst_wctomb.c99
-rw-r--r--test/locale-mbwc/tst_wctrans.c52
-rw-r--r--test/locale-mbwc/tst_wctype.c48
-rw-r--r--test/locale-mbwc/tst_wcwidth.c38
110 files changed, 12672 insertions, 0 deletions
diff --git a/test/locale-mbwc/Makefile b/test/locale-mbwc/Makefile
new file mode 100644
index 0000000..263f325
--- /dev/null
+++ b/test/locale-mbwc/Makefile
@@ -0,0 +1,8 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+top_srcdir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/test/locale-mbwc/Makefile.in b/test/locale-mbwc/Makefile.in
new file mode 100644
index 0000000..6c0d894
--- /dev/null
+++ b/test/locale-mbwc/Makefile.in
@@ -0,0 +1,30 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
+
+TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl \
+ tst_iswctype tst_iswdigit tst_iswgraph \
+ tst_iswlower tst_iswprint tst_iswpunct \
+ tst_iswspace tst_iswupper tst_iswxdigit \
+ tst_mblen tst_mbrlen tst_mbrtowc tst_mbsrtowcs \
+ tst_mbstowcs tst_mbtowc tst_strcoll tst_strxfrm \
+ tst_swscanf tst_towctrans tst_towlower \
+ tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
+ tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
+ tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
+ tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
+ tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
+ tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
+ tst_wctype tst_wcwidth tst_strfmon \
+ tst2_mbrtowc
+
+# NOTE: For now disabled tst_strfmon to avoid build failure.
+TESTS_DISABLED := tst_strfmon
+
+ifneq ($(UCLIBC_HAS_FLOATS),y)
+TESTS_DISABLED += tst_swscanf tst_wcstod
+endif
+
+DODIFF_rint := 1
+
+EXTRA_CFLAGS := -D__USE_GNU -fno-builtin
diff --git a/test/locale-mbwc/dat_isw-funcs.h b/test/locale-mbwc/dat_isw-funcs.h
new file mode 100644
index 0000000..70aecb0
--- /dev/null
+++ b/test/locale-mbwc/dat_isw-funcs.h
@@ -0,0 +1,37 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_isw-funcs.h
+ *
+ * ISW*: int isw* (wint_t wc);
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+#define TST_ISW_LOC(FUNC, func) \
+ TST_ISW## FUNC tst_isw## func ##_loc []
+
+#define TST_ISW_REC(locale, func) \
+ { Tisw## func, TST_LOC_## locale },
+
+/*
+ * NOTE:
+ * Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
+ * Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
+ *
+ * Since the functions return *non*-zero value for TRUE, can't
+ * compare an actual return value with an expected return value.
+ * Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
+ * the non-zero value.
+ *
+ * { { WEOF }, { 0,1,0 } },
+ * | |
+ * | ret_val: an expected return value
+ * ret_flg: if 1, compare an actual return value with the
+ * ret_val; if 0, the test program
+ * checks the actual return value.
+ */
diff --git a/test/locale-mbwc/dat_iswalnum.c b/test/locale-mbwc/dat_iswalnum.c
new file mode 100644
index 0000000..5093703
--- /dev/null
+++ b/test/locale-mbwc/dat_iswalnum.c
@@ -0,0 +1,196 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswalnum.c
+ *
+ * ISW*: int iswalnum (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (ALNUM, alnum) = {
+
+ { TST_ISW_REC (de, alnum)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,0,0 } }, /* y dia */
+ { .is_last = 1 } /* last element */
+ }
+ },
+ { TST_ISW_REC (de_UTF8, alnum)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,0,0 } }, /* y dia */
+ { .is_last = 1 } /* last element */
+ }
+ },
+ { TST_ISW_REC (enUS, alnum)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,0,0 } },
+ { { 0x0039 }, { 0,0,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,0,0 } },
+ { { 0x005A }, { 0,0,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,0,0 } },
+ { { 0x007A }, { 0,0,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* last element */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, alnum)
+#else
+ { TST_ISW_REC (ja_UTF8, alnum)
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+#else
+ { { 0x3029 }, { 0,0,0 } }, /* Hangzhou NUM9 */
+#endif
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+#else
+ { { 0x3041 }, { 0,0,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,0,0 } }, /* HIRAGANA u" */
+#endif
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+#else
+ { { 0x309E }, { 0,0,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,0,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,0,0 } }, /* KATAKANA wo" */
+#endif
+ { { 0x30FB }, { 0,1,0 } }, /* KATAKANA MID.DOT */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x30FE }, { 0,1,0 } }, /* KATAKANA ITERATION */
+#else
+ { { 0x30FE }, { 0,0,0 } }, /* KATAKANA ITERATION */
+#endif
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x4E00 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+#else
+ { { 0x4E00 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#endif
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF0F }, { 0,1,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,0,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,0,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,1,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,1,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,1,0 } }, /* HALF KATA MID.DOT */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+#else
+ { { 0xFF66 }, { 0,0,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,0,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,0,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,0,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,0,0 } }, /* HALF KATA MI */
+#endif
+ { .is_last = 1 } /* last element */
+ }
+ },
+ { TST_ISW_REC (end, alnum) }
+};
diff --git a/test/locale-mbwc/dat_iswalpha.c b/test/locale-mbwc/dat_iswalpha.c
new file mode 100644
index 0000000..c2b59fb
--- /dev/null
+++ b/test/locale-mbwc/dat_iswalpha.c
@@ -0,0 +1,169 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswalpha.c
+ *
+ * ISW*: int iswalpha (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (ALPHA, alpha) = {
+
+ { TST_ISW_REC (de, alpha)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,0,0 } }, /* y dia */
+ { .is_last = 1 } /* last element */
+ }
+ },
+ { TST_ISW_REC (enUS, alpha)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,1,0 } },
+ { { 0x0039 }, { 0,1,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,0,0 } },
+ { { 0x005A }, { 0,0,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,0,0 } },
+ { { 0x007A }, { 0,0,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } }, /* 20 */
+ { .is_last = 1 } /* last element */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, alpha)
+#else
+ { TST_ISW_REC (ja_UTF8, alpha)
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+#else
+ { { 0x3029 }, { 0,0,0 } }, /* Hangzhou NUM9 */
+#endif
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+#else
+ { { 0x3041 }, { 0,0,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,0,0 } }, /* HIRAGANA u" */
+#endif
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+#else
+ { { 0x309E }, { 0,0,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,0,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,0,0 } }, /* KATAKANA wo" */
+#endif
+ { { 0x30FB }, { 0,1,0 } }, /* KATAKANA MID.DOT */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x30FE }, { 0,1,0 } }, /* KATAKANA ITERATION */
+#else
+ { { 0x30FE }, { 0,0,0 } }, /* KATAKANA ITERATION */
+#endif
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x4E00 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+#else
+ { { 0x4E00 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#endif
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF0F }, { 0,1,0 } }, /* FULL SLASH */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFF19 }, { 0,1,0 } }, /* FULL 9 */
+#else
+ { { 0xFF19 }, { 0,0,0 } }, /* FULL 9 */
+#endif
+ { { 0xFF20 }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,0,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,1,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,1,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,1,0 } }, /* HALF KATA MID.DOT */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+#else
+ { { 0xFF66 }, { 0,0,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,0,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,0,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,0,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,0,0 } }, /* HALF KATA MI */
+#endif
+ { .is_last = 1 } /* last element */
+ }
+ },
+ { TST_ISW_REC (end, alpha) }
+};
diff --git a/test/locale-mbwc/dat_iswcntrl.c b/test/locale-mbwc/dat_iswcntrl.c
new file mode 100644
index 0000000..e6ec685
--- /dev/null
+++ b/test/locale-mbwc/dat_iswcntrl.c
@@ -0,0 +1,125 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswcntrl.c
+ *
+ * ISW*: int iswcntrl (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (CNTRL, cntrl) = {
+
+ { TST_ISW_REC (de, cntrl)
+ {
+ { { 0x0080 }, { 0,0,0 } }, /* CTRL */
+ { { 0x009F }, { 0,0,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,1,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,1,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,1,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,1,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,1,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,1,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,1,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (enUS, cntrl)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,0,0 } },
+ { { 0x001F }, { 0,0,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,1,0 } },
+ { { 0x0039 }, { 0,1,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,1,0 } },
+ { { 0x005A }, { 0,1,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,1,0 } },
+ { { 0x007A }, { 0,1,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,0,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, cntrl)
+#else
+ { TST_ISW_REC (ja_UTF8, cntrl)
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0x30FB }, { 0,1,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE }, { 0,1,0 } }, /* KATAKANA ITERATION */
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+ { { 0x4E00 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF0F }, { 0,1,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,1,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,1,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,1,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,1,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,1,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,1,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC(end, cntrl) }
+};
diff --git a/test/locale-mbwc/dat_iswctype.c b/test/locale-mbwc/dat_iswctype.c
new file mode 100644
index 0000000..0dcf182
--- /dev/null
+++ b/test/locale-mbwc/dat_iswctype.c
@@ -0,0 +1,667 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswctype.c
+ *
+ * ISWCTYPE: int iswctype( wint_t wc, wctype_t charclass );
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+/*
+ * NOTE:
+ * Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
+ * Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
+ *
+ * Since the functions return *non*-zero value for TRUE, can't
+ * compare an actual return value with an expected return value.
+ * Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
+ * the non-zero value.
+ *
+ * { { WEOF }, { 0,1,0 } },
+ * | |
+ * | ret_val: an expected return value
+ * ret_flg: if 1, compare an actual return value with the
+ * ret_val; if 0, the test program checks
+ * the actual return value.
+ */
+
+TST_ISWCTYPE tst_iswctype_loc [] = {
+ {
+ { Tiswctype, TST_LOC_de },
+ {
+ { { 0x009F, "alnum" }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0, "alnum" }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1, "alnum" }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B1, "alnum" }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B3, "alnum" }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4, "alnum" }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00BB, "alnum" }, { 0,1,0 } }, /* >> */
+ { { 0x00BE, "alnum" }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF, "alnum" }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0, "alnum" }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6, "alnum" }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7, "alnum" }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8, "alnum" }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF, "alnum" }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0, "alnum" }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6, "alnum" }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7, "alnum" }, { 0,1,0 } }, /* division */
+ { { 0x00F8, "alnum" }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF, "alnum" }, { 0,0,0 } }, /* y dia */
+ { { 0x0080, "alpha" }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0, "alpha" }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1, "alpha" }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B1, "alpha" }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B4, "alpha" }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8, "alpha" }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9, "alpha" }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB, "alpha" }, { 0,1,0 } }, /* >> */
+ { { 0x00BE, "alpha" }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF, "alpha" }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0, "alpha" }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6, "alpha" }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7, "alpha" }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8, "alpha" }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF, "alpha" }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0, "alpha" }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6, "alpha" }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7, "alpha" }, { 0,1,0 } }, /* division */
+ { { 0x00F8, "alpha" }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF, "alpha" }, { 0,0,0 } }, /* y dia */
+ { { 0x0080, "cntrl" }, { 0,0,0 } }, /* CTRL */
+ { { 0x009F, "cntrl" }, { 0,0,0 } }, /* CTRL */
+ { { 0x00A0, "cntrl" }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00F6, "cntrl" }, { 0,1,0 } }, /* o dia */
+ { { 0x00FF, "cntrl" }, { 0,1,0 } }, /* y dia */
+ { { 0x00B9, "digit" }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BE, "digit" }, { 0,1,0 } }, /* 3/4 */
+ { { 0x009F, "graph" }, { 0,1,0 } }, /* CTRL */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x00A0, "graph" }, { 0,1,0 } }, /* NB SPACE */
+#else
+ { { 0x00A0, "graph" }, { 0,0,0 } }, /* NB SPACE */
+#endif
+ { { 0x00A1, "graph" }, { 0,0,0 } }, /* UD ! */
+ { { 0x00B1, "graph" }, { 0,0,0 } }, /* +- sign */
+ { { 0x00B3, "graph" }, { 0,0,0 } }, /* SUP 3 */
+ { { 0x00B4, "graph" }, { 0,0,0 } }, /* ACUTE */
+ { { 0x00BB, "graph" }, { 0,0,0 } }, /* >> */
+ { { 0x00BE, "graph" }, { 0,0,0 } }, /* 3/4 */
+ { { 0x00C0, "graph" }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6, "graph" }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7, "graph" }, { 0,0,0 } }, /* multipl. */
+ { { 0x00D8, "graph" }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF, "graph" }, { 0,0,0 } }, /* small Sh */
+ { { 0x00F7, "graph" }, { 0,0,0 } }, /* division */
+ { { 0x00F8, "graph" }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF, "graph" }, { 0,0,0 } }, /* y dia */
+ { { 0x009F, "print" }, { 0,1,0 } }, /* CTRL */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x00A0, "print" }, { 0,1,0 } }, /* NB SPACE */
+#else
+ { { 0x00A0, "print" }, { 0,0,0 } }, /* NB SPACE */
+#endif
+ { { 0x00A1, "print" }, { 0,0,0 } }, /* UD ! */
+ { { 0x00B1, "print" }, { 0,0,0 } }, /* +- sign */
+ { { 0x00B4, "print" }, { 0,0,0 } }, /* ACUTE */
+ { { 0x00B8, "print" }, { 0,0,0 } }, /* CEDILLA */
+ { { 0x00B9, "print" }, { 0,0,0 } }, /* SUP 1 */
+ { { 0x00BB, "print" }, { 0,0,0 } }, /* >> */
+ { { 0x00BE, "print" }, { 0,0,0 } }, /* 3/4 */
+ { { 0x00C0, "print" }, { 0,0,0 } }, /* A Grave */
+ { { 0x00DF, "print" }, { 0,0,0 } }, /* small Sh */
+ { { 0x00F6, "print" }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7, "print" }, { 0,0,0 } }, /* division */
+ { { 0x00F8, "print" }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF, "print" }, { 0,0,0 } }, /* y dia */
+ { { 0x009F, "punct" }, { 0,1,0 } }, /* CTRL */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x00A0, "punct" }, { 0,1,0 } }, /* NB SPACE */
+#else
+ { { 0x00A0, "punct" }, { 0,0,0 } }, /* NB SPACE */
+#endif
+ { { 0x00A1, "punct" }, { 0,0,0 } }, /* UD ! */
+ { { 0x00B0, "punct" }, { 0,0,0 } }, /* Degree */
+ { { 0x00B1, "punct" }, { 0,0,0 } }, /* +- sign */
+ { { 0x00B2, "punct" }, { 0,0,0 } }, /* SUP 2 */
+ { { 0x00B3, "punct" }, { 0,0,0 } }, /* SUP 3 */
+ { { 0x00B4, "punct" }, { 0,0,0 } }, /* ACUTE */
+ { { 0x00B8, "punct" }, { 0,0,0 } }, /* CEDILLA */
+ { { 0x00B9, "punct" }, { 0,0,0 } }, /* SUP 1 */
+ { { 0x00BB, "punct" }, { 0,0,0 } }, /* >> */
+ { { 0x00BC, "punct" }, { 0,0,0 } }, /* 1/4 */
+ { { 0x00BD, "punct" }, { 0,0,0 } }, /* 1/2 */
+ { { 0x00BE, "punct" }, { 0,0,0 } }, /* 3/4 */
+ { { 0x00BF, "punct" }, { 0,0,0 } }, /* UD ? */
+ { { 0x00C0, "punct" }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D7, "punct" }, { 0,0,0 } }, /* multipl. */
+ { { 0x00DF, "punct" }, { 0,1,0 } }, /* small Sh */
+ { { 0x00F6, "punct" }, { 0,1,0 } }, /* o dia */
+ { { 0x00F7, "punct" }, { 0,0,0 } }, /* division */
+ { { 0x00FF, "punct" }, { 0,1,0 } }, /* y dia */
+ { { 0x009F, "space" }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0, "space" }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1, "space" }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B1, "space" }, { 0,1,0 } }, /* +- sign */
+ { { 0x00F8, "space" }, { 0,1,0 } }, /* o stroke */
+ { { 0x00B3, "lower" }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B8, "lower" }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00BE, "lower" }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00C0, "lower" }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D6, "lower" }, { 0,1,0 } }, /* O dia */
+ { { 0x00D8, "lower" }, { 0,1,0 } }, /* O stroke */
+ { { 0x00DF, "lower" }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0, "lower" }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6, "lower" }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7, "lower" }, { 0,1,0 } }, /* division */
+ { { 0x00F8, "lower" }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF, "lower" }, { 0,0,0 } }, /* y dia */
+ { { 0x00B4, "upper" }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8, "upper" }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9, "upper" }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BE, "upper" }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF, "upper" }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0, "upper" }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6, "upper" }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7, "upper" }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8, "upper" }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF, "upper" }, { 0,1,0 } }, /* small Sh */
+ { { 0x00FF, "upper" }, { 0,1,0 } }, /* y dia */
+ { { 0x00B9, "xdigit" }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BC, "xdigit" }, { 0,1,0 } }, /* 1/4 */
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tiswctype, TST_LOC_enUS },
+ {
+ { { WEOF, "alnum" }, { 0,1,0 } },
+ { { 0x0000, "alnum" }, { 0,1,0 } },
+ { { 0x001F, "alnum" }, { 0,1,0 } },
+ { { 0x0020, "alnum" }, { 0,1,0 } },
+ { { 0x0021, "alnum" }, { 0,1,0 } },
+ { { 0x002F, "alnum" }, { 0,1,0 } },
+ { { 0x0030, "alnum" }, { 0,0,0 } },
+ { { 0x0039, "alnum" }, { 0,0,0 } },
+ { { 0x003A, "alnum" }, { 0,1,0 } },
+ { { 0x0040, "alnum" }, { 0,1,0 } },
+ { { 0x0041, "alnum" }, { 0,0,0 } },
+ { { 0x005A, "alnum" }, { 0,0,0 } },
+ { { 0x005B, "alnum" }, { 0,1,0 } },
+ { { 0x0060, "alnum" }, { 0,1,0 } },
+ { { 0x0061, "alnum" }, { 0,0,0 } },
+ { { 0x007A, "alnum" }, { 0,0,0 } },
+ { { 0x007B, "alnum" }, { 0,1,0 } },
+ { { 0x007E, "alnum" }, { 0,1,0 } },
+ { { 0x007F, "alnum" }, { 0,1,0 } },
+ { { 0x0080, "alnum" }, { 0,1,0 } },
+ { { 0x0000, "alpha" }, { 0,1,0 } },
+ { { 0x001F, "alpha" }, { 0,1,0 } },
+ { { 0x0020, "alpha" }, { 0,1,0 } },
+ { { 0x0021, "alpha" }, { 0,1,0 } },
+ { { 0x002F, "alpha" }, { 0,1,0 } },
+ { { 0x0030, "alpha" }, { 0,1,0 } },
+ { { 0x0039, "alpha" }, { 0,1,0 } },
+ { { 0x003A, "alpha" }, { 0,1,0 } },
+ { { 0x0040, "alpha" }, { 0,1,0 } },
+ { { 0x0041, "alpha" }, { 0,0,0 } },
+ { { 0x005A, "alpha" }, { 0,0,0 } },
+ { { 0x005B, "alpha" }, { 0,1,0 } },
+ { { 0x0060, "alpha" }, { 0,1,0 } },
+ { { 0x0061, "alpha" }, { 0,0,0 } },
+ { { 0x007A, "alpha" }, { 0,0,0 } },
+ { { 0x007B, "alpha" }, { 0,1,0 } },
+ { { 0x007E, "alpha" }, { 0,1,0 } },
+ { { 0x007F, "alpha" }, { 0,1,0 } },
+ { { 0x0080, "alpha" }, { 0,1,0 } },
+ { { 0x0009, "blank" }, { 0,0,0 } },
+ { { 0x000B, "blank" }, { 0,1,0 } },
+ { { 0x0020, "blank" }, { 0,0,0 } },
+ { { 0x0000, "cntrl" }, { 0,0,0 } },
+ { { 0x001F, "cntrl" }, { 0,0,0 } },
+ { { 0x0020, "cntrl" }, { 0,1,0 } },
+ { { 0x0021, "cntrl" }, { 0,1,0 } },
+ { { 0x002F, "cntrl" }, { 0,1,0 } },
+ { { 0x0030, "cntrl" }, { 0,1,0 } },
+ { { 0x0039, "cntrl" }, { 0,1,0 } },
+ { { 0x003A, "cntrl" }, { 0,1,0 } },
+ { { 0x0040, "cntrl" }, { 0,1,0 } },
+ { { 0x0041, "cntrl" }, { 0,1,0 } },
+ { { 0x005A, "cntrl" }, { 0,1,0 } },
+ { { 0x005B, "cntrl" }, { 0,1,0 } },
+ { { 0x0060, "cntrl" }, { 0,1,0 } },
+ { { 0x0061, "cntrl" }, { 0,1,0 } },
+ { { 0x007A, "cntrl" }, { 0,1,0 } },
+ { { 0x007B, "cntrl" }, { 0,1,0 } },
+ { { 0x007E, "cntrl" }, { 0,1,0 } },
+ { { 0x007F, "cntrl" }, { 0,0,0 } },
+ { { 0x0080, "cntrl" }, { 0,1,0 } },
+ { { 0x0000, "digit" }, { 0,1,0 } },
+ { { 0x001F, "digit" }, { 0,1,0 } },
+ { { 0x0020, "digit" }, { 0,1,0 } },
+ { { 0x0021, "digit" }, { 0,1,0 } },
+ { { 0x002F, "digit" }, { 0,1,0 } },
+ { { 0x0030, "digit" }, { 0,0,0 } },
+ { { 0x0039, "digit" }, { 0,0,0 } },
+ { { 0x003A, "digit" }, { 0,1,0 } },
+ { { 0x0040, "digit" }, { 0,1,0 } },
+ { { 0x0041, "digit" }, { 0,1,0 } },
+ { { 0x005A, "digit" }, { 0,1,0 } },
+ { { 0x005B, "digit" }, { 0,1,0 } },
+ { { 0x0060, "digit" }, { 0,1,0 } },
+ { { 0x0061, "digit" }, { 0,1,0 } },
+ { { 0x007A, "digit" }, { 0,1,0 } },
+ { { 0x007B, "digit" }, { 0,1,0 } },
+ { { 0x007E, "digit" }, { 0,1,0 } },
+ { { 0x007F, "digit" }, { 0,1,0 } },
+ { { 0x0080, "digit" }, { 0,1,0 } },
+ { { 0x0000, "graph" }, { 0,1,0 } },
+ { { 0x001F, "graph" }, { 0,1,0 } },
+ { { 0x0020, "graph" }, { 0,1,0 } },
+ { { 0x0021, "graph" }, { 0,0,0 } },
+ { { 0x002F, "graph" }, { 0,0,0 } },
+ { { 0x0030, "graph" }, { 0,0,0 } },
+ { { 0x0039, "graph" }, { 0,0,0 } },
+ { { 0x003A, "graph" }, { 0,0,0 } },
+ { { 0x0040, "graph" }, { 0,0,0 } },
+ { { 0x0041, "graph" }, { 0,0,0 } },
+ { { 0x005A, "graph" }, { 0,0,0 } },
+ { { 0x005B, "graph" }, { 0,0,0 } },
+ { { 0x0060, "graph" }, { 0,0,0 } },
+ { { 0x0061, "graph" }, { 0,0,0 } },
+ { { 0x007A, "graph" }, { 0,0,0 } },
+ { { 0x007B, "graph" }, { 0,0,0 } },
+ { { 0x007E, "graph" }, { 0,0,0 } },
+ { { 0x007F, "graph" }, { 0,1,0 } },
+ { { 0x0080, "graph" }, { 0,1,0 } },
+ { { 0x0000, "print" }, { 0,1,0 } },
+ { { 0x001F, "print" }, { 0,1,0 } },
+ { { 0x0020, "print" }, { 0,0,0 } },
+ { { 0x0021, "print" }, { 0,0,0 } },
+ { { 0x002F, "print" }, { 0,0,0 } },
+ { { 0x0030, "print" }, { 0,0,0 } },
+ { { 0x0039, "print" }, { 0,0,0 } },
+ { { 0x003A, "print" }, { 0,0,0 } },
+ { { 0x0040, "print" }, { 0,0,0 } },
+ { { 0x0041, "print" }, { 0,0,0 } },
+ { { 0x005A, "print" }, { 0,0,0 } },
+ { { 0x005B, "print" }, { 0,0,0 } },
+ { { 0x0060, "print" }, { 0,0,0 } },
+ { { 0x0061, "print" }, { 0,0,0 } },
+ { { 0x007A, "print" }, { 0,0,0 } },
+ { { 0x007B, "print" }, { 0,0,0 } },
+ { { 0x007E, "print" }, { 0,0,0 } },
+ { { 0x007F, "print" }, { 0,1,0 } },
+ { { 0x0080, "print" }, { 0,1,0 } },
+ { { 0x0000, "punct" }, { 0,1,0 } },
+ { { 0x001F, "punct" }, { 0,1,0 } },
+ { { 0x0020, "punct" }, { 0,1,0 } },
+ { { 0x0021, "punct" }, { 0,0,0 } },
+ { { 0x002F, "punct" }, { 0,0,0 } },
+ { { 0x0030, "punct" }, { 0,1,0 } },
+ { { 0x0039, "punct" }, { 0,1,0 } },
+ { { 0x003A, "punct" }, { 0,0,0 } },
+ { { 0x0040, "punct" }, { 0,0,0 } },
+ { { 0x0041, "punct" }, { 0,1,0 } },
+ { { 0x005A, "punct" }, { 0,1,0 } },
+ { { 0x005B, "punct" }, { 0,0,0 } },
+ { { 0x0060, "punct" }, { 0,0,0 } },
+ { { 0x0061, "punct" }, { 0,1,0 } },
+ { { 0x007A, "punct" }, { 0,1,0 } },
+ { { 0x007B, "punct" }, { 0,0,0 } },
+ { { 0x007E, "punct" }, { 0,0,0 } },
+ { { 0x007F, "punct" }, { 0,1,0 } },
+ { { 0x0080, "punct" }, { 0,1,0 } },
+ { { 0x0000, "space" }, { 0,1,0 } },
+ { { 0x001F, "space" }, { 0,1,0 } },
+ { { 0x0020, "space" }, { 0,0,0 } },
+ { { 0x0021, "space" }, { 0,1,0 } },
+ { { 0x002F, "space" }, { 0,1,0 } },
+ { { 0x007E, "space" }, { 0,1,0 } },
+ { { 0x007F, "space" }, { 0,1,0 } },
+ { { 0x0080, "space" }, { 0,1,0 } },
+ { { 0x0000, "lower" }, { 0,1,0 } },
+ { { 0x001F, "lower" }, { 0,1,0 } },
+ { { 0x0020, "lower" }, { 0,1,0 } },
+ { { 0x0021, "lower" }, { 0,1,0 } },
+ { { 0x002F, "lower" }, { 0,1,0 } },
+ { { 0x0030, "lower" }, { 0,1,0 } },
+ { { 0x0039, "lower" }, { 0,1,0 } },
+ { { 0x003A, "lower" }, { 0,1,0 } },
+ { { 0x0040, "lower" }, { 0,1,0 } },
+ { { 0x0041, "lower" }, { 0,1,0 } },
+ { { 0x005A, "lower" }, { 0,1,0 } },
+ { { 0x005B, "lower" }, { 0,1,0 } },
+ { { 0x0060, "lower" }, { 0,1,0 } },
+ { { 0x0061, "lower" }, { 0,0,0 } },
+ { { 0x007A, "lower" }, { 0,0,0 } },
+ { { 0x007B, "lower" }, { 0,1,0 } },
+ { { 0x007E, "lower" }, { 0,1,0 } },
+ { { 0x007F, "lower" }, { 0,1,0 } },
+ { { 0x0080, "lower" }, { 0,1,0 } },
+ { { 0x0000, "upper" }, { 0,1,0 } },
+ { { 0x001F, "upper" }, { 0,1,0 } },
+ { { 0x0020, "upper" }, { 0,1,0 } },
+ { { 0x0021, "upper" }, { 0,1,0 } },
+ { { 0x002F, "upper" }, { 0,1,0 } },
+ { { 0x0030, "upper" }, { 0,1,0 } },
+ { { 0x0039, "upper" }, { 0,1,0 } },
+ { { 0x003A, "upper" }, { 0,1,0 } },
+ { { 0x0040, "upper" }, { 0,1,0 } },
+ { { 0x0041, "upper" }, { 0,0,0 } },
+ { { 0x005A, "upper" }, { 0,0,0 } },
+ { { 0x005B, "upper" }, { 0,1,0 } },
+ { { 0x0060, "upper" }, { 0,1,0 } },
+ { { 0x0061, "upper" }, { 0,1,0 } },
+ { { 0x007A, "upper" }, { 0,1,0 } },
+ { { 0x007B, "upper" }, { 0,1,0 } },
+ { { 0x007E, "upper" }, { 0,1,0 } },
+ { { 0x007F, "upper" }, { 0,1,0 } },
+ { { 0x0080, "upper" }, { 0,1,0 } },
+ { { 0x0000, "xdigit" }, { 0,1,0 } },
+ { { 0x001F, "xdigit" }, { 0,1,0 } },
+ { { 0x0020, "xdigit" }, { 0,1,0 } },
+ { { 0x0021, "xdigit" }, { 0,1,0 } },
+ { { 0x002F, "xdigit" }, { 0,1,0 } },
+ { { 0x0030, "xdigit" }, { 0,0,0 } },
+ { { 0x0039, "xdigit" }, { 0,0,0 } },
+ { { 0x003A, "xdigit" }, { 0,1,0 } },
+ { { 0x0040, "xdigit" }, { 0,1,0 } },
+ { { 0x0041, "xdigit" }, { 0,0,0 } },
+ { { 0x005A, "xdigit" }, { 0,1,0 } },
+ { { 0x005B, "xdigit" }, { 0,1,0 } },
+ { { 0x0060, "xdigit" }, { 0,1,0 } },
+ { { 0x0061, "xdigit" }, { 0,0,0 } },
+ { { 0x007A, "xdigit" }, { 0,1,0 } },
+ { { 0x007B, "xdigit" }, { 0,1,0 } },
+ { { 0x007E, "xdigit" }, { 0,1,0 } },
+ { { 0x007F, "xdigit" }, { 0,1,0 } },
+ { { 0x0080, "xdigit" }, { 0,1,0 } },
+ { { 0x0061, "xxxxxx" }, { 0,1,0 } },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Tiswctype, TST_LOC_eucJP },
+#else
+ { Tiswctype, TST_LOC_ja_UTF8 },
+#endif
+ {
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3029, "alnum" }, { 0,1,0 } }, /* Hangzhou NUM9 */
+#else
+ { { 0x3029, "alnum" }, { 0,0,0 } }, /* Hangzhou NUM9 */
+#endif
+ { { 0xFE4F, "alnum" }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF19, "alnum" }, { 0,0,0 } }, /* FULL 9 */
+ { { 0xFF20, "alnum" }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A, "alnum" }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40, "alnum" }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A, "alnum" }, { 0,0,0 } }, /* FULL z */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFF71, "alnum" }, { 0,1,0 } }, /* HALF KATA A */
+#else
+ { { 0xFF71, "alnum" }, { 0,0,0 } }, /* HALF KATA A */
+#endif
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3029, "alpha" }, { 0,1,0 } }, /* Hangzhou NUM9 */
+#else
+ { { 0x3029, "alpha" }, { 0,0,0 } }, /* Hangzhou NUM9 */
+#endif
+ { { 0xFE4F, "alpha" }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFF19, "alpha" }, { 0,1,0 } }, /* FULL 9 */
+#else
+ { { 0xFF19, "alpha" }, { 0,0,0 } }, /* FULL 9 */
+#endif
+ { { 0xFF20, "alpha" }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A, "alpha" }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40, "alpha" }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A, "alpha" }, { 0,0,0 } }, /* FULL z */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFF71, "alpha" }, { 0,1,0 } }, /* HALF KATA A */
+#else
+ { { 0xFF71, "alpha" }, { 0,0,0 } }, /* HALF KATA A */
+#endif
+ { { 0x0080, "cntrl" }, { 0,0,0 } }, /* CNTRL */
+ { { 0x3000, "cntrl" }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x3029, "digit" }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x32CB, "digit" }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ /* 21: */
+ { { 0x33FE, "digit" }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+ { { 0xFF19, "digit" }, { 0,1,0 } }, /* FULL 9 */
+ { { 0x3000, "graph" }, { 0,1,0 } }, /* IDEO. SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3020, "graph" }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029, "graph" }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F, "graph" }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037, "graph" }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F, "graph" }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+#else
+ { { 0x3020, "graph" }, { 0,0,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029, "graph" }, { 0,0,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F, "graph" }, { 0,0,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037, "graph" }, { 0,0,0 } }, /* Separator Symbol */
+ { { 0x303F, "graph" }, { 0,0,0 } }, /* IDEO. HALF SPACE */
+#endif
+ /* 29: */
+ { { 0x3041, "graph" }, { 0,0,0 } }, /* HIRAGANA a */
+ /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3094, "graph" }, { 0,1,0 } }, /* HIRAGANA u" */
+#else
+ { { 0x3094, "graph" }, { 0,0,0 } }, /* HIRAGANA u" */
+#endif
+ /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3099, "graph" }, { 0,1,0 } }, /* SOUND MARK */
+#else
+ { { 0x3099, "graph" }, { 0,0,0 } }, /* SOUND MARK */
+#endif
+ { { 0x309E, "graph" }, { 0,0,0 } }, /* ITERATION MARK */
+ /* 33: */
+ { { 0x30A1, "graph" }, { 0,0,0 } }, /* KATAKANA a */
+ /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x30FA, "graph" }, { 0,1,0 } }, /* KATAKANA wo" */
+#else
+ { { 0x30FA, "graph" }, { 0,0,0 } }, /* KATAKANA wo" */
+#endif
+ { { 0x30FB, "graph" }, { 0,0,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE, "graph" }, { 0,0,0 } }, /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3191, "graph" }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243, "graph" }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB, "graph" }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE, "graph" }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE, "graph" }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+#else
+ { { 0x3191, "graph" }, { 0,0,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243, "graph" }, { 0,0,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB, "graph" }, { 0,0,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE, "graph" }, { 0,0,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE, "graph" }, { 0,0,0 } }, /* CJK IDEO.TEL.31th */
+#endif
+ { { 0x4E00, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x4E06, "graph" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x4E06, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ { { 0x4E07, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x9007, "graph" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4, "graph" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x9007, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ /* 51 */
+ { { 0x9FA5, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFE4F, "graph" }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+#else
+ { { 0xFE4F, "graph" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#endif
+ { { 0xFF0F, "graph" }, { 0,0,0 } }, /* FULL SLASH */
+ { { 0xFF19, "graph" }, { 0,0,0 } }, /* FULL 9 */
+ { { 0xFF20, "graph" }, { 0,0,0 } }, /* FULL @ */
+ { { 0xFF3A, "graph" }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40, "graph" }, { 0,0,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A, "graph" }, { 0,0,0 } }, /* FULL z */
+ { { 0xFF5E, "graph" }, { 0,0,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61, "graph" }, { 0,0,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65, "graph" }, { 0,0,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66, "graph" }, { 0,0,0 } }, /* HALF KATA WO */
+ { { 0xFF6F, "graph" }, { 0,0,0 } }, /* HALF KATA tu */
+ { { 0xFF70, "graph" }, { 0,0,0 } }, /* HALF KATA PL - */
+ { { 0xFF71, "graph" }, { 0,0,0 } }, /* HALF KATA A */
+ { { 0xFF9E, "graph" }, { 0,0,0 } }, /* HALF KATA MI */
+ { { 0x3000, "print" }, { 0,0,0 } }, /* IDEO. SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3020, "print" }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029, "print" }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F, "print" }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037, "print" }, { 0,1,0 } }, /* Separator Symbol */
+#else
+ { { 0x3020, "print" }, { 0,0,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029, "print" }, { 0,0,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F, "print" }, { 0,0,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037, "print" }, { 0,0,0 } }, /* Separator Symbol */
+#endif
+ { { 0x4E00, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x4E06, "print" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x4E06, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ { { 0x4E07, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x9007, "print" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4, "print" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x9007, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ /* 81: */
+ { { 0x9FA5, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFE4F, "print" }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+#else
+ { { 0xFE4F, "print" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#endif
+ { { 0x3000, "punct" }, { 0,1,0 } }, /* IDEO. SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3020, "punct" }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x302F, "punct" }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037, "punct" }, { 0,1,0 } }, /* FEED Separator */
+ { { 0x303F, "punct" }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+#else
+ { { 0x3020, "punct" }, { 0,0,0 } }, /* POSTAL MARK FACE */
+ { { 0x302F, "punct" }, { 0,0,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037, "punct" }, { 0,0,0 } }, /* FEED Separator */
+ { { 0x303F, "punct" }, { 0,0,0 } }, /* IDEO. HALF SPACE */
+#endif
+ { { 0x3041, "punct" }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094, "punct" }, { 0,1,0 } }, /* HIRAGANA u" */
+ /* 90: */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3099, "punct" }, { 0,1,0 } }, /* SOUND MARK */
+#else
+ { { 0x3099, "punct" }, { 0,0,0 } }, /* SOUND MARK */
+#endif
+ { { 0x309E, "punct" }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1, "punct" }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA, "punct" }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0x30FB, "punct" }, { 0,0,0 } }, /* KATAKANA MID.DOT */
+ /* 95: */
+ { { 0x30FE, "punct" }, { 0,1,0 } }, /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3191, "punct" }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243, "punct" }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB, "punct" }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE, "punct" }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE, "punct" }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+#else
+ { { 0x3191, "punct" }, { 0,0,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243, "punct" }, { 0,0,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB, "punct" }, { 0,0,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE, "punct" }, { 0,0,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE, "punct" }, { 0,0,0 } }, /* CJK IDEO.TEL.31th */
+#endif
+ { { 0x9007, "punct" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4, "punct" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5, "punct" }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF0F, "punct" }, { 0,0,0 } }, /* FULL SLASH */
+ /* 105: */
+ { { 0xFF19, "punct" }, { 0,1,0 } }, /* FULL 9 */
+ { { 0xFF20, "punct" }, { 0,0,0 } }, /* FULL @ */
+ { { 0xFF3A, "punct" }, { 0,1,0 } }, /* FULL Z */
+ { { 0xFF40, "punct" }, { 0,0,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A, "punct" }, { 0,1,0 } }, /* FULL z */
+ { { 0xFF5E, "punct" }, { 0,0,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61, "punct" }, { 0,0,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65, "punct" }, { 0,0,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF70, "punct" }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF9E, "punct" }, { 0,1,0 } }, /* HALF KATA MI */
+ /* 115: */
+ { { 0x3000, "space" }, { 0,0,0 } }, /* IDEO. SPACE */
+ { { 0x303F, "space" }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+ { { 0x3041, "lower" }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094, "lower" }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x30A1, "lower" }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA, "lower" }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0xFF66, "lower" }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F, "lower" }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70, "lower" }, { 0,1,0 } }, /* HALF KATA PL - */
+ /* 124: */
+ { { 0xFF71, "lower" }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E, "lower" }, { 0,1,0 } }, /* HALF KATA MI */
+ { { 0xFF71, "upper" }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF19, "xdigit" }, { 0,1,0 } }, /* FULL 9 */
+ { { 0x3000, "jspace" }, { 0,0,0 } }, /* IDEO. SPACE */
+ /* Non jis? */
+ { { 0x303F, "jspace" }, { 0,1,0 } }, /* IDEO.HALF SPACE */
+ { { 0xFF19, "jdigit" }, { 0,0,0 } }, /* FULL 9 */
+ { { 0x3041, "jhira" }, { 0,0,0 } }, /* HIRAGANA a */
+ { { 0x3094, "jhira" }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x30A1, "jkata" }, { 0,0,0 } }, /* KATAKANA a */
+ /* Non jis: */
+ { { 0x30FA, "jkata" }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0xFF66, "jkata" }, { 0,0,0 } }, /* HALF KATA WO */
+ { { 0xFF6F, "jkata" }, { 0,0,0 } }, /* HALF KATA tu */
+ { { 0x4E05, "jkanji" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ /* <NO_WAIVER>: */
+ { { 0x4E06, "jkanji" }, { 0,1,1 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ /* XXX This character does not exist in EUC-JP. */
+ { { 0x4E06, "jkanji" }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ { { 0x4E07, "jkanji" }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tiswctype, TST_LOC_end }
+ }
+};
+
+
+/* dat_isw-funcs.c */
diff --git a/test/locale-mbwc/dat_iswdigit.c b/test/locale-mbwc/dat_iswdigit.c
new file mode 100644
index 0000000..70ca544
--- /dev/null
+++ b/test/locale-mbwc/dat_iswdigit.c
@@ -0,0 +1,125 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswdigit.c
+ *
+ * ISW*: int iswdigit (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (DIGIT, digit) = {
+
+ { TST_ISW_REC (de, digit)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,1,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,1,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,1,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,1,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,1,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,1,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,1,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (enUS, digit)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,0,0 } },
+ { { 0x0039 }, { 0,0,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,1,0 } },
+ { { 0x005A }, { 0,1,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,1,0 } },
+ { { 0x007A }, { 0,1,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, digit)
+#else
+ { TST_ISW_REC (ja_UTF8, digit)
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0x30FB }, { 0,1,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE }, { 0,1,0 } }, /* KATAKANA ITERATION */
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+ { { 0x4E00 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF0F }, { 0,1,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,1,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,1,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,1,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,1,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,1,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,1,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (end, digit) }
+};
diff --git a/test/locale-mbwc/dat_iswgraph.c b/test/locale-mbwc/dat_iswgraph.c
new file mode 100644
index 0000000..80cacb2
--- /dev/null
+++ b/test/locale-mbwc/dat_iswgraph.c
@@ -0,0 +1,167 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswgraph.c
+ *
+ * ISW*: int iswgraph (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (GRAPH, graph) = {
+
+ { TST_ISW_REC (de, graph)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+#else
+ { { 0x00A0 }, { 0,0,0 } }, /* NB SPACE */
+#endif
+ { { 0x00A1 }, { 0,0,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,0,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,0,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,0,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,0,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,0,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,0,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,0,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,0,0 } }, /* >> */
+ { { 0x00BC }, { 0,0,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,0,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,0,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,0,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,0,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,0,0 } }, /* division */
+ { { 0x00F8 }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,0,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (enUS, graph)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,0,0 } },
+ { { 0x002F }, { 0,0,0 } },
+ { { 0x0030 }, { 0,0,0 } },
+ { { 0x0039 }, { 0,0,0 } },
+ { { 0x003A }, { 0,0,0 } },
+ { { 0x0040 }, { 0,0,0 } },
+ { { 0x0041 }, { 0,0,0 } },
+ { { 0x005A }, { 0,0,0 } },
+ { { 0x005B }, { 0,0,0 } },
+ { { 0x0060 }, { 0,0,0 } },
+ { { 0x0061 }, { 0,0,0 } },
+ { { 0x007A }, { 0,0,0 } },
+ { { 0x007B }, { 0,0,0 } },
+ { { 0x007E }, { 0,0,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } }, /* 20 */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC( eucJP, graph )
+#else
+ { TST_ISW_REC( ja_UTF8, graph )
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+#else
+ { { 0x3020 }, { 0,0,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,0,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,0,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,0,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,0,0 } }, /* IDEO. HALF SPACE */
+#endif
+ { { 0x3041 }, { 0,0,0 } }, /* HIRAGANA a */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */ /* non jis */
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+#else
+ { { 0x3094 }, { 0,0,0 } }, /* HIRAGANA u" */ /* non jis */
+ { { 0x3099 }, { 0,0,0 } }, /* SOUND MARK */
+#endif
+ { { 0x309E }, { 0,0,0 } }, /* ITERATION MARK */ /* 10 */
+ { { 0x30A1 }, { 0,0,0 } }, /* KATAKANA a */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */ /* non jis */
+#else
+ { { 0x30FA }, { 0,0,0 } }, /* KATAKANA wo" */ /* non jis */
+#endif
+ { { 0x30FB }, { 0,0,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE }, { 0,0,0 } }, /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+#else
+ { { 0x3191 }, { 0,0,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,0,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,0,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,0,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,0,0 } }, /* CJK IDEO.TEL.31th */
+#endif
+ { { 0x4E00 }, { 0,0,0 } }, /* CJK UNI.IDEO. */ /* 20 */
+ { { 0x4E05 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x4E06 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ { { 0x4E07 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x9007 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ { { 0x9FA5 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK Wave Low Line */ /* 30 */
+#else
+ { { 0xFE4F }, { 0,0,0 } }, /* CJK Wave Low Line */ /* 30 */
+#endif
+ { { 0xFF0F }, { 0,0,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,0,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,0,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,0,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,0,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,0,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,0,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,0,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66 }, { 0,0,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,0,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,0,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,0,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,0,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (end, graph) }
+};
diff --git a/test/locale-mbwc/dat_iswlower.c b/test/locale-mbwc/dat_iswlower.c
new file mode 100644
index 0000000..58ec08e
--- /dev/null
+++ b/test/locale-mbwc/dat_iswlower.c
@@ -0,0 +1,96 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswlower.c
+ *
+ * ISW*: int iswlower (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (LOWER, lower) = {
+
+ { TST_ISW_REC (de, lower)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,1,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,1,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,0,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (enUS, lower)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,1,0 } },
+ { { 0x0039 }, { 0,1,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,1,0 } },
+ { { 0x005A }, { 0,1,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,0,0 } },
+ { { 0x007A }, { 0,0,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, lower)
+#else
+ { TST_ISW_REC (ja_UTF8, lower)
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0xFF3A }, { 0,1,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,0,0 } }, /* FULL z */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (end, lower) }
+
+};
diff --git a/test/locale-mbwc/dat_iswprint.c b/test/locale-mbwc/dat_iswprint.c
new file mode 100644
index 0000000..bcd96d0
--- /dev/null
+++ b/test/locale-mbwc/dat_iswprint.c
@@ -0,0 +1,170 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswprint.c
+ *
+ * ISW*: int iswprint (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (PRINT, print) = {
+
+ { TST_ISW_REC (de, print)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+#else
+ { { 0x00A0 }, { 0,0,0 } }, /* NB SPACE */
+#endif
+ { { 0x00A1 }, { 0,0,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,0,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,0,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,0,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,0,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,0,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,0,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,0,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,0,0 } }, /* >> */
+ { { 0x00BC }, { 0,0,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,0,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,0,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,0,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,0,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,0,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,0,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,0,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,0,0 } }, /* division */
+ { { 0x00F8 }, { 0,0,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,0,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (enUS, print)
+ {
+ { { WEOF }, { 0,1,0 } }, /* 01 */
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,0,0 } },
+ { { 0x0021 }, { 0,0,0 } },
+ { { 0x002F }, { 0,0,0 } },
+ { { 0x0030 }, { 0,0,0 } },
+ { { 0x0039 }, { 0,0,0 } },
+ { { 0x003A }, { 0,0,0 } },
+ { { 0x0040 }, { 0,0,0 } },
+ { { 0x0041 }, { 0,0,0 } },
+ { { 0x005A }, { 0,0,0 } },
+ { { 0x005B }, { 0,0,0 } },
+ { { 0x0060 }, { 0,0,0 } },
+ { { 0x0061 }, { 0,0,0 } },
+ { { 0x007A }, { 0,0,0 } },
+ { { 0x007B }, { 0,0,0 } },
+ { { 0x007E }, { 0,0,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } }, /* 20 */
+#ifdef NO_WAIVER
+ { { 0x3042 }, { 0,1,0 } }, /* <WAIVER> */
+#endif
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, print)
+#else
+ { TST_ISW_REC (ja_UTF8, print)
+#endif
+ {
+ { { 0x3000 }, { 0,0,0 } }, /* IDEO. SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+#else
+ { { 0x3020 }, { 0,0,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,0,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,0,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,0,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,0,0 } }, /* IDEO. HALF SPACE */
+#endif
+ { { 0x3041 }, { 0,0,0 } }, /* HIRAGANA a */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */ /* non jis */
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+#else
+ { { 0x3094 }, { 0,0,0 } }, /* HIRAGANA u" */ /* non jis */
+ { { 0x3099 }, { 0,0,0 } }, /* SOUND MARK */
+#endif
+ { { 0x309E }, { 0,0,0 } }, /* ITERATION MARK */ /* 10 */
+ { { 0x30A1 }, { 0,0,0 } }, /* KATAKANA a */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */ /* non jis */
+#else
+ { { 0x30FA }, { 0,0,0 } }, /* KATAKANA wo" */ /* non jis */
+#endif
+ { { 0x30FB }, { 0,0,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE }, { 0,0,0 } }, /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+#else
+ { { 0x3191 }, { 0,0,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,0,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,0,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,0,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,0,0 } }, /* CJK IDEO.TEL.31th */
+#endif
+ { { 0x4E00 }, { 0,0,0 } }, /* CJK UNI.IDEO. */ /* 20 */
+ { { 0x4E05 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x4E06 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ { { 0x4E07 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+#else
+ { { 0x9007 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,0,0 } }, /* CJK UNI.IDEO.NON-J */
+#endif
+ { { 0x9FA5 }, { 0,0,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFE4F }, { 0,1,0 } }, /* WAVE LOW LINE */ /* 30 */
+#else
+ { { 0xFE4F }, { 0,0,0 } }, /* WAVE LOW LINE */ /* 30 */
+#endif
+ { { 0xFF0F }, { 0,0,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,0,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,0,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,0,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,0,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,0,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,0,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,0,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66 }, { 0,0,0 } }, /* HALF KATA WO */ /* 40 */
+ { { 0xFF6F }, { 0,0,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,0,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,0,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,0,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (end, print) }
+};
diff --git a/test/locale-mbwc/dat_iswpunct.c b/test/locale-mbwc/dat_iswpunct.c
new file mode 100644
index 0000000..2b3612f
--- /dev/null
+++ b/test/locale-mbwc/dat_iswpunct.c
@@ -0,0 +1,155 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswpunct.c
+ *
+ * ISW*: int iswpunct (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (PUNCT, punct) = {
+
+ { TST_ISW_REC (de, punct)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+#else
+ { { 0x00A0 }, { 0,0,0 } }, /* NB SPACE */
+#endif
+ { { 0x00A1 }, { 0,0,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,0,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,0,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,0,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,0,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,0,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,0,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,0,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,0,0 } }, /* >> */
+ { { 0x00BC }, { 0,0,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,0,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,0,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,0,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,1,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,0,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,1,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,1,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,1,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,1,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,0,0 } }, /* division */
+ { { 0x00F8 }, { 0,1,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,1,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (enUS, punct)
+ {
+ { { WEOF }, { 0,1,0 } }, /* 01 */
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,0,0 } },
+ { { 0x002F }, { 0,0,0 } },
+ { { 0x0030 }, { 0,1,0 } },
+ { { 0x0039 }, { 0,1,0 } },
+ { { 0x003A }, { 0,0,0 } },
+ { { 0x0040 }, { 0,0,0 } },
+ { { 0x0041 }, { 0,1,0 } },
+ { { 0x005A }, { 0,1,0 } },
+ { { 0x005B }, { 0,0,0 } },
+ { { 0x0060 }, { 0,0,0 } },
+ { { 0x0061 }, { 0,1,0 } },
+ { { 0x007A }, { 0,1,0 } },
+ { { 0x007B }, { 0,0,0 } },
+ { { 0x007E }, { 0,0,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } }, /* 20 */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, punct)
+#else
+ { TST_ISW_REC (ja_UTF8, punct)
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+#else
+ { { 0x3020 }, { 0,0,0 } }, /* POSTAL MARK FACE */
+#endif
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+#else
+ { { 0x302F }, { 0,0,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,0,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,0,0 } }, /* IDEO. HALF SPACE */
+#endif
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+#else
+ { { 0x3099 }, { 0,0,0 } }, /* SOUND MARK */
+#endif
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */ /* 10 */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0x30FB }, { 0,0,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE }, { 0,1,0 } }, /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+#else
+ { { 0x3191 }, { 0,0,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,0,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,0,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,0,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,0,0 } }, /* CJK IDEO.TEL.31th */
+#endif
+ { { 0x4E00 }, { 0,1,0 } }, /* CJK UNI.IDEO. */ /* 20 */
+ { { 0x4E05 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+#ifdef SHOJI_IS_RIGHT
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK UNI.IDEO. */ /* 30 */
+#else
+ { { 0xFE4F }, { 0,0,0 } }, /* CJK UNI.IDEO. */ /* 30 */
+#endif
+ { { 0xFF0F }, { 0,0,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,1,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,0,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,1,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,0,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,1,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,0,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,0,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,0,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */ /* 40 */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (end, punct) }
+};
diff --git a/test/locale-mbwc/dat_iswspace.c b/test/locale-mbwc/dat_iswspace.c
new file mode 100644
index 0000000..2131b87
--- /dev/null
+++ b/test/locale-mbwc/dat_iswspace.c
@@ -0,0 +1,129 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswspace.c
+ *
+ * ISW*: int iswspace (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (SPACE, space) = {
+
+ { TST_ISW_REC (de, space)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,1,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,1,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,1,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,1,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,1,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,1,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,1,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (enUS, space)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x0008 }, { 0,1,0 } },
+ { { 0x0009 }, { 0,0,0 } },
+ { { 0x000D }, { 0,0,0 } },
+ { { 0x000E }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,0,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,1,0 } },
+ { { 0x0039 }, { 0,1,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,1,0 } },
+ { { 0x005A }, { 0,1,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,1,0 } },
+ { { 0x007A }, { 0,1,0 } }, /* 20 */
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, space)
+#else
+ { TST_ISW_REC (ja_UTF8, space)
+#endif
+ {
+ { { 0x3000 }, { 0,0,0 } }, /* IDEO. SPACE */
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */ /* No JIS */
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0x30FB }, { 0,1,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE }, { 0,1,0 } }, /* KATAKANA ITERATION */
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+ { { 0x4E00 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF0F }, { 0,1,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,1,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,1,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,1,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,1,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,1,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,1,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (end, space) }
+};
diff --git a/test/locale-mbwc/dat_iswupper.c b/test/locale-mbwc/dat_iswupper.c
new file mode 100644
index 0000000..865f42f
--- /dev/null
+++ b/test/locale-mbwc/dat_iswupper.c
@@ -0,0 +1,94 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswupper.c
+ *
+ * ISW*: int iswupper (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (UPPER, upper) = {
+
+ { TST_ISW_REC (de, upper)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,0,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,0,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,0,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,1,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,1,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,1,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,1,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,1,0 } }, /* y dia */
+ { .is_last = 1 } /* Last entry. */
+ }
+ },
+ { TST_ISW_REC (enUS, upper)
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,1,0 } },
+ { { 0x0039 }, { 0,1,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,0,0 } },
+ { { 0x005A }, { 0,0,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,1,0 } },
+ { { 0x007A }, { 0,1,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* Last entry. */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, upper)
+#else
+ { TST_ISW_REC (ja_UTF8, upper)
+#endif
+ {
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0xFF19 }, { 0,1,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,0,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,1,0 } }, /* FULL z */
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last entry. */
+ }
+ },
+ { TST_ISW_REC (end, upper) }
+};
diff --git a/test/locale-mbwc/dat_iswxdigit.c b/test/locale-mbwc/dat_iswxdigit.c
new file mode 100644
index 0000000..5d6c652
--- /dev/null
+++ b/test/locale-mbwc/dat_iswxdigit.c
@@ -0,0 +1,125 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_iswxdigit.c
+ *
+ * ISW*: int iswxdigit (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (XDIGIT, xdigit) = {
+
+ { TST_ISW_REC (de, xdigit)
+ {
+ { { 0x0080 }, { 0,1,0 } }, /* CTRL */
+ { { 0x009F }, { 0,1,0 } }, /* CTRL */
+ { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */
+ { { 0x00A1 }, { 0,1,0 } }, /* UD ! */
+ { { 0x00B0 }, { 0,1,0 } }, /* Degree */
+ { { 0x00B1 }, { 0,1,0 } }, /* +- sign */
+ { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */
+ { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */
+ { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */
+ { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */
+ { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */
+ { { 0x00BB }, { 0,1,0 } }, /* >> */
+ { { 0x00BC }, { 0,1,0 } }, /* 1/4 */
+ { { 0x00BD }, { 0,1,0 } }, /* 1/2 */
+ { { 0x00BE }, { 0,1,0 } }, /* 3/4 */
+ { { 0x00BF }, { 0,1,0 } }, /* UD ? */
+ { { 0x00C0 }, { 0,1,0 } }, /* A Grave */
+ { { 0x00D6 }, { 0,1,0 } }, /* O dia */
+ { { 0x00D7 }, { 0,1,0 } }, /* multipl. */
+ { { 0x00D8 }, { 0,1,0 } }, /* O stroke */
+ { { 0x00DF }, { 0,1,0 } }, /* small Sh */
+ { { 0x00E0 }, { 0,1,0 } }, /* a grave */
+ { { 0x00F6 }, { 0,1,0 } }, /* o dia */
+ { { 0x00F7 }, { 0,1,0 } }, /* division */
+ { { 0x00F8 }, { 0,1,0 } }, /* o stroke */
+ { { 0x00FF }, { 0,1,0 } }, /* y dia */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC( enUS, xdigit )
+ {
+ { { WEOF }, { 0,1,0 } },
+ { { 0x0000 }, { 0,1,0 } },
+ { { 0x001F }, { 0,1,0 } },
+ { { 0x0020 }, { 0,1,0 } },
+ { { 0x0021 }, { 0,1,0 } },
+ { { 0x002F }, { 0,1,0 } },
+ { { 0x0030 }, { 0,0,0 } },
+ { { 0x0039 }, { 0,0,0 } },
+ { { 0x003A }, { 0,1,0 } },
+ { { 0x0040 }, { 0,1,0 } },
+ { { 0x0041 }, { 0,0,0 } },
+ { { 0x005A }, { 0,1,0 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,0,0 } },
+ { { 0x007A }, { 0,1,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_ISW_REC( eucJP, xdigit )
+#else
+ { TST_ISW_REC( ja_UTF8, xdigit )
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */
+ { { 0x3041 }, { 0,1,0 } }, /* HIRAGANA a */
+ { { 0x3094 }, { 0,1,0 } }, /* HIRAGANA u" */
+ { { 0x3099 }, { 0,1,0 } }, /* SOUND MARK */
+ { { 0x309E }, { 0,1,0 } }, /* ITERATION MARK */
+ { { 0x30A1 }, { 0,1,0 } }, /* KATAKANA a */
+ { { 0x30FA }, { 0,1,0 } }, /* KATAKANA wo" */
+ { { 0x30FB }, { 0,1,0 } }, /* KATAKANA MID.DOT */
+ { { 0x30FE }, { 0,1,0 } }, /* KATAKANA ITERATION */
+ { { 0x3191 }, { 0,1,0 } }, /* KANBUN REV.MARK */
+ { { 0x3243 }, { 0,1,0 } }, /* IDEO. MARK (reach) */
+ { { 0x32CB }, { 0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */
+ { { 0x32FE }, { 0,1,0 } }, /* MARU KATAKANA wo */
+ { { 0x33FE }, { 0,1,0 } }, /* CJK IDEO.TEL.31th */
+ { { 0x4E00 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E05 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4E06 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x4E07 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x4FFF }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9000 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9006 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0x9007 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA4 }, { 0,1,0 } }, /* CJK UNI.IDEO.NON-J */
+ { { 0x9FA5 }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFE4F }, { 0,1,0 } }, /* CJK UNI.IDEO. */
+ { { 0xFF0F }, { 0,1,0 } }, /* FULL SLASH */
+ { { 0xFF19 }, { 0,1,0 } }, /* FULL 9 */
+ { { 0xFF20 }, { 0,1,0 } }, /* FULL @ */
+ { { 0xFF3A }, { 0,1,0 } }, /* FULL Z */
+ { { 0xFF40 }, { 0,1,0 } }, /* FULL GRAVE ACC. */
+ { { 0xFF5A }, { 0,1,0 } }, /* FULL z */
+ { { 0xFF5E }, { 0,1,0 } }, /* FULL ~ (tilde) */
+ { { 0xFF61 }, { 0,1,0 } }, /* HALF IDEO.STOP. . */
+ { { 0xFF65 }, { 0,1,0 } }, /* HALF KATA MID.DOT */
+ { { 0xFF66 }, { 0,1,0 } }, /* HALF KATA WO */
+ { { 0xFF6F }, { 0,1,0 } }, /* HALF KATA tu */
+ { { 0xFF70 }, { 0,1,0 } }, /* HALF KATA PL - */
+ { { 0xFF71 }, { 0,1,0 } }, /* HALF KATA A */
+ { { 0xFF9E }, { 0,1,0 } }, /* HALF KATA MI */
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_ISW_REC (end, xdigit) }
+};
diff --git a/test/locale-mbwc/dat_mblen.c b/test/locale-mbwc/dat_mblen.c
new file mode 100644
index 0000000..8da038c
--- /dev/null
+++ b/test/locale-mbwc/dat_mblen.c
@@ -0,0 +1,137 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_mblen.c
+ *
+ * MBLEN: int mblen (char *s, size_t n);
+ */
+
+
+/*
+ * NOTE:
+ * int mblen (char *s, size_t n);
+ *
+ * where n: a maximum number of bytes
+ *
+ * return - the number of bytes
+ *
+ * CAUTION:
+ *
+ * o When you feed a null pointer for a string (s) to the function,
+ * set s_flg=0 instead of putting just a 'NULL' there.
+ * Even if you set a 'NULL', it doens't mean a NULL pointer.
+ *
+ * o When s is a null pointer, the function checks state dependency.
+ *
+ * state-dependent encoding - return NON-zero
+ * state-independent encoding - return 0
+ *
+ * If state-dependent encoding is expected, set
+ *
+ * s_flg = 0, ret_flg = 0, ret_val = +1
+ *
+ * If state-independent encoding is expected, set
+ *
+ * s_flg = 0, ret_flg = 0, ret_val = 0
+ *
+ *
+ * When you set ret_flg=1, the test program simply compares an
+ * actual return value with an expected value. You can check
+ * state-independent case (return value is 0) in that way, but
+ * you can not check state-dependent case. So when you check
+ * state- dependency in this test function: tst_mblen(), set
+ * ret_flg=0 always. It's a special case, and the test
+ * function takes care of it.
+ *
+ * s_flg=0 ret_flg=0
+ * | |
+ * { 0, 0 }, { 0, 0, 0, x }
+ * | |
+ * not used ret_val: 0/+1
+ * (expected val) */
+
+
+TST_MBLEN tst_mblen_loc [] = {
+ {
+ { Tmblen, TST_LOC_de },
+ {
+ /* 01: a character. */
+ { { 1, "\300", USE_MBCURMAX }, { 0, 1, 1 } },
+ /* 02: a character. */
+ { { 1, "\309", USE_MBCURMAX }, { 0, 1, 1 } },
+ /* 03: a character + an invalid byte. */
+ { { 1, "Z\204", USE_MBCURMAX }, { 0, 1, +1 } },
+ /* 04: control/invalid characters. */
+ { { 1, "\177\000", USE_MBCURMAX }, { 0, 1, +1 } },
+ /* 05: a null string. */
+ { { 1, "", USE_MBCURMAX }, { 0, 1, 0 } },
+ /* 06: a null pointer. */
+ { { 0, "", USE_MBCURMAX }, { 0, 0, 0 } },
+ /* Last element. */
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tmblen, TST_LOC_enUS },
+ {
+ /* 01: a character. */
+ { { 1, "A", USE_MBCURMAX }, { 0, 1, 1 } },
+ /* 02: a character. */
+ { { 1, "a", USE_MBCURMAX }, { 0, 1, 1 } },
+ /* 03: a character + an invalid byte. */
+ { { 1, "Z\204", USE_MBCURMAX }, { 0, 1, +1 } },
+ /* 04: control/invalid characters. */
+ { { 1, "\177\000", USE_MBCURMAX }, { 0, 1, +1 } },
+ /* 05: a null string. */
+ { { 1, "", USE_MBCURMAX }, { 0, 1, 0 } },
+ /* 06: a null pointer. */
+ { { 0, "", USE_MBCURMAX }, { 0, 0, 0 } },
+ /* Last element. */
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Tmblen, TST_LOC_eucJP },
+ {
+ /* 01: a character. */
+ { { 1, "\264\301", USE_MBCURMAX }, { 0, 1, 2 } },
+ /* 02: a character. */
+ { { 1, "\216\261", USE_MBCURMAX }, { 0, 1, 2 } },
+ /* 03: a character + an invalid byte. */
+ { { 1, "\260\241\200", USE_MBCURMAX }, { 0, 1, 2 } },
+ /* 04: control/invalid characters. */
+ { { 1, "\377\202", USE_MBCURMAX }, { EILSEQ, 1, -1 } },
+ /* 05: a null string. */
+ { { 1, "", USE_MBCURMAX }, { 0, 1, 0 } },
+ /* 06: a null pointer. */
+ { { 0, "", USE_MBCURMAX }, { 0, 0, 0 } },
+ /* Last element. */
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Tmblen, TST_LOC_ja_UTF8 },
+ {
+ /* 01: a character. */
+ { { 1, "\346\274\242", USE_MBCURMAX }, { 0, 1, 3 } },
+ /* 02: a character. */
+ { { 1, "\357\275\261", USE_MBCURMAX }, { 0, 1, 3 } },
+ /* 03: a character + an invalid byte. */
+ { { 1, "\345\272\234\200", USE_MBCURMAX }, { 0, 1, 3 } },
+ /* 04: control/invalid characters. */
+ { { 1, "\377\202", USE_MBCURMAX }, { EILSEQ, 1, -1 } },
+ /* 05: a null string. */
+ { { 1, "", USE_MBCURMAX }, { 0, 1, 0 } },
+ /* 06: a null pointer. */
+ { { 0, "", USE_MBCURMAX }, { 0, 0, 0 } },
+ /* Last element. */
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Tmblen, TST_LOC_end}
+ }
+};
diff --git a/test/locale-mbwc/dat_mbrlen.c b/test/locale-mbwc/dat_mbrlen.c
new file mode 100644
index 0000000..63ae19f
--- /dev/null
+++ b/test/locale-mbwc/dat_mbrlen.c
@@ -0,0 +1,222 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_mbrlen.c
+ *
+ * MBRLEN: size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
+ */
+
+/*
+ * NOTE:
+ * (1) A mbstate object is initialized for
+ * every new data record by the test program.
+ *
+ * (2) USE_MBCURMAX is defined as a value of 99.
+ *
+ */
+
+
+TST_MBRLEN tst_mbrlen_loc [] = {
+ {
+ { Tmbrlen, TST_LOC_de },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "", 0, 0, 0 },
+ { 1, "", 1, 0, 0 },
+ { 1, "\300", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, },
+ { 0, 1, 0, },
+ { 0, 1, 1, },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "\300\001", 0, 0, 0 },
+ { 1, "\300\001", 1, 0, 0 },
+ { 1, "\317\001", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, },
+ { 0, 1, 1, },
+ { 0, 1, 1, },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tmbrlen, TST_LOC_enUS },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "A", 0, 0, 0 },
+ { 1, "A", 1, 0, 0 },
+ { 1, "A", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, },
+ { 0, 1, 1, },
+ { 0, 1, 1, },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "\317\001", 0, 1, 0 },
+ { 1, "\317\001", 1, 1, 0 },
+ { 1, "\317\001", USE_MBCURMAX, 1, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, },
+ { EILSEQ, 1, -1, },
+ { EILSEQ, 1, -1, },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Tmbrlen, TST_LOC_eucJP },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "\317\302", 1, 1, 1 },
+ { 0, "", 0, 1, 0 },
+ { 1, "\317\302", USE_MBCURMAX, 1, 1 },
+ }
+ },
+ {
+ {
+ { 0, 1, -2, },
+ { 0, 1, -1, },
+ { 0, 1, 2, },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "\317", 1, 1, 0 },
+ { 1, "\302", 1, 1, 0 },
+ { 1, "\317\302", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, -2, },
+#ifdef SHOJI_IS_RIGHT
+ { 0, 1, +2, },
+#else
+ /* XXX ISO C explicitly says that the return value does not
+ XXX reflect the bytes contained in the state. */
+ { 0, 1, +1, },
+#endif
+ { 0, 1, 2, },
+ }
+ }
+ },
+ { /*----------------- #03 -----------------*/
+ {
+ {
+ { 1, "\216\217", 0, 0, 0 },
+ { 1, "\216\217", 1, 0, 0 },
+ { 1, "\216\217", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, },
+ { 0, 1, -2, },
+ { EILSEQ, 1, -1, },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Tmbrlen, TST_LOC_ja_UTF8 },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "\345\222\214", 1, 1, 1 },
+ { 0, "", 0, 1, 0 },
+ { 1, "\345\222\214", USE_MBCURMAX, 1, 1 },
+ }
+ },
+ {
+ {
+ { 0, 1, -2, },
+ { 0, 1, -1, },
+ { 0, 1, 3, },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "\317", 1, 1, 0 },
+ { 1, "\266", 1, 1, 0 },
+ { 1, "\345\222\214", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, -2, },
+#ifdef SHOJI_IS_RIGHT
+ { 0, 1, +2, },
+#else
+ /* XXX ISO C explicitly says that the return value does not
+ XXX reflect the bytes contained in the state. */
+ { 0, 1, +1, },
+#endif
+ { 0, 1, 3, },
+ }
+ }
+ },
+ { /*----------------- #03 -----------------*/
+ {
+ {
+ { 1, "\302\303", 0, 0, 0 },
+ { 1, "\302\303", 1, 0, 0 },
+ { 1, "\302\303", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, },
+ { 0, 1, -2, },
+ { EILSEQ, 1, -1, },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Tmbrlen, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_mbrtowc.c b/test/locale-mbwc/dat_mbrtowc.c
new file mode 100644
index 0000000..b8eb3dd
--- /dev/null
+++ b/test/locale-mbwc/dat_mbrtowc.c
@@ -0,0 +1,140 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_mbrtowc.c
+ *
+ * MBTOWC: size_t mbrtowc (wchar_t *pwc, char *s, size_t n,
+ * mbstate_t *ps);
+ */
+
+#include <limits.h>
+
+/* Note:
+ assumes en_US = en_US.ascii
+*/
+
+
+
+
+TST_MBRTOWC tst_mbrtowc_loc [] = {
+ {
+ { Tmbrtowc, TST_LOC_de },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "ÄÖÜ", 1, 0, 0 },
+ { 1, 1, "ÄÖÜ", 2, 0, 0 },
+ { 1, 1, "ÄÖÜ", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "ÄÖÜ", 1, 0, 0 },
+ { 1, 1, "ÄÖÜ", 2, 0, 0 },
+ { 1, 1, "ÄÖÜ", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ /* XXX: These tests don't make sense to me. */
+ {
+ { Tmbrtowc, TST_LOC_enUS },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "ÄÖÜ", 1, 0, 0 },
+ { 1, 1, "ÄÖÜ", 2, 0, 0 },
+ { 1, 1, "ÄÖÜ", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "ÄÖÜ", 1, 0, 0 },
+ { 1, 1, "ÄÖÜ", 2, 0, 0 },
+ { 1, 1, "ÄÖÜ", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tmbrtowc, TST_LOC_eucJP },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "ÄÖÜ", 1, 0, 0 },
+ { 1, 1, "ÄÖÜ", 2, 0, 0 },
+ { 1, 1, "ÄÖÜ", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "ÄÖÜ", 1, 0, 0 },
+ { 1, 1, "ÄÖÜ", 2, 0, 0 },
+ { 1, 1, "ÄÖÜ", USE_MBCURMAX, 0, 0 },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ { 0, 1, 1, 0x00C4 },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Tmbrtowc, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_mbsrtowcs.c b/test/locale-mbwc/dat_mbsrtowcs.c
new file mode 100644
index 0000000..30a0a6c
--- /dev/null
+++ b/test/locale-mbwc/dat_mbsrtowcs.c
@@ -0,0 +1,180 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_mbsrtowcs.c
+ *
+ * MBSRTOWCS: size_t mbsrtowcs (wchar_t *ws, char **s, size_t n,
+ * mbstate_t *ps);
+ */
+
+
+TST_MBSRTOWCS tst_mbsrtowcs_loc [] = {
+ {
+ { Tmbsrtowcs, TST_LOC_de },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "üäö", 4, 0,0 },
+ { 1, "üäö", 3, 0,0 },
+ { 1, "üäö", 2, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x00FC,0x00E4,0x00F6,0x0000 } },
+ { 0,1,3, { 0x00FC,0x00E4,0x00F6,0x0000 } },
+ { 0,1,2, { 0x00FC,0x00E4,0x00F6,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "üäö", 4, 0,0 },
+ { 1, "", 1, 0,0 },
+ { 0, "üäö", 4, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x00FC,0x00E4,0x00F6,0x0000 } },
+ { 0,1,0, { 0x0000 } },
+ { 0,1,3, { 0x0000 } },
+ }
+ }
+ },
+ { /*----------------- END -----------------*/
+ .is_last = 1
+ }
+ }
+ },
+
+ {
+ { Tmbsrtowcs, TST_LOC_enUS },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "ABC", 4, 0,0 },
+ { 1, "ABC", 3, 0,0 },
+ { 1, "ABC", 2, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "ABC", 4, 0,0 },
+ { 1, "", 1, 0,0 },
+ { 0, "ABC", 4, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,0, { 0x0000 } },
+ { 0,1,3, { 0x0000 } },
+ }
+ }
+ },
+ { /*----------------- END -----------------*/
+ .is_last = 1
+ }
+ }
+ },
+
+#if 0
+ {
+ { Tmbsrtowcs, TST_LOC_eucJP },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "\244\242\244\244\244\246ABC", 7, 0,0 },
+ { 1, "\244\242\244\244\244\246ABC", 6, 0,0 },
+ { 1, "\244\242\244\244\244\246ABC", 4, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "\244\242\244\244\244\246ABC", 7, 0,0 },
+ { 1, "", 1, 0,0 },
+ { 0, "\244\242\244\244\244\246ABC", 7, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,0, { 0x0000 } },
+ { 0,1,6, { 0x0000 } },
+ }
+ }
+ },
+ { /*----------------- END -----------------*/
+ .is_last = 1
+ }
+ }
+ },
+#else
+ {
+ { Tmbsrtowcs, TST_LOC_ja_UTF8 },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, "\343\201\202\343\201\204\343\201\206ABC", 7, 0,0 },
+ { 1, "\343\201\202\343\201\204\343\201\206ABC", 6, 0,0 },
+ { 1, "\343\201\202\343\201\204\343\201\206ABC", 4, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, "\343\201\202\343\201\204\343\201\206ABC", 7, 0,0 },
+ { 1, "", 1, 0,0 },
+ { 0, "\343\201\202\343\201\204\343\201\206ABC", 7, 0,0 },
+ }
+ },
+ {
+ {
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,0, { 0x0000 } },
+ { 0,1,6, { 0x0000 } },
+ }
+ }
+ },
+ { /*----------------- END -----------------*/
+ .is_last = 1
+ }
+ }
+ },
+#endif
+ {
+ { Tmbsrtowcs, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_mbstowcs.c b/test/locale-mbwc/dat_mbstowcs.c
new file mode 100644
index 0000000..3b8ce65
--- /dev/null
+++ b/test/locale-mbwc/dat_mbstowcs.c
@@ -0,0 +1,190 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_mbstowcs.c
+ *
+ * MBSTOWCS: size_t mbstowcs (wchar_t *ws, char *s, size_t n);
+ */
+
+#include <limits.h>
+
+TST_MBSTOWCS tst_mbstowcs_loc [] = {
+ {
+ { Tmbstowcs, TST_LOC_de },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "ABC", 4 },
+ { 1, 1, "ABC", 3 },
+ { 1, 1, "ABC", 2 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "ABC", 4 },
+ { 1, 1, "", 1 },
+ { 0, 1, "ABC", 4 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,0, { 0x0000 } },
+ { 0,1,3, { 0x0000 } },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tmbstowcs, TST_LOC_enUS },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "ABC", 4 },
+ { 1, 1, "ABC", 3 },
+ { 1, 1, "ABC", 2 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "ABC", 4 },
+ { 1, 1, "", 1 },
+ { 0, 1, "ABC", 4 },
+ }
+ },
+ {
+ {
+ { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
+ { 0,1,0, { 0x0000 } },
+ { 0,1,3, { 0x0000 } },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Tmbstowcs, TST_LOC_eucJP },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "\244\242\244\244\244\246ABC", 7 },
+ { 1, 1, "\244\242\244\244\244\246ABC", 6 },
+ { 1, 1, "\244\242\244\244\244\246ABC", 4 },
+ }
+ },
+ {
+ {
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+#ifdef SHOJI_IS_RIGHT
+ /* XXX I really don't understand the first and third line.
+ the result of the first line is the same as the first
+ in the last test (i.e., returns 6). Also, the third
+ test will simply convert everything. */
+ { 1, 1, "\244\242\244\244\244\246ABC", 7 },
+ { 1, 1, "", 1 },
+ { 0, 1, "\244\242\244\244\244\246ABC", 7 },
+#else
+ { 1, 1, "\244\242\244\244\244\246ABC", 4 },
+ { 1, 1, "", 1 },
+ { 0, 1, "\244\242\244\244\244\246ABC", 0 },
+#endif
+ }
+ },
+ {
+ {
+ { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
+ { 0,1,0, { 0x0000 } },
+ { 0,1,6, { 0x0000 } },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Tmbstowcs, TST_LOC_ja_UTF8 },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 7 },
+ { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 6 },
+ { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 4 },
+ }
+ },
+ {
+ {
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+ { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+#ifdef SHOJI_IS_RIGHT
+ /* XXX I really don't understand the first and third line.
+ the result of the first line is the same as the first
+ in the last test (i.e., returns 6). Also, the third
+ test will simply convert everything. */
+ { 1, 1, "\244\242\244\244\244\246ABC", 7 },
+ { 1, 1, "", 1 },
+ { 0, 1, "\244\242\244\244\244\246ABC", 7 },
+#else
+ { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 4 },
+ { 1, 1, "", 1 },
+ { 0, 1, "\343\201\202\343\201\204\343\201\206ABC", 7 },
+#endif
+ }
+ },
+ {
+ {
+ { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
+ { 0,1,0, { 0x0000 } },
+ { 0,1,6, { 0x0000 } },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Tmbstowcs, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_mbtowc.c b/test/locale-mbwc/dat_mbtowc.c
new file mode 100644
index 0000000..9a7a9c3
--- /dev/null
+++ b/test/locale-mbwc/dat_mbtowc.c
@@ -0,0 +1,444 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_mbtowc.c
+ *
+ * MBTOWC: int mbtowc (wchar_t *wp, char *s, size_t n);
+ */
+
+/* NOTE:
+ *
+ * int mbtowc (wchar_t *wp, char *s, size_t n);
+ *
+ * where n: a maximum number of bytes
+ * return: the number of bytes
+ *
+ *
+ * o When you feed a null pointer for a string (s) to the function,
+ * set s_flg=0 instead of putting just a 'NULL' there.
+ * Even if you put a 'NULL', it means a null string as well as "".
+ *
+ * o When s is a null pointer, the function checks state dependency.
+ *
+ * state-dependent encoding - return NON-zero
+ * state-independent encoding - return 0
+ *
+ * If state-dependent encoding is expected, set
+ *
+ * s_flg = 0, ret_flg = 0, ret_val = +1
+ *
+ * If state-independent encoding is expected, set
+ *
+ * s_flg = 0, ret_flg = 0, ret_val = 0
+ *
+ *
+ * When you set ret_flg=1, the test program simply compares
+ * an actual return value with an expected value. You can
+ * check state-independent case (return value is 0) in that
+ * way, but you can not check state-dependent case. So when
+ * you check state- dependency in this test function:
+ * tst_mbtowc(), set ret_flg=0 always. It's a special case
+ * and the test function takes care of it.
+ *
+ * w_flg
+ * | s: (a null string; can't be (char *)NULL)
+ * | |
+ * input. { 1, 0, (char)NULL, MB_LEN_MAX },
+ * |
+ * s_flg=0: makes _s_ a null pointer.
+ *
+ * expect { 0,0,0,x, 0x0000 },
+ * | |
+ * | ret_val: 0/+1
+ * ret_flg=0
+ *
+ *
+ * Test data for State dependent encodings:
+ *
+ * mbtowc( NULL, NULL, 0 ); ... first data
+ * mbtowc( &wc, s1, n1 ); ... second data
+ * mbtowc( &wc, s2, n2 ); ... third data
+ * */
+
+#include <limits.h>
+
+TST_MBTOWC tst_mbtowc_loc [] = {
+ {
+ { Tmbtowc, TST_LOC_de },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "\xfc\xe4\xf6", 1 },
+ { 1, 1, "\xfc\xe4\xf6", 2 },
+ { 1, 1, "\xfc\xe4\xf6", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x00FC },
+ { 0, 1, 1, 0x00FC },
+ { 0, 1, 1, 0x00FC },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "\177", MB_LEN_MAX },
+ { 1, 1, "\200", MB_LEN_MAX },
+ { 1, 1, "\201", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x007F },
+ { 0, 1, 1, 0x0080 },
+ { 0, 1, 1, 0x0081 },
+ }
+ }
+ },
+ { /*----------------- #03 -----------------*/
+ {
+ {
+ { 1, 1, "", MB_LEN_MAX },
+ { 0, 1, "\xfc\xe4\xf6", 1 },
+ { 0, 1, "\xfc\xe4\xf6", 2 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #04 -----------------*/
+ {
+ {
+ { 0, 1, "\xfc\xe4\xf6", MB_LEN_MAX },
+ { 0, 1, "\177", MB_LEN_MAX },
+ { 0, 1, "", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 0, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #05 -----------------*/
+ {
+ {
+ { 0, 1, "\xfc\xe4\xf6", MB_LEN_MAX },
+ { 0, 1, "\177", MB_LEN_MAX },
+ { 0, 0, NULL, MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ { 0, 0, 0, 0x0000 },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tmbtowc, TST_LOC_enUS },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "ABC", 1 },
+ { 1, 1, "ABC", 2 },
+ { 1, 1, "ABC", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x0041 },
+ { 0, 1, 1, 0x0041 },
+ { 0, 1, 1, 0x0041 },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "\177", MB_LEN_MAX },
+ { 1, 1, "\200", MB_LEN_MAX },
+ { 1, 1, "\201", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x007F },
+ { EILSEQ, 1, -1, 0x0000 },
+ { EILSEQ, 1, -1, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #03 -----------------*/
+ {
+ {
+ { 1, 1, "", MB_LEN_MAX },
+ { 0, 1, "ABC", 1 },
+ { 0, 1, "ABC", 2 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #04 -----------------*/
+ {
+ {
+ { 0, 1, "ABC", MB_LEN_MAX },
+ { 0, 1, "\177", MB_LEN_MAX },
+ { 0, 1, "", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 0, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #05 -----------------*/
+ {
+ {
+ { 0, 1, "ABC", MB_LEN_MAX },
+ { 0, 1, "\177", MB_LEN_MAX },
+ { 0, 0, NULL, MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 1, 0x0000 },
+ { 0, 1, 1, 0x0000 },
+ { 0, 0, 0, 0x0000 },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Tmbtowc, TST_LOC_eucJP },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "\244\242A", 1 },
+ { 1, 1, "\244\242A", 2 },
+ { 1, 1, "\244\242A", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+#ifdef SHOJI_IS_RIGHT
+ { EILSEQ, 1, -1, 0x0000 },
+#else
+ /* XXX EILSEQ was introduced in ISO C99. */
+ { 0, 1, -1, 0x0000 },
+#endif
+ { 0, 1, 2, 0x3042 },
+ { 0, 1, 2, 0x3042 },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "\177\244\242", MB_LEN_MAX },
+ { 1, 1, "\377\244\242", MB_LEN_MAX },
+ { 1, 1, "\201\244\242", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, +1, 0x007F },
+#ifdef SHOJI_IS_RIGHT
+ { EILSEQ, 1, -1, 0x0000 },
+#else
+ { 0, 1, -1, 0x0000 },
+#endif
+ { 0, 1, +1, 0x0081 },
+ }
+ }
+ },
+ { /*----------------- #03 -----------------*/
+ {
+ {
+ { 1, 1, "", MB_LEN_MAX },
+ { 0, 1, "\244\242A", 1 },
+ { 0, 1, "\244\242A", 2 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, 0x0000 },
+#ifdef SHOJI_IS_RIGHT
+ { EILSEQ, 1, -1, 0x0000 },
+#else
+ /* XXX EILSEQ was introduced in ISO C99. */
+ { 0, 1, -1, 0x0000 },
+#endif
+ { 0, 1, 2, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #04 -----------------*/
+ {
+ {
+ { 0, 1, "\244\242A", MB_LEN_MAX },
+ { 0, 1, "\177\244\242", MB_LEN_MAX },
+ { 0, 1, "", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 2, 0x0000 },
+ { 0, 1, +1, 0x0000 },
+ { 0, 1, 0, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #05 -----------------*/
+ {
+ {
+ { 0, 1, "\244\242A", MB_LEN_MAX },
+ { 0, 1, "\177\244\242", MB_LEN_MAX },
+ { 0, 0, NULL, MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 2, 0x0000 },
+ { 0, 1, +1, 0x0000 },
+ { 0, 0, 0, 0x0000 },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Tmbtowc, TST_LOC_ja_UTF8 },
+ {
+ { /*----------------- #01 -----------------*/
+ {
+ {
+ { 1, 1, "\343\201\202A", 1 },
+ { 1, 1, "\343\201\202A", 3 },
+ { 1, 1, "\343\201\202A", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+#ifdef SHOJI_IS_RIGHT
+ { EILSEQ, 1, -1, 0x0000 },
+#else
+ /* XXX EILSEQ was introduced in ISO C99. */
+ { 0, 1, -1, 0x0000 },
+#endif
+ { 0, 1, 3, 0x3042 },
+ { 0, 1, 3, 0x3042 },
+ }
+ }
+ },
+ { /*----------------- #02 -----------------*/
+ {
+ {
+ { 1, 1, "\177\343\201\202", MB_LEN_MAX },
+ { 1, 1, "\377\343\201\202", MB_LEN_MAX },
+ { 1, 1, "\302\201\343\201\202", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, +1, 0x007F },
+#ifdef SHOJI_IS_RIGHT
+ { EILSEQ, 1, -1, 0x0000 },
+#else
+ { 0, 1, -1, 0x0000 },
+#endif
+ { 0, 1, +2, 0x0081 },
+ }
+ }
+ },
+ { /*----------------- #03 -----------------*/
+ {
+ {
+ { 1, 1, "", MB_LEN_MAX },
+ { 0, 1, "\343\201\202A", 1 },
+ { 0, 1, "\343\201\202A", 3 },
+ }
+ },
+ {
+ {
+ { 0, 1, 0, 0x0000 },
+#ifdef SHOJI_IS_RIGHT
+ { EILSEQ, 1, -1, 0x0000 },
+#else
+ /* XXX EILSEQ was introduced in ISO C99. */
+ { 0, 1, -1, 0x0000 },
+#endif
+ { 0, 1, 3, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #04 -----------------*/
+ {
+ {
+ { 0, 1, "\343\201\202A", MB_LEN_MAX },
+ { 0, 1, "\177\343\201\202", MB_LEN_MAX },
+ { 0, 1, "", MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 3, 0x0000 },
+ { 0, 1, +1, 0x0000 },
+ { 0, 1, 0, 0x0000 },
+ }
+ }
+ },
+ { /*----------------- #05 -----------------*/
+ {
+ {
+ { 0, 1, "\343\201\202A", MB_LEN_MAX },
+ { 0, 1, "\177\343\201\202", MB_LEN_MAX },
+ { 0, 0, NULL, MB_LEN_MAX },
+ }
+ },
+ {
+ {
+ { 0, 1, 3, 0x0000 },
+ { 0, 1, +1, 0x0000 },
+ { 0, 0, 0, 0x0000 },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Tmbtowc, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_strcoll.c b/test/locale-mbwc/dat_strcoll.c
new file mode 100644
index 0000000..e12037c
--- /dev/null
+++ b/test/locale-mbwc/dat_strcoll.c
@@ -0,0 +1,209 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_strcoll.c
+ *
+ * STRCOLL: int strcoll (const char *s1, const char *s2);
+ */
+
+/*
+ NOTE:
+
+ If a return value is expected to be 0, set ret_flg=1 and the
+ expected value = 0. If a return value is expected to be a
+ positive/negative value, set ret_flg=0, and set the expected value
+ = +1/-1.
+ There is inconsistensy between tst_strcoll() and tst_wcscoll()(it
+ has cmp_flg) for input data. I'll fix it.
+
+ Assuming en_US to be en_US.ascii. (maybe, should be iso8859-1).
+
+
+
+ ASCII CODE : A,B,C, ... , a, b, c, ... B,a:-1 a,B:+1
+ DICTIONARY : A,a,B,b,C,c,.... a,B:-1 B,a:+1 */
+
+TST_STRCOLL tst_strcoll_loc [] = {
+ {
+ { Tstrcoll, TST_LOC_de },
+ {
+ { /*input.*/ { "ÄBCDEFG", "ÄBCDEFG" }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { "XX Ä XX", "XX B XX" }, /* #2 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "XX B XX", "XX Ä XX" }, /* #3 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "B", "a" }, /* #4 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "a", "B" }, /* #5 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "b", "A" }, /* #6 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "A", "b" }, /* #7 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "ä", "B" }, /* #8 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "B", "ä" }, /* #9 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ {
+ { Tstrcoll, TST_LOC_en },
+ {
+ { /*input.*/ { "ABCDEFG", "ABCDEFG" }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { "XX a XX", "XX B XX" }, /* #2 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "XX B XX", "XX a XX" }, /* #3 */
+ /*expect*/ { 0,0,+1, },
+ },
+ {
+ /* <WAIVER> */
+ /*input.*/ { "B", "a" }, /* #4 */
+#ifdef SHOJI_IS_RIGHT
+ /*expect*/ { 0,0,-1, },
+#else
+ /* XXX We are not testing the C locale. */
+ /*expect*/ { 0,0,+1, },
+#endif
+ },
+ {
+ /* <WAIVER> */
+ /*input.*/ { "a", "B" }, /* #5 */
+#ifdef SHOJI_IS_RIGHT
+ /*expect*/ { 0,0,+1, },
+#else
+ /* XXX We are not testing the C locale. */
+ /*expect*/ { 0,0,-1, },
+#endif
+ },
+ { /*input.*/ { "b", "A" }, /* #6 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "A", "b" }, /* #7 */
+ /*expect*/ { 0,0,-1, },
+ },
+#ifdef NO_WAIVER
+ /* XXX I do not yet know whether strcoll really should reject
+ characters outside the multibyte character range. */
+ {
+ /* #8 */ /* <WAIVER> */
+ /*input.*/ { "\244\242\244\244\244\246\244\250\244\252", "ABCDEFG" },
+ /*expect*/ { EINVAL,0,0, },
+ },
+ {
+ /* #9 */ /* <WAIVER> */
+ /*input.*/ { "ABCZEFG", "\244\242\244\244\244\246\244\250\244\252" },
+ /*expect*/ { EINVAL,0,0, },
+ },
+#endif
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ {
+ { Tstrcoll, TST_LOC_eucJP },
+ {
+ { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252",
+ "\244\242\244\244\244\246\244\250\244\252" }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252",
+ "\244\242\244\244\244\363\244\250\244\252" }, /* #2 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "\244\242\244\244\244\363\244\250\244\252",
+ "\244\242\244\244\244\246\244\250\244\252" }, /* #3 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "B", "a" }, /* #4 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "a", "B" }, /* #5 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "b", "A" }, /* #6 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "A", "b" }, /* #7 */
+ /*expect*/ { 0,0,-1, },
+ },
+#ifdef NO_WAIVER
+ /* XXX I do not yet know whether strcoll really should reject
+ characters outside the multibyte character range. */
+ {
+ /* <WAIVER> */
+ /*input.*/ { "\200\216\217", "ABCDEFG" }, /* #8 */
+ /*expect*/ { EINVAL,0,0, },
+ },
+ {
+ /* <WAIVER> */
+ /*input.*/ { "ABCZEFG", "\200\216\217" }, /* #9 */
+ /*expect*/ { EINVAL,0,0, },
+ },
+#endif
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#else
+ {
+ { Tstrcoll, TST_LOC_ja_UTF8 },
+ {
+ { /*input.*/ { "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212",
+ "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212" }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212",
+ "\343\201\202\343\201\204\343\202\223\343\201\210\343\201\212" }, /* #2 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "\343\201\202\343\201\204\343\202\223\343\201\210\343\201\212",
+ "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212" }, /* #3 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "B", "a" }, /* #4 */
+ /*expect*/ { 0,0,-1, },
+ },
+ { /*input.*/ { "a", "B" }, /* #5 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "b", "A" }, /* #6 */
+ /*expect*/ { 0,0,+1, },
+ },
+ { /*input.*/ { "A", "b" }, /* #7 */
+ /*expect*/ { 0,0,-1, },
+ },
+#ifdef NO_WAIVER
+ /* XXX I do not yet know whether strcoll really should reject
+ characters outside the multibyte character range. */
+ {
+ /* <WAIVER> */
+ /*input.*/ { "\200\216\217", "ABCDEFG" }, /* #8 */
+ /*expect*/ { EINVAL,0,0, },
+ },
+ {
+ /* <WAIVER> */
+ /*input.*/ { "ABCZEFG", "\200\216\217" }, /* #9 */
+ /*expect*/ { EINVAL,0,0, },
+ },
+#endif
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#endif
+ {
+ { Tstrcoll, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_strfmon.c b/test/locale-mbwc/dat_strfmon.c
new file mode 100644
index 0000000..8c28bba
--- /dev/null
+++ b/test/locale-mbwc/dat_strfmon.c
@@ -0,0 +1,268 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_strfmon.c
+ *
+ * STRFMON: size_t strfmon (char *buf, size_t nbyte, char *fmt, ... );
+ */
+
+/*
+ * NOTE:
+ *
+ * The buffer size should be enough to contain a string including a
+ * null char.
+ * Returns the number of bytes of the string (NOT including a null char).
+ */
+
+TST_STRFMON tst_strfmon_loc [] = {
+ {
+ { Tstrfmon, TST_LOC_de },
+ {
+ {
+ /* #01 */
+ /*inp*/ { 24, "%n %% %i", 123.00 },
+ /*exp*/ { 0,1,23, "123,00 EUR % 123,00 EUR" },
+ },
+ {
+ /* #02 */
+ /*inp*/ { 24, "%n %% %i", 123.00 },
+ /*exp*/ { 0,1,23, "123,00 EUR % 123,00 EUR" },
+ },
+ {
+ /* #03 */
+ /*inp*/ { 23, "%n %% %i", 123.00 },
+ /*exp*/ { E2BIG,1,-1, "" },
+ },
+ {
+ /* #04 */
+ /*inp*/ { 31, "%n|%i", 1234.561 },
+ /*exp*/ { 0,1,25, "1.234,56 EUR|1.234,56 EUR"},
+ },
+ {
+ /* #05 */
+ /*inp*/ { 33, "%n|%i", -1234.561 },
+ /*exp*/ { 0,1,27, "-1.234,56 EUR|-1.234,56 EUR"},
+ },
+ {
+ /* #06 */
+ /*inp*/ { 33, "%13n|%12i", 1234.561 },
+ /*exp*/ { 0,1,26, " 1.234,56 EUR|1.234,56 EUR"},
+ },
+ {
+ /* #07 */
+ /*inp*/ { 33, "%12n|%12i", -1234.561 },
+ /*exp*/ { 0,1,27, "-1.234,56 EUR|-1.234,56 EUR"},
+ },
+ {
+ /* #08 */
+ /*inp*/ { 33, "%#5n|%#5i", 1234.561 },
+ /*exp*/ { 0,1,29, " 1.234,56 EUR| 1.234,56 EUR"},
+ },
+ {
+ /* #09 */
+ /*inp*/ { 33, "%#5n|%#5i", -1234.561 },
+ /*exp*/ { 0,1,29, "- 1.234,56 EUR|- 1.234,56 EUR"},
+ },
+ {
+ /* #10 */
+ /*inp*/ { 33, "%=*#5n|%=*#5i", 1234.561 },
+ /*exp*/ { 0,1,29, " *1.234,56 EUR| *1.234,56 EUR"},
+ },
+ {
+ /* #11 */
+ /*inp*/ { 33, "%=0#5n|%=0#5i", -1234.561 },
+ /*exp*/ { 0,1,29, "-01.234,56 EUR|-01.234,56 EUR"},
+ },
+ {
+ /* #12 */
+ /*inp*/ { 33, "%^#5n|%^#5i", -1234.561 },
+ /*exp*/ { 0,1,27, "- 1234,56 EUR|- 1234,56 EUR"},
+ },
+ {
+ /* #13 */
+ /*inp*/ { 33, "%#5.0n|%#5.0i", 1234.444 },
+ /*exp*/ { 0,1,23, " 1.234 EUR| 1.234 EUR" },
+ },
+ {
+ /* #14 */
+ /*inp*/ { 33, "%#5.0n|%#5.4i", -1234.555 },
+ /*exp*/ { 0,1,28, "- 1.235 EUR|- 1.234,5550 EUR"},
+ },
+ {
+ /* #15 */
+ /*inp*/ { 33, "%(#5n|%!(#5i", -1234.561 },
+ /*exp*/ { 0,1,27, "( 1.234,56 EUR)|( 1.234,56)"},
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tstrfmon, TST_LOC_enUS },
+ {
+ {
+ /* #01 */
+ /*inp*/ { 22, "%n %% %i", 123.00 },
+ /*exp*/ { 0,1,20, "$123.00 % USD 123.00" },
+ },
+ {
+ /* #02 */
+ /*inp*/ { 21, "%n %% %i", 123.00 },
+ /*exp*/ { 0,1,20, "$123.00 % USD 123.00" },
+ },
+ {
+ /* #03 */
+ /*inp*/ { 20, "%n %% %i", 123.00 },
+ /*exp*/ { E2BIG,1,-1, "" },
+ },
+ {
+ /* #04 */
+ /*inp*/ { 30, "%n|%i", 1234.561 },
+ /*exp*/ { 0,1,22, "$1,234.56|USD 1,234.56" },
+ },
+ {
+ /* #05 */
+ /*inp*/ { 32, "%n|%i", -1234.561 },
+ /*exp*/ { 0,1,24, "-$1,234.56|-USD 1,234.56" },
+ },
+ {
+ /* #06 */
+ /*inp*/ { 30, "%12n|%12i", 1234.561 },
+ /*exp*/ { 0,1,25, " $1,234.56|USD 1,234.56"},
+ },
+ {
+ /* #07 */
+ /*inp*/ { 32, "%12n|%12i", -1234.561 },
+ /*exp*/ { 0,1,26, " -$1,234.56|-USD 1,234.56"},
+ },
+ {
+ /* #08 */
+ /*inp*/ { 32, "%#5n|%#5i", 1234.561 },
+ /*exp*/ { 0,1,26, " $ 1,234.56| USD 1,234.56"},
+ },
+ {
+ /* #09 */
+ /*inp*/ { 32, "%#5n|%#5i", -1234.561 },
+ /*exp*/ { 0,1,26, "-$ 1,234.56|-USD 1,234.56"},
+ },
+ {
+ /* #10 */
+ /*inp*/ { 32, "%=*#5n|%=*#5i", 1234.561 },
+ /*exp*/ { 0,1,26, " $*1,234.56| USD *1,234.56"},
+ },
+ {
+ /* #11 */
+ /*inp*/ { 32, "%=0#5n|%=0#5i", -1234.561 },
+ /*exp*/ { 0,1,26, "-$01,234.56|-USD 01,234.56"},
+ },
+ {
+ /* #12 */
+ /*inp*/ { 32, "%^#5n|%^#5i", -1234.561 },
+ /*exp*/ { 0,1,24, "-$ 1234.56|-USD 1234.56" },
+ },
+ {
+ /* #13 */
+ /*inp*/ { 32, "%#5.0n|%#5.0i", 1234.444 },
+ /*exp*/ { 0,1,20, " $ 1,234| USD 1,234" },
+ },
+ {
+ /* #14 */
+ /*inp*/ { 32, "%#5.0n|%#5.4i", -1234.555 },
+ /*exp*/ { 0,1,25, "-$ 1,235|-USD 1,234.5550"},
+ },
+ {
+ /* #15 */
+ /*inp*/ { 32, "%(#5n|%!(#5i", -1234.561 },
+ /*exp*/ { 0,1,24, "($ 1,234.56)|( 1,234.56)" },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Tstrfmon, TST_LOC_eucJP },
+#else
+ { Tstrfmon, TST_LOC_ja_UTF8 },
+#endif
+ {
+ {
+ /* #01 */
+ /*inp*/ { 17, "%n %% %i", 123.00 },
+ /*exp*/ { 0,1,15, "\241\357123 % JPY 123" },
+ },
+ {
+ /* #02 */
+ /*inp*/ { 16, "%n %% %i", 123.00 },
+ /*exp*/ { 0,1,15, "\241\357123 % JPY 123" },
+ },
+ {
+ /* #03 */
+ /*inp*/ { 15, "%n %% %i", 123.00 },
+ /*exp*/ { E2BIG,1,-1, "" },
+ },
+ {
+ /* #04 */
+ /*inp*/ { 30, "%n|%i", 1234.561 },
+ /*exp*/ { 0,1,17, "\241\3571,235|JPY 1,235" },
+ },
+ {
+ /* #05 */
+ /*inp*/ { 32, "%n|%i", -1234.561 },
+ /*exp*/ { 0,1,19, "\241\357-1,235|JPY -1,235" },
+ },
+ {
+ /* #06 */
+ /*inp*/ { 32, "%12n|%12i", 1234.561 },
+ /*exp*/ { 0,1,25, " \241\3571,235| JPY 1,235" },
+ },
+ {
+ /* #07 */
+ /*inp*/ { 32, "%12n|%12i", -1234.561 },
+ /*exp*/ { 0,1,25, " \241\357-1,235| JPY -1,235" },
+ },
+ {
+ /* #08 */
+ /*inp*/ { 32, "%#5n|%#5i", 1234.561 },
+ /*exp*/ { 0,1,21, " \241\357 1,235| JPY 1,235" },
+ },
+ {
+ /* #09 */
+ /*inp*/ { 32, "%#5n|%#5i", -1234.561 },
+ /*exp*/ { 0,1,21, "\241\357- 1,235|JPY - 1,235" },
+ },
+ {
+ /* #10 */
+ /*inp*/ { 32, "%=*#5n|%=*#5i", 1234.561 },
+ /*exp*/ { 0,1,21, " \241\357*1,235| JPY *1,235" },
+ },
+ {
+ /* #11 */
+ /*inp*/ { 32, "%=0#5n|%=0#5i", -1234.561 },
+ /*exp*/ { 0,1,21, "\241\357-01,235|JPY -01,235" },
+ },
+ {
+ /* #12 */
+ /*inp*/ { 32, "%^#5n|%^#5i", -1234.561 },
+ /*exp*/ { 0,1,19, "\241\357- 1235|JPY - 1235" },
+ },
+ {
+ /* #13 */
+ /*inp*/ { 32, "%#5.0n|%#5.0i", 1234.444 },
+ /*exp*/ { 0,1,21, " \241\357 1,234| JPY 1,234" },
+ },
+ {
+ /* #14 */
+ /*inp*/ { 32, "%#5.0n|%#5.4i", -1234.555 },
+ /*exp*/ { 0,1,26, "\241\357- 1,235|JPY - 1,234.5550"},
+ },
+ {
+ /* #15 */
+ /*inp*/ { 32, "%(#5n|%!(#5i", -1234.561 },
+ /*exp*/ { 0,1,19, "(\241\357 1,235)|( 1,235)" },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tstrfmon, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_strxfrm.c b/test/locale-mbwc/dat_strxfrm.c
new file mode 100644
index 0000000..0c672d3
--- /dev/null
+++ b/test/locale-mbwc/dat_strxfrm.c
@@ -0,0 +1,147 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_strxfrm.c
+ *
+ * STRXFRM: size_t strxfrm (char *s1, const char s2, size_t n);
+ */
+
+
+/*
+ * NOTE:
+ *
+ * Return value and errno value are checked only for 2nd string:
+ * org2[]; n1 and n2 don't mean bytes to be translated.
+ * It means a buffer size including a null character.
+ * Results of this test depens on results of strcoll().
+ * If you got errors, check both test results.
+ *
+ * The buffer size should be enough to contain a string including a
+ * null char. Returns the number of bytes of the string (NOT
+ * including a null char).
+ */
+
+
+
+TST_STRXFRM tst_strxfrm_loc [] = {
+ {
+ { Tstrxfrm, TST_LOC_de },
+ {
+ { /*inp*/ { "\xf6\xc4\xe4\xfc", "\xf6\xc4\xe4\xfc", 17, 17 }, /* #01 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */
+ /*exp*/ { 0,0,0 , },
+ },
+ { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "abc", "", 13, 13 }, /* #04 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "a", "B", 7, 7 }, /* #05 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "B", "a", 7, 7 }, /* #06 */
+ /*exp*/ { 0,0,0, },
+ },
+ {
+ /* hiragana == latin1 */
+ /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */
+ /*exp*/ { 0,0,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Tstrxfrm, TST_LOC_enUS },
+ {
+ { /*inp*/ { "abcd", "abcd", 17, 17 }, /* #01 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */
+ /*exp*/ { 0,0,0 , },
+ },
+ { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "abc", "", 13, 13 }, /* #04 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "a", "B", 7, 7 }, /* #05 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "B", "a", 7, 7 }, /* #06 */
+ /*exp*/ { 0,0,0, },
+ },
+#ifdef NO_WAIVER
+ {
+ /* <WAIVER> */
+ /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */
+ /*exp*/ { EINVAL,0,0, },
+ },
+#endif
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Tstrxfrm, TST_LOC_eucJP }, /* ??? */
+ {
+ {
+ /* #01 */
+ /*inp*/ { "\244\242\244\241", "\244\241\244\242", 5, 5 },
+ /*exp*/ { 0,0,0, },
+ },
+ {
+ /* #02 */
+ /*inp*/ { "\244\241\244\242", "\244\242\244\241", 5, 5 },
+ /*exp*/ { 0,0,0, },
+ },
+ {
+ /* #03 */
+ /*inp*/ { "\244\242\216\261", "\216\261\244\242", 5, 5 },
+ /*exp*/ { 0,0,0, },
+ },
+#ifdef NO_WAIVER
+ {
+ /*inp*/ { "AAA", "\216\217", 5, 5 }, /* #04 */ /* <WAIVER> */
+ /*exp*/ { EINVAL,0,0, },
+ },
+#endif
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Tstrxfrm, TST_LOC_ja_UTF8 }, /* ??? */
+ {
+ {
+ /* #01 */
+ /*inp*/ { "\343\201\202\343\201\201", "\343\201\201\343\201\202", 7, 7 },
+ /*exp*/ { 0,0,0, },
+ },
+ {
+ /* #02 */
+ /*inp*/ { "\343\201\201\343\201\202", "\343\201\202\343\201\201", 7, 7 },
+ /*exp*/ { 0,0,0, },
+ },
+ {
+ /* #03 */
+ /*inp*/ { "\343\201\202\357\275\261", "\357\275\261343\201\202", 7, 7 },
+ /*exp*/ { 0,0,0, },
+ },
+#ifdef NO_WAIVER
+ {
+ /*inp*/ { "AAA", "\340\277\220", 5, 5 }, /* #04 */ /* <WAIVER> */
+ /*exp*/ { EINVAL,0,0, },
+ },
+#endif
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Tstrxfrm, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_swscanf.c b/test/locale-mbwc/dat_swscanf.c
new file mode 100644
index 0000000..088f165
--- /dev/null
+++ b/test/locale-mbwc/dat_swscanf.c
@@ -0,0 +1,185 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_swscanf.c
+ *
+ * SWSCANF: int swscanf (const wchar_t *s, const wchar_t *fmt, ...);
+ */
+
+
+#include <errno.h>
+#include <stdlib.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+
+TST_SWSCANF tst_swscanf_loc [] =
+{
+ {
+ { Tswscanf, TST_LOC_de },
+ {
+ /*------------------------ 01 -----------------------*/
+ { { {
+ 0x002D, 0x0031, 0x003A, /* %d: -1 */
+ 0x0032, 0x003A, /* %u: 2 */
+ 0x0033, 0x002C, 0x0033, 0x003A, /* %f: 3.3 */
+ 0x00E4, 0x003A, /* %c: 'ä' */
+ 0x00C4, 0x00DC, 0x0000, 0x0000, /* %s: "ÄÜ" */
+ },
+ L"%d:%u:%f:%c:%s", 0
+ },
+ { /* The fields are: err_val, ret_flag, ret_val,
+ val_int, val_uns, val_flt, val_c, val_s, val_S. */
+ 0,1,5,
+ -1, 2, 3.3, 'ä', "ÄÜ", { 0x0000, },
+ },
+ },
+ /*------------------------ 02 -----------------------*/
+ { { {
+ 0x00E4, 0x00C4, 0x0000 /* "äÄ" */
+ },
+ L"%lc", 'C'
+ },
+ { 0,1,1,
+ 0,0,0,0,"", { 0x00E4, 0x0000 },
+ },
+ },
+ /*------------------------ 03 -----------------------*/
+ { { {
+ 0x00E4, 0x00C4, 0x0000 /* "äÄ" */
+ },
+ L"%ls", 'S'
+ },
+ { 0,1,1,
+ 0,0,0,0,"", { 0x00E4, 0x00C4, 0x0000 },
+ },
+ },
+ /*------------------------ 04 -----------------------*/
+ /* <NO_WAIVER> x 2 */
+ { { {
+ 0x00E4, 0x00C4, 0x0000 /* "äÄ" */
+ },
+ L"1%d:2%d:3%d:4%d:5%d:6%d:7%d:8%d:9%d", 0
+ },
+#ifdef SHOJI_IS_RIGHT
+ { 1,EINVAL,1,WEOF,
+ 0,0,0,0,"", { 0x0000 },
+#else
+ { 0,1,0,
+ 0,0,0,0,"", { 0x0000 },
+#endif
+ },
+ },
+ /*---------------------------------------------------*/
+ { .is_last = 1} /* Last element. */
+ }
+ },
+ {
+ { Tswscanf, TST_LOC_enUS },
+ {
+ /*------------------------ 01 -----------------------*/
+ { { { 0x002D, 0x0031, 0x003A,
+ 0x0032, 0x003A,
+ 0x0035, 0x0034, 0x002E, 0x0033, 0x0045, 0x002D, 0x0031, 0x003A,
+ 0x0041, 0x003A,
+ 0x0061, 0x0062, 0x0000, 0x0000,
+ },
+ L"%d:%u:%f:%c:%s", 0
+ },
+ { 0,1,5,
+ -1, 2, 5.43, 'A', "ab", { 0x0000 },
+ },
+ },
+ /*------------------------ 02 -----------------------*/
+ /* <NO_WAIVER> x 2 */
+ { { {
+ 0x0063, 0x0064, 0x0000
+ },
+ L"%C", 'C'
+ },
+ { 0,1,1,
+ 0,0,0,0,"", { 0x0063, 0x0000 },
+ },
+ },
+ /*------------------------ 03 -----------------------*/
+ { { {
+ 0x0063, 0x0064, 0x0000
+ },
+ L"%S", 'S'
+ },
+ { 0,1,1,
+ 0,0,0,0,"", { 0x0063, 0x0064, 0x0000 },
+ },
+ },
+ /*---------------------------------------------------*/
+ { .is_last = 1} /* Last element. */
+ }
+ },
+ {
+#if 0
+ { Tswscanf, TST_LOC_eucJP },
+#else
+ { Tswscanf, TST_LOC_ja_UTF8 },
+#endif
+ {
+ /*------------------------ 01 -----------------------*/
+ { { { 0x002D, 0x0031, 0x003A,
+ 0x0032, 0x003A,
+ 0x0033, 0x002E, 0x0033, 0x003A,
+ 0x0062, 0x003A,
+ 0x0061, 0x0062, 0x0000, 0x0000,
+ },
+ L"%d:%u:%f:%c:%s", 0
+ },
+ { 0,1,5,
+ -1, 2, 3.3, 'b', "ab", { 0x0000 }
+ },
+ },
+ /*------------------------ 02 -----------------------*/
+ { { {
+ 0x30A2, 0x30A4, 0x0000
+ },
+ L"%ls", 'S'
+ },
+ { 0,1,1,
+ 0,0,0,0,"", { 0x30A2, 0x30A4, 0x0000 }
+ },
+ },
+ /*------------------------ 03 -----------------------*/
+ { { {
+ 0x0031, 0x003A,
+ 0x0030, 0x003A,
+ 0x0033, 0x002E, 0x0039, 0x003A,
+ 0x0061, 0x003A,
+ 0x0063, 0x0064, 0x0000, 0x0000,
+ },
+ L"%2$d:%1$u:%3$f:%4$c:%5$s", 0
+ },
+ { 0,1,5,
+ 0, 1, 3.9, 'a', "cd", { 0x0000 }
+ },
+ },
+#ifdef SHOJI_IS_RIGHT
+ /* XXX This test does not make sense. The format string is
+ L"\x1\x2\x25\x53" and it is supposed to match the words
+ 0x30A2, 0x30A4, 0x0001. */
+ /*------------------------ 04 -----------------------*/
+ /* <NO_WAIVER> x 2 */
+ { { {
+ 0x30A2, 0x30A4, 0x0001, 0x0000
+ },
+ { 0x0001,0x0002,0x0025,0x0053,0x0000 }, 'S'
+ },
+ { EILSEQ,1,EOF,
+ 0,0,0,0,"", { 0x0000 }
+ },
+ },
+#endif
+ /*---------------------------------------------------*/
+ { .is_last = 1} /* Last element. */
+ }
+ },
+ {
+ { Tswscanf, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_tow-funcs.h b/test/locale-mbwc/dat_tow-funcs.h
new file mode 100644
index 0000000..4456437
--- /dev/null
+++ b/test/locale-mbwc/dat_tow-funcs.h
@@ -0,0 +1,24 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_tow-funcs.h
+ *
+ * ISW*: int tow*( wint_t wc );
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+#define TST_TOW_LOC(FUNC, func) \
+ TST_TOW## FUNC tst_tow## func ##_loc[]
+
+#define TST_TOW_REC(locale, func) \
+ { Ttow## func, TST_LOC_## locale },
+
+/*
+ * NOTE:
+ * need more test data!
+ */
diff --git a/test/locale-mbwc/dat_towctrans.c b/test/locale-mbwc/dat_towctrans.c
new file mode 100644
index 0000000..cf3712a
--- /dev/null
+++ b/test/locale-mbwc/dat_towctrans.c
@@ -0,0 +1,97 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_towctrans.c
+ *
+ * TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t charclass);
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+/*
+ * NOTE:
+ * Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
+ * Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
+ *
+ * Since the functions return *non*-zero value for TRUE, can't
+ * compare an actual return value with an expected return value.
+ * Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
+ * the non-zero value.
+ *
+ * { { WEOF }, { 0,0,1,0 } },
+ * | |
+ * | ret_val: an expected return value
+ * ret_flg: if 1, compare an actual return value with the
+ * ret_val; if 0, the test program checks
+ * the actual return value.
+ *
+ * CAUTION: if a charclass is invalid, the test function gives
+ * towctrans() an invalid wctrans object instead of a return value
+ * from wctrans() which is supposed to be 0.
+ */
+
+TST_TOWCTRANS tst_towctrans_loc [] = {
+ {
+ { Ttowctrans, TST_LOC_C },
+ {
+#ifdef SHOJI_IS_RIGHT
+ { { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 } },
+#else
+ { { 0x0010, "xxxxxxx" }, { 0, 1,0x0010 } },
+#endif
+ { { 0x007F, "tolower" }, { 0, 1,0x007F } },
+ { { 0x0061, "toupper" }, { 0, 1,0x0041 } },
+ { { 0x0041, "tolower" }, { 0, 1,0x0061 } },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Ttowctrans, TST_LOC_de },
+ {
+#ifdef SHOJI_IS_RIGHT
+ { { 0x0010, "tojkata" }, { EINVAL,1,0x0010 } },
+#else
+ { { 0x0010, "tojkata" }, { 0, 1,0x0010 } },
+#endif
+ { { 0x0080, "tolower" }, { 0, 1,0x0080 } },
+ { { 0x00EC, "toupper" }, { 0, 1,0x00CC } },
+ { { 0x00CC, "tolower" }, { 0, 1,0x00EC } },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Ttowctrans, TST_LOC_enUS },
+ {
+#ifdef SHOJI_IS_RIGHT
+ { { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 } },
+#else
+ { { 0x0010, "xxxxxxx" }, { 0, 1,0x0010 } },
+#endif
+ { { 0x007F, "tolower" }, { 0, 1,0x007F } },
+ { { 0x0061, "toupper" }, { 0, 1,0x0041 } },
+ { { 0x0041, "tolower" }, { 0, 1,0x0061 } },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Ttowctrans, TST_LOC_eucJP },
+#else
+ { Ttowctrans, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { { 0xFF21, "tolower" }, { 0, 1,0xFF41 } },
+ { { 0xFF41, "toupper" }, { 0, 1,0xFF21 } },
+ { { 0x30A1, "tojhira" }, { 0, 1,0x3041 } },
+ { { 0x3041, "tojkata" }, { 0, 1,0x30A1 } },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Ttowctrans, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_towlower.c b/test/locale-mbwc/dat_towlower.c
new file mode 100644
index 0000000..b6dd275
--- /dev/null
+++ b/test/locale-mbwc/dat_towlower.c
@@ -0,0 +1,47 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_towlower.c
+ *
+ * ISW*: int towlower (wint_t wc);
+ */
+
+
+#include "dat_tow-funcs.h"
+
+
+TST_TOW_LOC (LOWER, lower) = {
+
+ { TST_TOW_REC (de, lower)
+ {
+ { { WEOF }, { 0, 1, (wint_t)-1 } },
+ { { 0x0080 }, { 0, 1, 0x0080 } },
+ { { 0x00CC }, { 0, 1, 0x00EC } },
+ { { 0x00EC }, { 0, 1, 0x00EC } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_TOW_REC (enUS, lower)
+ {
+ { { WEOF }, { 0, 1, (wint_t)-1 } },
+ { { 0x007F }, { 0, 1, 0x007F } },
+ { { 0x0041 }, { 0, 1, 0x0061 } },
+ { { 0x0061 }, { 0, 1, 0x0061 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_TOW_REC (eucJP, lower)
+#else
+ { TST_TOW_REC (ja_UTF8, lower)
+#endif
+ {
+ { { 0x007F }, { 0, 1, 0x007F } },
+ { { 0x0080 }, { 0, 1, 0x0080 } },
+ { { 0xFF21 }, { 0, 1, 0xFF41 } },
+ { { 0xFF41 }, { 0, 1, 0xFF41 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_TOW_REC (end, lower) }
+};
diff --git a/test/locale-mbwc/dat_towupper.c b/test/locale-mbwc/dat_towupper.c
new file mode 100644
index 0000000..704ad44
--- /dev/null
+++ b/test/locale-mbwc/dat_towupper.c
@@ -0,0 +1,47 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_towupper.c
+ *
+ * ISW*: int towupper (wint_t wc);
+ */
+
+
+#include "dat_tow-funcs.h"
+
+
+TST_TOW_LOC (UPPER, upper) = {
+
+ { TST_TOW_REC (de, upper)
+ {
+ { { WEOF }, { 0, 1, (wint_t)-1 } },
+ { { 0x0080 }, { 0, 1, 0x0080 } },
+ { { 0x00EC }, { 0, 1, 0x00CC } },
+ { { 0x00CC }, { 0, 1, 0x00CC } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_TOW_REC (enUS, upper)
+ {
+ { { WEOF }, { 0, 1, (wint_t)-1 } },
+ { { 0x0080 }, { 0, 1, 0x0080 } },
+ { { 0x0041 }, { 0, 1, 0x0041 } },
+ { { 0x0061 }, { 0, 1, 0x0041 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { TST_TOW_REC (eucJP, upper)
+#else
+ { TST_TOW_REC (ja_UTF8, upper)
+#endif
+ {
+ { { WEOF }, { 0, 1, (wint_t)-1 } },
+ { { 0x007F }, { 0, 1, 0x007F } },
+ { { 0xFF41 }, { 0, 1, 0xFF21 } },
+ { { 0xFF21 }, { 0, 1, 0xFF21 } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { TST_TOW_REC (end, upper) }
+};
diff --git a/test/locale-mbwc/dat_wcrtomb.c b/test/locale-mbwc/dat_wcrtomb.c
new file mode 100644
index 0000000..055f7b0
--- /dev/null
+++ b/test/locale-mbwc/dat_wcrtomb.c
@@ -0,0 +1,122 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcrtomb.c
+ *
+ * WCRTOMB: intwcrtomb (char *s, wchar_t wc, mbstate_t *ps);
+ *
+ */
+
+TST_WCRTOMB tst_wcrtomb_loc [] = {
+ {
+ { Twcrtomb, TST_LOC_de },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x00FC, 0,0 },
+ /*expect*/ { 0, 1,1, "ü" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x00D6, 0,0 },
+ /*expect*/ { 0, 1,1, "Ö" },
+ },
+ /* #03 : error case */
+ { /*input.*/ { 1, 0xFFA1, 0,0 },
+ /*expect*/ { EILSEQ,1,-1, "" },
+ },
+ /* #04 : */
+ { /*input.*/ { 0, 0x0041, 0,0 },
+ /*expect*/ { 0, 1,1, "" },
+ },
+ /* #05 : */
+ { /*input.*/ { 0, 0x0092, 0,0 },
+ /*expect*/ { 0, 1,1, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcrtomb, TST_LOC_enUS },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x0041, 0,0 },
+ /*expect*/ { 0, 1,1, "A" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x0042, 0,0 },
+ /*expect*/ { 0, 1,1, "B" },
+ },
+ /* #03 : error case */
+ /* <WAIVER> x 2 */
+ { /*input.*/ { 1, 0x0092, 0,0 }, /* assume ascii */
+ /*expect*/ { EILSEQ,1,-1, "" },
+ },
+ /* #04 : */
+ { /*input.*/ { 0, 0x0041, 0,0 },
+ /*expect*/ { 0, 1,1, "" },
+ },
+ /* #05 : */
+ { /*input.*/ { 0, 0x0092, 0,0 },
+ /*expect*/ { 0, 1,1, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Twcrtomb, TST_LOC_eucJP },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x3042, 0,0 },
+ /*expect*/ { 0, 1,2, "\244\242" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x3044, 0,0 },
+ /*expect*/ { 0, 1,2, "\244\244" },
+ },
+ /* #03 : normal case */
+ { /*input.*/ { 1, 0x008E, 0,0 },
+ /*expect*/ { EILSEQ, 1,-1, "" },
+ },
+ /* #04 : */
+ { /*input.*/ { 0, 0x3042, 0,0 },
+ /*expect*/ { 0, 0,0, "" },
+ },
+ /* #05 : */
+ { /*input.*/ { 0, 0x008E, 0,0 },
+ /*expect*/ { 0, 0,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Twcrtomb, TST_LOC_ja_UTF8 },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x3042, 0,0 },
+ /*expect*/ { 0, 1,3, "\343\201\202" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x3044, 0,0 },
+ /*expect*/ { 0, 1,3, "\343\201\204" },
+ },
+ /* #03 : normal case */
+ { /*input.*/ { 1, 0x008E, 0,0 },
+ /*expect*/ { EILSEQ, 1,-1, "" },
+ },
+ /* #04 : */
+ { /*input.*/ { 0, 0x3042, 0,0 },
+ /*expect*/ { 0, 0,0, "" },
+ },
+ /* #05 : */
+ { /*input.*/ { 0, 0x008E, 0,0 },
+ /*expect*/ { 0, 0,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Twcrtomb, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcscat.c b/test/locale-mbwc/dat_wcscat.c
new file mode 100644
index 0000000..f54e72d
--- /dev/null
+++ b/test/locale-mbwc/dat_wcscat.c
@@ -0,0 +1,116 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcscat.c
+ *
+ * WCSCAT: wchar_t *wcscat (wchar_t *ws1, wchar_t *ws2)
+ */
+
+/* NOTE:
+ Since this is not a locale sensitive function,
+ it doesn't make sense to test the function on some
+ locales. Better make different test cases for each locale ...
+ (Also some wc* functions are not locale sensitive.)
+*/
+
+
+TST_WCSCAT tst_wcscat_loc [] = {
+
+ {
+ {Twcscat, TST_LOC_de},
+ {
+ /* 1 */
+ {{{ 0x00C1,0x00C2,0x0000 },
+ { 0x00C3,0x00C4,0x0000 }, },
+ { 0, 0, 0,
+ { 0x00C1,0x00C2,0x00C3,0x00C4,0x0000 } },
+ },
+ /* 2 */
+ {{{ 0x0001,0x0002,0x0000 },
+ { 0x0003,0x0004,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0001,0x0002,0x0003,0x0004,0x0000 } },
+ },
+ /* 3 */
+ {{{ 0x0000 },
+ { 0x00C3,0x00C4,0x0000 }, },
+ { 0, 0, 0,
+ { 0x00C3,0x00C4,0x0000 } },
+ },
+ /* 4 */
+ {{{ 0x0001,0xFFFF,0x0000 },
+ { 0x0080,0x0090,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0001,0xFFFF,0x0080,0x0090,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+ {Twcscat, TST_LOC_enUS},
+ {
+ /* 1 */
+ {{{ 0x0041,0x0042,0x0000 },
+ { 0x0043,0x0044,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0041,0x0042,0x0043,0x0044,0x0000 } },
+ },
+ /* 2 */
+ {{{ 0x0001,0x0002,0x0000 },
+ { 0x0003,0x0004,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0001,0x0002,0x0003,0x0004,0x0000 } },
+ },
+ /* 3 */
+ {{{ 0x0000 },
+ { 0x0043,0x0044,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0043,0x0044,0x0000 } },
+ },
+ /* 4 */
+ {{{ 0x0001,0xFFFF,0x0000 },
+ { 0x0080,0x0090,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0001,0xFFFF,0x0080,0x0090,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+#if 0
+ {Twcscat, TST_LOC_eucJP},
+#else
+ {Twcscat, TST_LOC_ja_UTF8},
+#endif
+ {
+ /* 1 */
+ {{{ 0x30A2,0x74E0,0x0000 },
+ { 0xFF71,0x0041,0x0000 }, },
+ { 0, 0, 0,
+ { 0x30A2,0x74E0,0xFF71,0x0041,0x0000 } },
+ },
+ /* 2 */
+ {{{ 0x0001,0x0002,0x0000 },
+ { 0x0003,0x0004,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0001,0x0002,0x0003,0x0004,0x0000 } },
+ },
+ /* 3 */
+ {{{ 0x30A2,0xFF71,0x0000 },
+ { 0x0000 }, },
+ { 0, 0, 0,
+ { 0x30A2,0xFF71,0x0000 } },
+ },
+ /* 4 */
+ {{{ 0x0001,0xFFFF,0x0000 },
+ { 0x0080,0x0090,0x0000 }, },
+ { 0, 0, 0,
+ { 0x0001,0xFFFF,0x0080,0x0090,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+ {Twcscat, TST_LOC_end}
+ }
+};
diff --git a/test/locale-mbwc/dat_wcschr.c b/test/locale-mbwc/dat_wcschr.c
new file mode 100644
index 0000000..aa355e9
--- /dev/null
+++ b/test/locale-mbwc/dat_wcschr.c
@@ -0,0 +1,94 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcschr.c
+ *
+ * WCSCHR: wchar_t *wcschr (const wchar_t *ws, wchar_t wc);
+ */
+
+TST_WCSCHR tst_wcschr_loc [] = {
+
+ { { Twcschr, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C0 }, /* #1 */
+ /*expect*/ { 0,1,(wchar_t *)NULL },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C1 }, /* #2 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C2 }, /* #3 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C3 }, /* #4 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x0000 }, /* #5 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x0000,0x00C2,0x00C3,0x0000 }, 0x00C1 }, /* #6 */
+ /*expect*/ { 0,1,(wchar_t *)NULL },
+ },
+ { /*input.*/ { { 0x0000,0x00C2,0x00C3,0x0000 }, 0x0000 }, /* #7 */
+ /*expect*/ { 0,0,0 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcschr, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0040 }, /* #1 */
+ /*expect*/ { 0,1,(wchar_t *)NULL },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0041 }, /* #2 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0042 }, /* #3 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0043 }, /* #4 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0000 }, /* #5 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, 0x0041 }, /* #6 */
+ /*expect*/ { 0,1,(wchar_t *)NULL },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, 0x0000 }, /* #7 */
+ /*expect*/ { 0,0,0 },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ { { Twcschr, TST_LOC_eucJP },
+#else
+ { { Twcschr, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3040 }, /* #1 */
+ /*expect*/ { 0,1,(wchar_t *)NULL },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3041 }, /* #2 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3042 }, /* #3 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3043 }, /* #4 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x0000 }, /* #5 */
+ /*expect*/ { 0,0,0 },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, 0x3041 }, /* #6 */
+ /*expect*/ { 0,1,(wchar_t *)NULL },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, 0x0000 }, /* #7 */
+ /*expect*/ { 0,0,0 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcschr, TST_LOC_end } }
+};
diff --git a/test/locale-mbwc/dat_wcscmp.c b/test/locale-mbwc/dat_wcscmp.c
new file mode 100644
index 0000000..a2da551
--- /dev/null
+++ b/test/locale-mbwc/dat_wcscmp.c
@@ -0,0 +1,137 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcscmp.c
+ *
+ * WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+/* NOTE:
+ This is not a locale sensitive function and
+ it may not make sence testing it for each locale ...
+*/
+
+
+TST_WCSCMP tst_wcscmp_loc [] = {
+ {
+ { Twcscmp, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x00D1,0x00D3,0x0000 },
+ { 0x0000,0x00D2,0x00D3,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D1,0x00D3,0x0000 },
+ { 0x0000,0x00D2,0x00D3,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D1,0x00D3,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D5,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D9,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x0000 },
+ { 0x00D1,0x00D2,0x00D9,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D9,0x0000 },
+ { 0x00D1,0x00D2,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,1,1, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcscmp, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0043,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0043,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0041,0x0043,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x0041,0x0045,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0049,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0000 },
+ { 0x0041,0x0042,0x0049,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
+ { 0x0041,0x0042,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,1,1, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcscmp, TST_LOC_eucJP},
+#else
+ { Twcscmp, TST_LOC_ja_UTF8},
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 },
+ { 0x0000,0x3042,0x3043,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
+ { 0x0000,0x3042,0x3043,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3041,0x3043,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x3041,0x3045,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3049,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x0000 },
+ { 0x3041,0x3042,0x3049,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,1,-1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3049,0x0000 },
+ { 0x3041,0x3042,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,1,1, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcschr, TST_LOC_end}
+ }
+};
diff --git a/test/locale-mbwc/dat_wcscoll.c b/test/locale-mbwc/dat_wcscoll.c
new file mode 100644
index 0000000..a9733ad
--- /dev/null
+++ b/test/locale-mbwc/dat_wcscoll.c
@@ -0,0 +1,210 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcscoll.c
+ *
+ * WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+/*
+ * CAUTION:
+ * When LC_COLLATE (or LC_ALL) is set for ja_JP.EUC,
+ * wcscoll() core-dumps for big values such as 0x3041
+ * (0x0041 is okay) in glibc 2.1.2.
+ *
+ * NOTE:
+ * a) When 0 is expected as a return value, set ret_flg=1.
+ * - the return value is compared with an expected value: ret_val.
+ * b) When a positive value is expected as a return value,
+ * set ret_flg=0 and set cmp_flg=+1.
+ * - the return value is not compared with the expected value
+ * (can not be compared); instead, the test program checks
+ * if the return value is positive when cmp_flg=+1.
+ * c) When a negative value is expected as a return value,
+ * ......
+ * d) When data contains invalid values, set err_val to the expected errno.
+ * Set ret_flg=0 and cmp_flg=0 so that it doesn't compare
+ * the return value with an expected value or doesn't check
+ * the sign of the return value.
+ *
+ *
+ * -------------------------------------------
+ * CASE err_val ret_flg ret_val cmp_flg
+ * -------------------------------------------
+ * a) 0 1 0 0
+ * b) 0 0 0 +1
+ * c) 0 0 0 -1
+ * d) EINVAL 0 0 0
+ * -------------------------------------------
+ */
+
+
+TST_WCSCOLL tst_wcscoll_loc [] = {
+
+ { { Twcscoll, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00E1,0x00E2,0x00E3,0x0000 },
+ { 0x00E1,0x00E2,0x00E3,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, 0, },
+ },
+ { /*input.*/ { { 0x0000,0x00E1,0x00E3,0x0000 },
+ { 0x0000,0x00E2,0x00E3,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,0, 0, },
+ },
+ { /*input.*/ { { 0x00E1,0x00E1,0x00E3,0x0000 },
+ { 0x0000,0x00E2,0x00E3,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x0000,0x00E2,0x00E3,0x0000 },
+ { 0x00E1,0x00E1,0x00E3,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x00E1,0x0042,0x00E3,0x0000 },
+ { 0x00E1,0x0061,0x00E3,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x00E1,0x0061,0x00E3,0x0000 },
+ { 0x00E1,0x0042,0x00E3,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x00E1,0x00E2,0x0000 },
+ { 0x00E1,0x00E2,0x00E9,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x00E1,0x00E2,0x00E9,0x0000 },
+ { 0x00E1,0x00E2,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x00E1,0x0092,0x00E9,0x0000 },
+ { 0x00E1,0x008E,0x00E9,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x00E1,0x008E,0x00E9,0x0000 },
+ { 0x00E1,0x0092,0x00E9,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcscoll, TST_LOC_en },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, 0, },
+ },
+ { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0043,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,0, 0, },
+ },
+ { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0043,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0041,0x0043,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+#ifdef SHOJI_IS_RIGHT
+ /* <WAIVER> */ /* assume ascii */
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0061,0x0043,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ /* <WAIVER> */ /* assume ascii */
+ { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+#else
+ /* XXX Correct order is lowercase before uppercase. */
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0061,0x0043,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+#endif
+ { /*input.*/ { { 0x0041,0x0042,0x0000 },
+ { 0x0041,0x0042,0x0049,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
+ { 0x0041,0x0042,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+#ifdef SHOJI_IS_RIGHT
+ { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
+ { 0x0041,0x008E,0x0049,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
+ { 0x0041,0x0092,0x0049,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+#else
+ /* Do not assume position of character out of range. */
+ { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
+ { 0x0041,0x008E,0x0049,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,0,0, 0, },
+ },
+ { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
+ { 0x0041,0x0092,0x0049,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,0,0, 0, },
+ },
+#endif
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ { { Twcscoll, TST_LOC_eucJP },
+#else
+ { { Twcscoll, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, 0, },
+ },
+ { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 },
+ { 0x0000,0x3042,0x3043,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,0, 0, },
+ },
+ { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
+ { 0x0000,0x3042,0x3043,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3041,0x3043,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x3041,0x0042,0x3043,0x0000 },
+ { 0x3041,0x0061,0x3043,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x3041,0x0061,0x3043,0x0000 },
+ { 0x3041,0x0042,0x3043,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0xFF71,0x0000 },
+ { 0x3041,0x3042,0x30A2,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x30A2,0x0000 },
+ { 0x3041,0x3042,0xFF71,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { /*input.*/ { { 0x30FF,0x3092,0x3049,0x0000 },
+ { 0x3041,0x308E,0x3049,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,0,0, -1, },
+ },
+ { /*input.*/ { { 0x3041,0x308E,0x3049,0x0000 },
+ { 0x30FF,0x3092,0x3049,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,0,0, +1, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcscoll, TST_LOC_end } }
+};
diff --git a/test/locale-mbwc/dat_wcscpy.c b/test/locale-mbwc/dat_wcscpy.c
new file mode 100644
index 0000000..b376bfc
--- /dev/null
+++ b/test/locale-mbwc/dat_wcscpy.c
@@ -0,0 +1,44 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcscpy.c
+ *
+ * WCSCPY: wchar_t *wcscpy (wchar_t *ws1, const wchar_t *ws2);
+ */
+
+TST_WCSCPY tst_wcscpy_loc [] = {
+
+ { { Twcscpy, TST_LOC_de },
+ {
+ { { { 0x00F1,0x00F2,0x00F3,0x0000 }, }, /* 1 */
+ { 0,0,0, { 0x00F1,0x00F2,0x00F3,0x0000, } }, },
+ { { { 0x0000,0x00F2,0x00F3,0x0000 }, }, /* 2 */
+ { 0,0,0, { 0x0000, } }, },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcscpy, TST_LOC_enUS },
+ {
+ { { { 0x0041,0x0082,0x0043,0x0000 }, }, /* 1 */
+ { 0,0,0, { 0x0041,0x0082,0x0043,0x0000, } }, },
+ { { { 0x0000,0x0082,0x0043,0x0000 }, }, /* 2 */
+ { 0,0,0, { 0x0000, } }, },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ { { Twcscpy, TST_LOC_eucJP },
+#else
+ { { Twcscpy, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { { { 0x3041,0x0092,0x3043,0x0000 }, }, /* 1 */
+ { 0,0,0, { 0x3041,0x0092,0x3043,0x0000, } }, },
+ { { { 0x0000,0x0092,0x3043,0x0000 }, }, /* 2 */
+ { 0,0,0, { 0x0000, } }, },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcscpy, TST_LOC_end }}
+
+};
diff --git a/test/locale-mbwc/dat_wcscspn.c b/test/locale-mbwc/dat_wcscspn.c
new file mode 100644
index 0000000..f6eb0c3
--- /dev/null
+++ b/test/locale-mbwc/dat_wcscspn.c
@@ -0,0 +1,164 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcscspn.c
+ *
+ * WCSCSPN: size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+
+TST_WCSCSPN tst_wcscspn_loc [] = {
+
+ { { Twcscspn, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D3,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x00D3,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x00D3,0x00D4,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D3,0x00D4,0x00D5,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x000 }, }, /* #8 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x0000,0x00D2,0x00D3,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x0000 },
+ { 0x00D1,0x00D3,0x00D4,0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcscspn, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0043,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0043,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0043,0x0044,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0043,0x0044,0x0045,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0042,0x000 }, }, /* #8 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0043,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0000 },
+ { 0x0041,0x0043,0x0044,0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ { { Twcscspn, TST_LOC_eucJP },
+#else
+ { { Twcscspn, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x0043,0x0000 },
+ { 0x3041,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x0043,0x0000 },
+ { 0x3042,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3043,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3043,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3043,0x3044,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3043,0x3044,0x3045,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x3042,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x0000,0x3042,0x3043,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x0000 },
+ { 0x3041,0x3043,0x3044,0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcscspn, TST_LOC_end }}
+};
diff --git a/test/locale-mbwc/dat_wcslen.c b/test/locale-mbwc/dat_wcslen.c
new file mode 100644
index 0000000..7bb2c89
--- /dev/null
+++ b/test/locale-mbwc/dat_wcslen.c
@@ -0,0 +1,62 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_wcslen.c
+ *
+ * WCSLEN: size_t wcslen (const wchar_t *ws);
+ */
+
+
+/*
+ * NOTE:
+ *
+ * a header in each expected data:
+ *
+ * int err_val; ... expected value for errno
+ * <typ> ret_flg; ... set ret_flg=1 to compare an expected
+ * value with an actual value
+ * <typ> ret_val; ... expected value for return
+ */
+
+
+TST_WCSLEN tst_wcslen_loc [] = {
+
+ { { Twcslen, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 } }, /* #01 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x0000 } }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcslen, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 } }, /* #01 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x0000 } }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ { { Twcslen, TST_LOC_eucJP },
+#else
+ { { Twcslen, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 } }, /* #01 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x0000 } }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twcslen, TST_LOC_end }}
+};
diff --git a/test/locale-mbwc/dat_wcsncat.c b/test/locale-mbwc/dat_wcsncat.c
new file mode 100644
index 0000000..9d1e46b
--- /dev/null
+++ b/test/locale-mbwc/dat_wcsncat.c
@@ -0,0 +1,158 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcsncat.c
+ *
+ * WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, wchar_t *ws2, size_t n);
+ */
+
+
+/*
+ * Note:
+ * A terminating null wide chararacter is always appended to
+ * the result: ws1.
+ *
+ */
+
+
+TST_WCSNCAT tst_wcsncat_loc [] = {
+ {
+ {Twcsncat, TST_LOC_de},
+ {
+ /* 1 */
+ {
+ /* Input: */
+ {{ 0x00D1,0x00D2,0x0000 },
+ { 0x00D3,0x00D4,0x0000 }, 3 },
+ /* Expect: */
+ { 0, 0, 0,
+ { 0x00D1,0x00D2,0x00D3,0x00D4,0x0000 } },
+ },
+ /* 2 */
+ {{{ 0x00D1,0x00D2,0x0000 },
+ { 0x00D3,0x00D4,0x0000 }, 2 },
+ { 0, 0, 0,
+ { 0x00D1,0x00D2,0x00D3,0x00D4,0x0000 } },
+ },
+ /* 3 */
+ {{{ 0x00E1,0x00E2,0x0000 },
+ { 0x00E3,0x00E4,0x0000 }, 1 },
+ { 0, 0, 0,
+ { 0x00E1,0x00E2,0x00E3,0x0000 } },
+ },
+ /* 4 */
+ {{{ 0x00E1,0x00E2,0x0000 },
+ { 0x00E3,0x00E4,0x0000 }, 0 },
+ { 0, 0, 0,
+ { 0x00E1,0x00E2,0x0000 } },
+ },
+ /* 5 */
+ {{{ 0x0000 },
+ { 0x00D3,0x00D4,0x0000 }, 3 },
+ { 0, 0, 0,
+ { 0x00D3,0x00D4,0x0000 } },
+ },
+ /* 6 */
+ {{{ 0x00E1,0x00E2,0x0000 },
+ { 0x0000 }, 3 },
+ { 0, 0, 0,
+ { 0x00E1,0x00E2,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+ {Twcsncat, TST_LOC_enUS},
+ {
+ /* 1 */
+ {
+ /* Input: */
+ {{ 0x0041,0x0042,0x0000 },
+ { 0x0043,0x0044,0x0000 }, 3 },
+ /* Expect: */
+ { 0, 0, 0,
+ { 0x0041,0x0042,0x0043,0x0044,0x0000 } },
+ },
+ /* 2 */
+ {{{ 0x0041,0x0042,0x0000 },
+ { 0x0043,0x0044,0x0000 }, 2 },
+ { 0, 0, 0,
+ { 0x0041,0x0042,0x0043,0x0044,0x0000 } },
+ },
+ /* 3 */
+ {{{ 0x0051,0x0052,0x0000 },
+ { 0x0053,0x0054,0x0000 }, 1 },
+ { 0, 0, 0,
+ { 0x0051,0x0052,0x0053,0x0000 } },
+ },
+ /* 4 */
+ {{{ 0x0051,0x0052,0x0000 },
+ { 0x0053,0x0054,0x0000 }, 0 },
+ { 0, 0, 0,
+ { 0x0051,0x0052,0x0000 } },
+ },
+ /* 5 */
+ {{{ 0x0000 },
+ { 0x0043,0x0044,0x0000 }, 3 },
+ { 0, 0, 0,
+ { 0x0043,0x0044,0x0000 } },
+ },
+ /* 6 */
+ {{{ 0x0051,0x0052,0x0000 },
+ { 0x0000 }, 3 },
+ { 0, 0, 0,
+ { 0x0051,0x0052,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+#if 0
+ {Twcsncat, TST_LOC_eucJP},
+#else
+ {Twcsncat, TST_LOC_ja_UTF8},
+#endif
+ {
+ /* 1 */
+ {{{ 0x3041,0x3042,0x0000 },
+ { 0x3043,0x3044,0x0000 }, 3 },
+ { 0, 0, 0,
+ { 0x3041,0x3042,0x3043,0x3044,0x0000 } },
+ },
+ /* 2 */
+ {{{ 0x30A2,0x30A3,0x0000 },
+ { 0xFF71,0xFF72,0x0000 }, 2 },
+ { 0, 0, 0,
+ { 0x30A2,0x30A3,0xFF71,0xFF72,0x0000 } },
+ },
+ /* 3 */
+ {{{ 0x3051,0x3052,0x0000 },
+ { 0x3053,0x3054,0x0000 }, 1 },
+ { 0, 0, 0,
+ { 0x3051,0x3052,0x3053,0x0000 } },
+ },
+ /* 4 */
+ {{{ 0x3051,0x3052,0x0000 },
+ { 0x3053,0x3054,0x0000 }, 0 },
+ { 0, 0, 0,
+ { 0x3051,0x3052,0x0000 } },
+ },
+ /* 5 */
+ {{{ 0x0000 },
+ { 0x3043,0x3044,0x0000 }, 3 },
+ { 0, 0, 0,
+ { 0x3043,0x3044,0x0000 } },
+ },
+ /* 6 */
+ {{{ 0x3051,0x3052,0x0000 },
+ { 0x0000 }, 3 },
+ { 0, 0, 0,
+ { 0x3051,0x3052,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+ {Twcsncat, TST_LOC_end}
+ }
+};
diff --git a/test/locale-mbwc/dat_wcsncmp.c b/test/locale-mbwc/dat_wcsncmp.c
new file mode 100644
index 0000000..5c59631
--- /dev/null
+++ b/test/locale-mbwc/dat_wcsncmp.c
@@ -0,0 +1,144 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcsncmp.c
+ *
+ * WCSNCMP: int wcsncmp (const wchar_t *ws1, const wchar_t *ws2,
+ * size_t n);
+ */
+
+TST_WCSNCMP tst_wcsncmp_loc [] = {
+ {
+ { Twcsncmp, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, 4 }, /* #01 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, 3 }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D1,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, 2 }, /* #03 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D0,0x00D2,0x00D3,0x0000 }, 0 }, /* #04 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x0000,0x00D2,0x00D1,0x0000 }, 3 }, /* #05 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x0000,0x00D2,0x00D3,0x0000 }, 3 }, /* #06 */
+ /*expect*/ { 0,1,0x00D1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D9,0x0000 }, 2 }, /* #07 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D9,0x0000 }, 3 }, /* #08 */
+ /*expect*/ { 0,1,-0x0006, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x0000 }, 4 }, /* #09 */
+ /*expect*/ { 0,1,0x00D3, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsncmp, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* #01 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, 3 }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0041,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, 2 }, /* #03 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0040,0x0042,0x0043,0x0000 }, 0 }, /* #04 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0041,0x0000 }, 3 }, /* #05 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0043,0x0000 }, 3 }, /* #06 */
+ /*expect*/ { 0,1,0x0041, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0049,0x0000 }, 2 }, /* #07 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0049,0x0000 }, 3 }, /* #08 */
+ /*expect*/ { 0,1,-0x0006, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0000 }, 4 }, /* #09 */
+ /*expect*/ { 0,1,0x0043, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcsncmp, TST_LOC_eucJP },
+#else
+ { Twcsncmp, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* #01 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3041,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* #03 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3040,0x3042,0x3043,0x0000 }, 0 }, /* #04 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x0000,0x3042,0x3041,0x0000 }, 3 }, /* #05 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x0000,0x3042,0x3043,0x0000 }, 3 }, /* #06 */
+ /*expect*/ { 0,1,0x3041, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3049,0x0000 }, 2 }, /* #07 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3049,0x0000 }, 3 }, /* #08 */
+ /*expect*/ { 0,1,-0x0006, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x0000 }, 4 }, /* #09 */
+ /*expect*/ { 0,1,0x3043, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsncmp, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcsncpy.c b/test/locale-mbwc/dat_wcsncpy.c
new file mode 100644
index 0000000..7a65783
--- /dev/null
+++ b/test/locale-mbwc/dat_wcsncpy.c
@@ -0,0 +1,119 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcsncpy.c
+ *
+ * WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2,
+ * size_t n);
+ */
+
+
+/* Note:
+ *
+ * An initial value of ws1 in the test program is defined as:
+ *
+ * #define WCSNUM_NCPY 7
+ * wchar_t ws1 [WCSSIZE] = { 0x9999, 0x9999, 0x9999, 0x9999,
+ * 0x9999, 0x9999, 0x0000 };
+ * */
+
+
+TST_WCSNCPY tst_wcsncpy_loc [] = {
+ {
+ {Twcsncpy, TST_LOC_de},
+ {
+ /* 1 */
+ {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 6 },
+ { 0,0,0, { 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x0000,0x0000 } },
+ },
+ /* 2 */
+ {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 5 },
+ { 0,0,0, { 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x9999,0x0000 } },
+ },
+ /* 3 */
+ {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 3 },
+ { 0,0,0, { 0x00D1,0x00D2,0x00D3,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 4 */
+ {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 2 },
+ { 0,0,0, { 0x00D1,0x00D2,0x9999,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 5 */
+ {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 0 },
+ { 0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 6 */
+ {{ { 0x0000,0x00D2,0x00D3,0x0000 }, 3 },
+ { 0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+ {Twcsncpy, TST_LOC_enUS},
+ {
+ /* 1 */
+ {{ { 0x0041,0x0042,0x0043,0x0000 }, 6 },
+ { 0,0,0, { 0x0041,0x0042,0x0043,0x0000,0x0000,0x0000,0x0000 } },
+ },
+ /* 2 */
+ {{ { 0x0041,0x0042,0x0043,0x0000 }, 5 },
+ { 0,0,0, { 0x0041,0x0042,0x0043,0x0000,0x0000,0x9999,0x0000 } },
+ },
+ /* 3 */
+ {{ { 0x0041,0x0042,0x0043,0x0000 }, 3 },
+ { 0,0,0, { 0x0041,0x0042,0x0043,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 4 */
+ {{ { 0x0041,0x0042,0x0043,0x0000 }, 2 },
+ { 0,0,0, { 0x0041,0x0042,0x9999,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 5 */
+ {{ { 0x0041,0x0042,0x0043,0x0000 }, 0 },
+ { 0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 6 */
+ {{ { 0x0000,0x0042,0x0043,0x0000 }, 3 },
+ { 0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+#if 0
+ {Twcsncpy, TST_LOC_eucJP},
+#else
+ {Twcsncpy, TST_LOC_ja_UTF8},
+#endif
+ {
+ /* 1 */
+ {{ { 0x3041,0x3042,0x3043,0x0000 }, 6 },
+ { 0,0,0, { 0x3041,0x3042,0x3043,0x0000,0x0000,0x0000,0x0000 } },
+ },
+ /* 2 */
+ {{ { 0x3041,0x3042,0x3043,0x0000 }, 5 },
+ { 0,0,0, { 0x3041,0x3042,0x3043,0x0000,0x0000,0x9999,0x0000 } },
+ },
+ /* 3 */
+ {{ { 0x3041,0x3042,0x3043,0x0000 }, 3 },
+ { 0,0,0, { 0x3041,0x3042,0x3043,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 4 */
+ {{ { 0x3041,0x3042,0x3043,0x0000 }, 2 },
+ { 0,0,0, { 0x3041,0x3042,0x9999,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 5 */
+ {{ { 0x3041,0x3042,0x3043,0x0000 }, 0 },
+ { 0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ /* 6 */
+ {{ { 0x0000,0x3042,0x3043,0x0000 }, 3 },
+ { 0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 } },
+ },
+ {.is_last = 1}
+ }
+ },
+ {
+ {Twcsncpy, TST_LOC_end}
+ }
+};
diff --git a/test/locale-mbwc/dat_wcspbrk.c b/test/locale-mbwc/dat_wcspbrk.c
new file mode 100644
index 0000000..471515e
--- /dev/null
+++ b/test/locale-mbwc/dat_wcspbrk.c
@@ -0,0 +1,176 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcspbrk.c
+ *
+ * WCSSTR: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+
+/*
+ * NOTE:
+ * This is not a locale sensitive function.
+ * So those data in each locale doesn't make sense
+ * ... (redundant test cases)
+ */
+
+
+TST_WCSPBRK tst_wcspbrk_loc [] = {
+ {
+ { Twcspbrk, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,0,0, 0x00D1 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,0,0, 0x00D2 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D3,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,0,0, 0x00D3 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,0,0, 0x00D1 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x00D3,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,0,0, 0x00D2 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,0,0, 0x00D1 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D0,0x00D4,0x00D5,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D5,0x00D0,0x00D4,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x0000 }, }, /* #09 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcspbrk, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,0,0, 0x0041 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,0,0, 0x0042 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0043,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,0,0, 0x0043 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,0,0, 0x0041 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0043,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,0,0, 0x0042 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,0,0, 0x0041 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0040,0x0044,0x0045,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0045,0x0040,0x0044,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0000 }, }, /* #09 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcspbrk, TST_LOC_eucJP },
+#else
+ { Twcspbrk, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,0,0, 0x3041 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,0,0, 0x3042 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3043,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,0,0, 0x3043 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,0,0, 0x3041 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3043,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,0,0, 0x3042 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,0,0, 0x3041 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3043,0x3044,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,0,0, 0x3042 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3040,0x3041,0x3042,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,0,0, 0x3041 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x0000 }, }, /* #09 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x3041,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, 0x0000 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcspbrk, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcsrtombs.c b/test/locale-mbwc/dat_wcsrtombs.c
new file mode 100644
index 0000000..f8adc6c
--- /dev/null
+++ b/test/locale-mbwc/dat_wcsrtombs.c
@@ -0,0 +1,272 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcsrtombs.c
+ *
+ * WCSTOMBS: size_t wcsrtombs (char *s, const wchar_t **ws,
+ * size_t n, mbstate *ps)
+ */
+
+
+/*
+ * CAUTION:
+ * Do not use a value 0x01 for string data. The test program
+ * uses it.
+ *
+ */
+
+
+TST_WCSRTOMBS tst_wcsrtombs_loc [] = {
+ {
+ { Twcsrtombs, TST_LOC_de },
+ {
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 0, 0, 0},
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 1, 0, 0 },
+ /*expect*/ { 0,1,1, "Ä" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 2, 0, 0 },
+ /*expect*/ { 0,1,2, "ÄÖ" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 3, 0, 0 },
+ /*expect*/ { 0,1,3, "ÄÖÜ" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 4, 0, 0 },
+ /*expect*/ { 0,1,3, "ÄÖÜ" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,3, "ÄÖÜ" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 0, 0, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 1, 0, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsrtombs, TST_LOC_enUS },
+ {
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 0, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 1, 0, 0 },
+ /*expect*/ { 0,1,1, "A" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 2, 0, 0 },
+ /*expect*/ { 0,1,2, "AB" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 3, 0, 0 },
+ /*expect*/ { 0,1,3, "ABC" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 4, 0, 0 },
+ /*expect*/ { 0,1,3, "ABC" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,3, "ABC" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0041,0x0042,0x0043,0x0000 }, 0, 0, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0041,0x0042,0x0043,0x0000 }, 1, 0, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0041,0x0042,0x0043,0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Twcsrtombs, TST_LOC_eucJP },
+ {
+
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 2, 0, 0 },
+ /*expect*/ { 0,1,2, "\244\242" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 4, 0, 0 },
+ /*expect*/ { 0,1,4, "\244\242\244\244" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 6, 0, 0 },
+ /*expect*/ { 0,1,6, "\244\242\244\244\216\263" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 7, 0, 0 },
+ /*expect*/ { 0,1,6, "\244\242\244\244\216\263" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 8, 0, 0 },
+ /*expect*/ { 0,1,6, "\244\242\244\244\216\263" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+ /*expect*/ { EILSEQ,1,-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+ /*expect*/ { 0,1,6, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 1, 0, 0 },
+ /*expect*/ { 0,1,6, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 8, 0, 0 },
+ /*expect*/ { 0,1,6, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Twcsrtombs, TST_LOC_ja_UTF8 },
+ {
+
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 3, 0, 0 },
+ /*expect*/ { 0,1,3, "\343\201\202" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 6, 0, 0 },
+ /*expect*/ { 0,1,6, "\343\201\202\343\201\204" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 9, 0, 0 },
+ /*expect*/ { 0,1,9, "\343\201\202\343\201\204\357\275\263" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 10, 0, 0 },
+ /*expect*/ { 0,1,9, "\343\201\202\343\201\204\357\275\263" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 11, 0, 0 },
+ /*expect*/ { 0,1,9, "\343\201\202\343\201\204\357\275\263" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+ /*expect*/ { EILSEQ,1,-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+ /*expect*/ { 0,1,9, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 1, 0, 0 },
+ /*expect*/ { 0,1,9, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 8, 0, 0 },
+ /*expect*/ { 0,1,9, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5, 0, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Twcsrtombs, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcsspn.c b/test/locale-mbwc/dat_wcsspn.c
new file mode 100644
index 0000000..06af2d6
--- /dev/null
+++ b/test/locale-mbwc/dat_wcsspn.c
@@ -0,0 +1,179 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcsspn.c
+ *
+ * WCSSPN: size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+TST_WCSSPN tst_wcsspn_loc [] = {
+ {
+ { Twcsspn, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D3,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D4,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x00D3,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D3,0x00D4,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x0000 }, }, /* #09 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x0000,0x00D2,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x0000,0x00D2,0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x00D1,0x0000 }, }, /* #12 */
+ /*expect*/ { 0,1,2, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsspn, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0043,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0044,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0043,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0043,0x0044,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0000 }, }, /* #09 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0000,0x0042,0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0041,0x0000 }, }, /* #12 */
+ /*expect*/ { 0,1,2, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcsspn, TST_LOC_eucJP },
+#else
+ { Twcsspn, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x0000 }, }, /* #1 */
+ /*expect*/ { 0,1,1, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x0000 }, }, /* #2 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3043,0x0000 }, }, /* #3 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3044,0x0000 }, }, /* #4 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3043,0x0000 }, }, /* #5 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3043,0x3044,0x0000 }, }, /* #6 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #7 */
+ /*expect*/ { 0,1,3, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #8 */
+ /*expect*/ { 0,1,2, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x3042,0x0000 }, }, /* #9 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x0000,0x3042,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x0000,0x3042,0x0000 }, }, /* #11 */
+ /*expect*/ { 0,1,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3041,0x0000 }, }, /* #12 */
+ /*expect*/ { 0,1,2, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsspn, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcsstr.c b/test/locale-mbwc/dat_wcsstr.c
new file mode 100644
index 0000000..f999dc5
--- /dev/null
+++ b/test/locale-mbwc/dat_wcsstr.c
@@ -0,0 +1,175 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcsstr.c
+ *
+ * WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+/*
+ * NOTE:
+ * This is not a locale sensitive function.
+ * So those data in each locale doesn't make sense ...
+ * (redundant test cases)
+ */
+
+
+TST_WCSSTR tst_wcsstr_loc [] = {
+ {
+ { Twcsstr, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D3,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x00D3,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D2,0x00D3,0x00D4,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x00D0,0x00D1,0x00D2,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+ { 0x0000 }, }, /* #09 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x00D1,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+ { 0x0000 }, }, /* #11 */
+ /*expect*/ { 0,0,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsstr, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0043,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0043,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0042,0x0043,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0042,0x0043,0x0044,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0040,0x0041,0x0042,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+ { 0x0000 }, }, /* #09 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0041,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+ { 0x0000 }, }, /* #11 */
+ /*expect*/ { 0,0,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcsstr, TST_LOC_eucJP },
+#else
+ { Twcsstr, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x0000 }, }, /* #01 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x0000 }, }, /* #02 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3043,0x0000 }, }, /* #03 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x0000 }, }, /* #04 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3043,0x0000 }, }, /* #05 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3041,0x3042,0x3043,0x0000 }, }, /* #06 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3042,0x3043,0x3044,0x0000 }, }, /* #07 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x3040,0x3041,0x3042,0x0000 }, }, /* #08 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+ { 0x0000 }, }, /* #09 */
+ /*expect*/ { 0,0,0, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x3041,0x0000 }, }, /* #10 */
+ /*expect*/ { 0,1,(wchar_t *)NULL, },
+ },
+ { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+ { 0x0000 }, }, /* #11 */
+ /*expect*/ { 0,0,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsstr, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcstod.c b/test/locale-mbwc/dat_wcstod.c
new file mode 100644
index 0000000..c7b4018
--- /dev/null
+++ b/test/locale-mbwc/dat_wcstod.c
@@ -0,0 +1,78 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_wcstod.c
+ *
+ * WCSTOD: double wcstod (const wchar_t *np, wchar_t **endp);
+ */
+
+
+/*
+ * NOTE:
+ * need more test data!
+ *
+ */
+
+
+TST_WCSTOD tst_wcstod_loc [] = {
+ {
+ { Twcstod, TST_LOC_de },
+ {
+ {
+ /*01*/
+ /*I*/
+ {{ 0x0030,0x0030,0x0030,0x002C,0x0030,0x0030,0x0030,0x0030,0x0000 }},
+ /*E*/
+ { 0,1,0.0, 0.0, 0x0000 }
+ },
+ {
+ /*02*/
+ /*I*/
+ {{ 0x0031,0x0032,0x0033,0x002C,0x0034,0x0035,0x0036,0x0040,0x0000 }},
+ /*E*/
+ { 0,1,123.456, 123.456, 0x0040 }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcstod, TST_LOC_enUS },
+ {
+ {
+ /*01*/
+ /*I*/
+ {{ 0x0030,0x0030,0x0030,0x002E,0x0030,0x0030,0x0030,0x0030,0x0000 }},
+ /*E*/
+ { 0,1,0.0, 0.0, 0x0000 }
+ },
+ {
+ /*02*/
+ /*I*/
+ {{ 0x0031,0x0032,0x0033,0x002E,0x0034,0x0035,0x0036,0x0040,0x0000 }},
+ /*E*/
+ { 0,1,123.456, 123.456, 0x0040 }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcstod, TST_LOC_eucJP },
+#else
+ { Twcstod, TST_LOC_ja_UTF8 },
+#endif
+ {
+ {
+ /*01*/
+ /*I*/
+ {{ 0x0031,0x0032,0x0033,0x002E,0x0034,0x0035,0x0036,0x0040,0x0000 }},
+ /*E*/
+ { 0,1,123.456, 123.456, 0x0040 }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcstod, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcstok.c b/test/locale-mbwc/dat_wcstok.c
new file mode 100644
index 0000000..559b401
--- /dev/null
+++ b/test/locale-mbwc/dat_wcstok.c
@@ -0,0 +1,138 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_wcstok.c
+ *
+ * WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm,
+ * wchar_t **pt);
+ */
+
+/*
+ * NOTE:
+ * need more test data!
+ * locale insensitive function...
+ */
+
+
+
+
+TST_WCSTOK tst_wcstok_loc [] = {
+ {
+ { Twcstok, TST_LOC_de },
+ {
+ {
+ {
+ {
+ { 1, { 0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,
+ 0x00D9,0x0000 },
+ { 0x00D3,0x00D2, 0x00D5 }
+ },
+ { 0, { 0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,
+ 0x00D9,0x0000 },
+ { 0x00D3,0x00D2, 0x00D5 }
+ },
+ { 0, { 0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,
+ 0x00D9,0x0000 },
+ { 0x00D3,0x00D2, 0x00D5 }
+ },
+ }
+ },
+ {
+ {
+ { 0, 0,0,
+ { 0x00D1,0x0000 }
+ },
+ { 0, 0,0,
+ { 0x00D4,0x0000 }
+ },
+ { 0, 0,0,
+ { 0x00D6,0x00D7,0x00D8,0x00D9,0x0000 }
+ },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcstok, TST_LOC_enUS },
+ {
+ {
+ {
+ {
+ { 1, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+ 0x0049,0x0000 },
+ { 0x0043,0x0042, 0x0045 }
+ },
+ { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+ 0x0049,0x0000 },
+ { 0x0043,0x0042, 0x0045 }
+ },
+ { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+ 0x0049,0x0000 },
+ { 0x0043,0x0042, 0x0045 }
+ },
+ }
+ },
+ {
+ {
+ { 0, 0,0,
+ { 0x0041,0x0000 }
+ },
+ { 0, 0,0,
+ { 0x0044,0x0000 }
+ },
+ { 0, 0,0,
+ { 0x0046,0x0047,0x0048,0x0049,0x0000 }
+ },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcstok, TST_LOC_eucJP },
+#else
+ { Twcstok, TST_LOC_ja_UTF8 },
+#endif
+ {
+ {
+ {
+ {
+ { 1, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+ 0x0049,0x0000 },
+ { 0x0043,0x0042, 0x0045 }
+ },
+ { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+ 0x0049,0x0000 },
+ { 0x0043,0x0042, 0x0045 }
+ },
+ { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+ 0x0049,0x0000 },
+ { 0x0043,0x0042, 0x0045 }
+ },
+ }
+ },
+ {
+ {
+ { 0, 0,0,
+ { 0x0041,0x0000 }
+ },
+ { 0, 0,0,
+ { 0x0044,0x0000 }
+ },
+ { 0, 0,0,
+ { 0x0046,0x0047,0x0048,0x0049,0x0000 }
+ },
+ }
+ }
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcstok, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcstombs.c b/test/locale-mbwc/dat_wcstombs.c
new file mode 100644
index 0000000..ffeb0ef
--- /dev/null
+++ b/test/locale-mbwc/dat_wcstombs.c
@@ -0,0 +1,271 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcstombs.c
+ *
+ * WCSTOMBS: size_t wcstombs (char *s, const wchar_t *ws, size_t n)
+ */
+
+
+/*
+ * CAUTION:
+ * Do not use a value 0x01 for string data. The test program
+ * uses it.
+ *
+ */
+
+
+TST_WCSTOMBS tst_wcstombs_loc [] = {
+ {
+ { Twcstombs, TST_LOC_de },
+ {
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 1 },
+ /*expect*/ { 0,1,1, "Ä" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 2 },
+ /*expect*/ { 0,1,2, "ÄÖ" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 3 },
+ /*expect*/ { 0,1,3, "ÄÖÜ" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 4 },
+ /*expect*/ { 0,1,3, "ÄÖÜ" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 5 },
+ /*expect*/ { 0,1,3, "ÄÖÜ" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 1 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x00C4,0x00D6,0x00DC,0x0000 }, 5 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcstombs, TST_LOC_enUS },
+ {
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x00C4,0x0042,0x0043,0x0000 }, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 1 },
+ /*expect*/ { 0,1,1, "A" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 2 },
+ /*expect*/ { 0,1,2, "AB" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 3 },
+ /*expect*/ { 0,1,3, "ABC" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 4 },
+ /*expect*/ { 0,1,3, "ABC" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x0041,0x0042,0x0043,0x0000 }, 5 },
+ /*expect*/ { 0,1,3, "ABC" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0041,0x0042,0x0043,0x0000 }, 0 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0041,0x0042,0x0043,0x0000 }, 1 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0041,0x0042,0x0043,0x0000 }, 5 },
+ /*expect*/ { 0,1,3, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5, },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Twcstombs, TST_LOC_eucJP },
+ {
+
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 2 },
+ /*expect*/ { 0,1,2, "\244\242" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 4 },
+ /*expect*/ { 0,1,4, "\244\242\244\244" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 6 },
+ /*expect*/ { 0,1,6, "\244\242\244\244\216\263" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 7 },
+ /*expect*/ { 0,1,6, "\244\242\244\244\216\263" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 8 },
+ /*expect*/ { 0,1,6, "\244\242\244\244\216\263" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2 },
+ /*expect*/ { EILSEQ,1,-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0 },
+ /*expect*/ { 0,1,6, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 1 },
+ /*expect*/ { 0,1,6, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 8 },
+ /*expect*/ { 0,1,6, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Twcstombs, TST_LOC_ja_UTF8 },
+ {
+
+ /* #01 : Any chars including a null char should not be stored in s. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #02 : Only one chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 3 },
+ /*expect*/ { 0,1,3, "\343\201\202" },
+ },
+ /* #03 : Only two chars should be stored in s. No null termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 6 },
+ /*expect*/ { 0,1,6, "\343\201\202\343\201\204" },
+ },
+ /* #04 : Only three chars should be stored in s. No null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 9 },
+ /*expect*/ { 0,1,9, "\343\201\202\343\201\204\357\275\263" },
+ },
+ /* #05 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 10 },
+ /*expect*/ { 0,1,9, "\343\201\202\343\201\204\357\275\263" },
+ },
+ /* #06 : Only three chars should be stored in s with a null
+ termination. */
+ { /*input.*/ { 1,1, { 0x3042,0x3044,0xFF73,0x0000 }, 11 },
+ /*expect*/ { 0,1,9, "\343\201\202\343\201\204\357\275\263" },
+ },
+ /* #07 : Invalid mb sequence. No chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0201,0x0221,0x0000,0x0000 }, 2 },
+ /*expect*/ { EILSEQ,1,-1, "" },
+ },
+ /* #08 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 0 },
+ /*expect*/ { 0,1,9, "" },
+ },
+ /* #09 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 1 },
+ /*expect*/ { 0,1,9, "" },
+ },
+ /* #10 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x3042,0x3044,0xFF73,0x0000 }, 8 },
+ /*expect*/ { 0,1,9, "" },
+ },
+ /* #11 : s is a null pointer. No chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0201,0x0221,0x0000,0x0000 }, 5 },
+ /*expect*/ { EILSEQ,1,(size_t)-1, "" },
+ },
+ /* #12 : ws is a null wc string, no chars should be stored in s. */
+ { /*input.*/ { 1,1, { 0x0000 }, 5 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ /* #13 : s is a null pointer, no chars should be stored in s. */
+ { /*input.*/ { 0,1, { 0x0000 }, 5 },
+ /*expect*/ { 0,1,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Twcstombs, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcswidth.c b/test/locale-mbwc/dat_wcswidth.c
new file mode 100644
index 0000000..6d2f98e
--- /dev/null
+++ b/test/locale-mbwc/dat_wcswidth.c
@@ -0,0 +1,263 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcswidth.c
+ *
+ * WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n);
+ */
+
+TST_WCSWIDTH tst_wcswidth_loc [] = {
+ {
+ { Twcswidth, TST_LOC_de },
+ {
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0 }, /* 01 */
+ /*expect*/ { 0,1,0 },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 1 }, /* 02 */
+ /*expect*/ { 0,1,1 },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 2 }, /* 03 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 3 }, /* 04 */
+ /*expect*/ { 0,1,3 },
+ },
+ { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 4 }, /* 05 */
+ /*expect*/ { 0,1,3 },
+ },
+ { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
+ /*expect*/ { 0,1,0 },
+ },
+ { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 07 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 1 }, /* 08 */
+ /*expect*/ { 0,1,1 },
+ },
+ { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 09 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x00C1,0x0092,0x0000 }, 2 }, /* 10 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x00C1,0x0020,0x0000 }, 2 }, /* 11 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x00C1,0x0021,0x0000 }, 2 }, /* 12 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x00C1,0x007E,0x0000 }, 2 }, /* 13 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x00C1,0x007F,0x0000 }, 2 }, /* 14 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x00C1,0x0080,0x0000 }, 2 }, /* 15 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x00C1,0x00A0,0x0000 }, 2 }, /* 16 */
+#ifdef SHOJI_IS_RIGHT
+ /*expect*/ { 0,1,-1 },
+#else
+ /*expect*/ { 0,1,2 },
+#endif
+ },
+ { /*input.*/ { { 0x00C1,0x00A1,0x0000 }, 2 }, /* 17 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x00C1,0x00FF,0x0000 }, 2 }, /* 18 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcswidth, TST_LOC_enUS },
+ {
+ { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 0 }, /* 01 */
+ /*expect*/ { 0,1,0 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 1 }, /* 02 */
+ /*expect*/ { 0,1,1 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 2 }, /* 03 */
+ /*expect*/ { 0,1,2 },
+ },
+#ifdef SHOJI_IS_RIGHT
+ { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */
+ /*expect*/ { 0,1,3 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 4 }, /* 05 */
+ /*expect*/ { 0,1,3 },
+ },
+#else
+ { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* 05 */
+ /*expect*/ { 0,1,3 },
+ },
+#endif
+ { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
+ /*expect*/ { 0,1,0 },
+ },
+ { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 07 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x0001,0x0000 }, 1 }, /* 08 */
+ /*expect*/ { 0,1,1 },
+ },
+ { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 09 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x0092,0x0000 }, 2 }, /* 10 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 11 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */
+ /*expect*/ { 0,1,-1 },
+ },
+#ifdef SHOJI_IS_RIGHT
+ { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x00FF,0x0000 }, 2 }, /* 18 */
+ /*expect*/ { 0,1,2 },
+ },
+#else
+ { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 17 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 18 */
+ /*expect*/ { 0,1,2 },
+ },
+#endif
+ { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcswidth, TST_LOC_eucJP },
+#else
+ { Twcswidth, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0 }, /* 01 */
+ /*expect*/ { 0,1,0 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 1 }, /* 02 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* 03 */
+ /*expect*/ { 0,1,4 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* 04 */
+ /*expect*/ { 0,1,6 },
+ },
+ { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* 05 */
+ /*expect*/ { 0,1,6 },
+ },
+ { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
+ /*expect*/ { 0,1,0 },
+ },
+ { /*input.*/ { { 0x008E,0x0001,0x0000 }, 2 }, /* 07 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x3041,0x008E,0x0000 }, 1 }, /* 08 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x3041,0x008E,0x0000 }, 2 }, /* 09 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x3041,0x0001,0x0000 }, 2 }, /* 10 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x3041,0x3000,0x0000 }, 2 }, /* 11 */
+ /*expect*/ { 0,1,4 },
+ },
+ { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */
+ /*expect*/ { 0,1,-1 },
+ },
+ { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */
+ /*expect*/ { 0,1,-1 },
+ },
+#if 0
+ { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */
+ /*expect*/ { 0,1,-1 },
+ },
+#ifdef NO_WAIVER
+ /* <NO_WAIVER> */ /* returns 3 */
+ { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
+ /*expect*/ { 0,1,-1 },
+ },
+#else
+ /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */
+ { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
+ /*expect*/ { 0,1,3 },
+ },
+#endif
+#else
+ /* XXX U00A0 i UTF8 is valid -> /xc2/xa0 */
+ { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */
+ /*expect*/ { 0,1,2 },
+ },
+#ifdef NO_WAIVER
+ /* <NO_WAIVER> */ /* returns 3 */
+ { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
+ /*expect*/ { 0,1,-1 },
+ },
+#else
+ /* XXX U00A1 in UTF-8 is valid -> /xc2/xa1 */
+ { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
+ /*expect*/ { 0,1,2 },
+ },
+#endif
+#endif
+ { /*input.*/ { { 0x0041,0xFF71,0x0000 }, 2 }, /* 18 */
+ /*expect*/ { 0,1,2 },
+ },
+ { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */
+ /*expect*/ { 0,1,3 },
+ },
+ { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */
+ /*expect*/ { 0,1,3 },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcswidth, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wcsxfrm.c b/test/locale-mbwc/dat_wcsxfrm.c
new file mode 100644
index 0000000..acb6727
--- /dev/null
+++ b/test/locale-mbwc/dat_wcsxfrm.c
@@ -0,0 +1,102 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_wcsxfrm.c
+ *
+ * WCSXFRM: size_t wcsxfrm (char *s1, const char s2, size_t n);
+ */
+
+/*
+ * NOTE:
+ *
+ * Return value and errno value are checked only for 2nd string:
+ * org2[]; n1 and n2 don't mean bytes to be translated.
+ * It means a buffer size including a null character.
+ * Results of this test depens on results of wcscoll().
+ * If you got errors, check both test results.
+ */
+
+
+TST_WCSXFRM tst_wcsxfrm_loc [] = {
+
+ {
+ { Twcsxfrm, TST_LOC_de },
+ {
+ { /*inp*/ { { 0x00C1,0x0000 }, { 0x00C1,0x0000 }, 7, 7 }, /* #01 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x00E4,0x0000 }, { 0x00DC,0x0000 }, 7, 7 }, /* #04 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x00DC,0x0000 }, { 0x00E4,0x0000 }, 7, 7 }, /* #05 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsxfrm, TST_LOC_enUS },
+ {
+ { /*inp*/ { { 0x0041,0x0000 }, { 0x0041,0x0000 }, 7, 7 }, /* #01 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x0000,0x0000 }, { 0x0000,0x0000 }, 7, 7 }, /* #04 */
+ /*exp*/ { 0, 0,0, },
+ },
+#ifdef NO_WAIVER
+ { /* <WAIVER> x 2 */
+ /*inp*/ { { 0x3061,0x0000 }, { 0xFF42,0x0000 }, 7, 7 }, /* #05 */
+ /* <WAIVER> */
+ /*exp*/ { EINVAL, 1,(size_t)-1, },
+ },
+#endif
+ { .is_last = 1 }
+ }
+ },
+ {
+#if 0
+ { Twcsxfrm, TST_LOC_eucJP }, /* need more test data ! */
+#else
+ { Twcsxfrm, TST_LOC_ja_UTF8 }, /* need more test data ! */
+#endif
+ {
+ { /*inp*/ { { 0x3041,0x0000 }, { 0x3041,0x0000 }, 7, 7 }, /* #01 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0x30A2,0x0000 }, { 0xFF71,0x0000 }, 7, 7 }, /* #04 */
+ /*exp*/ { 0, 0,0, },
+ },
+ { /*inp*/ { { 0xFF71,0x0000 }, { 0x30A2,0x0000 }, 7, 7 }, /* #05 */
+ /*exp*/ { 0, 0,0, },
+ },
+#ifdef NO_WAIVER
+ /* <WAIVER> x 2 */
+ { /*inp*/ { { 0x008E,0x0000 }, { 0x008F,0x0000 }, 7, 7 }, /* #06 */
+ /*exp*/ { EINVAL, 1,(size_t)-1, },
+ },
+#endif
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcsxfrm, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wctob.c b/test/locale-mbwc/dat_wctob.c
new file mode 100644
index 0000000..dfd344e
--- /dev/null
+++ b/test/locale-mbwc/dat_wctob.c
@@ -0,0 +1,61 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wctob.c
+ *
+ * ISW*: int wctob( wint_t wc );
+ */
+
+
+TST_WCTOB tst_wctob_loc [] = {
+
+ { { Twctob, TST_LOC_de },
+ {
+ { { WEOF }, { 0, 1, EOF } },
+ { { 0x0020 }, { 0, 1, 0x20 } },
+ { { 0x0061 }, { 0, 1, 0x61 } },
+ { { 0x0080 }, { 0, 1, 0x80 } },
+ { { 0x00C4 }, { 0, 1, 0xC4 } },
+ { { 0x30C4 }, { 0, 1, EOF } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { { Twctob, TST_LOC_enUS },
+ {
+ { { WEOF }, { 0, 1, EOF } },
+ { { 0x0020 }, { 0, 1, 0x20 } },
+ { { 0x0061 }, { 0, 1, 0x61 } },
+#ifdef SHOJI_IS_RIGHT
+ { { 0x0080 }, { 0, 1, 0x80 } },
+ { { 0x00C4 }, { 0, 1, 0xC4 } },
+#else
+ /* XXX These are no valid characters. */
+ { { 0x0080 }, { 0, 1, EOF } },
+ { { 0x00C4 }, { 0, 1, EOF } },
+#endif
+ { { 0x30C4 }, { 0, 1, EOF } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+#if 0
+ { { Twctob, TST_LOC_eucJP },
+#else
+ { { Twctob, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { { WEOF }, { 0, 1, EOF } },
+ { { 0x0020 }, { 0, 1, 0x20 } },
+ { { 0x0061 }, { 0, 1, 0x61 } },
+#if 0
+ { { 0x0080 }, { 0, 1, 0x80 } },
+#else
+ { { 0x0080 }, { 0, 1, EOF } },
+#endif
+ { { 0x00FF }, { 0, 1, EOF } },
+ { { 0x00C4 }, { 0, 1, EOF } },
+ { { 0x30C4 }, { 0, 1, EOF } },
+ { .is_last = 1 } /* Last element. */
+ }
+ },
+ { { Twctob, TST_LOC_end } }
+};
diff --git a/test/locale-mbwc/dat_wctomb.c b/test/locale-mbwc/dat_wctomb.c
new file mode 100644
index 0000000..0ec3a9c
--- /dev/null
+++ b/test/locale-mbwc/dat_wctomb.c
@@ -0,0 +1,168 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wctomb.c
+ *
+ * WCTOMB: int wctomb (char *s, wchar_t wc)
+ */
+
+
+/*
+ * FUNCTION:
+ *
+ * int wctomb (char *s, wchar_t wc);
+ *
+ * return: the number of bytes
+ *
+ * NOTE:
+ *
+ * o When you feed a null pointer for a string (s) to the function,
+ * set s_flg=0 instead of putting just a 'NULL' there.
+ * Even if you put a 'NULL', it means a null string as well as "".
+ *
+ * o When s is a null pointer, the function checks state dependency.
+ *
+ * state-dependent encoding - return NON-zero
+ * state-independent encoding - return 0
+ *
+ * If state-dependent encoding is expected, set
+ *
+ * s_flg = 0, ret_flg = 0, ret_val = +1
+ *
+ * If state-independent encoding is expected, set
+ *
+ * s_flg = 0, ret_flg = 0, ret_val = 0
+ *
+ *
+ * When you set ret_flg=1, the test program simply compares an
+ * actual return value with an expected value. You can check
+ * state-independent case (return value is 0) in that way, but
+ * you can not check state-dependent case. So when you check
+ * state- dependency in this test function: tst_wctomb(), set
+ * ret_flg=0 always. It's a special case, and the test
+ * function takes care of it.
+ *
+ * Input Expect
+ *
+ * s_flg=0 ret_flg=0
+ * | |
+ * { 0, 0 }, { 0, 0, 0, x, "" }
+ * | |
+ * not used ret_val: 0/+1
+ * (expected val)
+ */
+
+
+TST_WCTOMB tst_wctomb_loc [] = {
+ {
+ { Twctomb, TST_LOC_de },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x00C4 },
+ /*expect*/ { 0,1,1, "Ä" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x00DC },
+ /*expect*/ { 0,1,1, "Ü" },
+ },
+ /* #03 : normal case */
+ { /*input.*/ { 1, 0x0092 },
+ /*expect*/ { 0,1,1, "\222" },
+ },
+ /* #04 : error case */
+ { /*input.*/ { 1, 0x3041 },
+ /*expect*/ { 0,1,-1, "" },
+ },
+ /* #05 : state dependency */
+ { /*input.*/ { 0, 0x0000 },
+ /*expect*/ { 0,0,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twctomb, TST_LOC_enUS },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x0041 },
+ /*expect*/ { 0,1,1, "A" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x0042 },
+ /*expect*/ { 0,1,1, "B" },
+ },
+ /* #03 : error case */
+ /* <WAIVER> */
+ { /*input.*/ { 1, 0x00C4 },
+ /*expect*/ { 0,1,-1, "" },
+ },
+ /* #04 : error case */
+ { /*input.*/ { 1, 0x30A4 },
+ /*expect*/ { 0,1,-1, "" },
+ },
+ /* #05 : state dependency */
+ { /*input.*/ { 0, 0x0000 },
+ /*expect*/ { 0,0,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Twctomb, TST_LOC_eucJP },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x3042 },
+ /*expect*/ { 0,1,2, "\244\242" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x3044 },
+ /*expect*/ { 0,1,2, "\244\244" },
+ },
+ /* #03 : normal case */
+ { /*input.*/ { 1, 0x008E },
+ /*expect*/ { 0,1,-1, "" },
+ },
+ /* #04 : jisX0212 */
+ { /*input.*/ { 1, 0x00C4 },
+ /*expect*/ { 0,1,3, "\217\252\243" }, /* jisx0210 returns 3 */
+ },
+ /* #05 : state dependency */
+ { /*input.*/ { 0, 0x008E },
+ /*expect*/ { 0,0,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Twctomb, TST_LOC_ja_UTF8 },
+ {
+ /* #01 : normal case */
+ { /*input.*/ { 1, 0x3042 },
+ /*expect*/ { 0,1,3, "\343\201\202" },
+ },
+ /* #02 : normal case */
+ { /*input.*/ { 1, 0x3044 },
+ /*expect*/ { 0,1,3, "\343\201\204" },
+ },
+ /* #03 : normal case */
+ { /*input.*/ { 1, 0x008E },
+ /*expect*/ { 0,1,2, "\302\216" },
+ },
+ /* #04 : jisX0212 */
+ { /*input.*/ { 1, 0x00C4 },
+ /*expect*/ { 0,1,2, "\303\204" }, /* jisx0210 returns 3 */
+ },
+ /* #05 : state dependency */
+ { /*input.*/ { 0, 0x008E },
+ /*expect*/ { 0,0,0, "" },
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Twctomb, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/dat_wctrans.c b/test/locale-mbwc/dat_wctrans.c
new file mode 100644
index 0000000..df4d3ad
--- /dev/null
+++ b/test/locale-mbwc/dat_wctrans.c
@@ -0,0 +1,99 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_wctrans.c
+ *
+ * WCTRANS: wctrans_t wctrans( const char *charclass );
+ */
+
+/*
+ * NOTE:
+ * When a return value is expected to be 0 (false),
+ * set ret_flg=1 and set ret_val=0.
+ * Otherwise just set ret_flg=0.
+ */
+
+
+TST_WCTRANS tst_wctrans_loc [] = {
+
+ { { Twctrans, TST_LOC_de },
+ {
+ { /*inp*/ { "" }, /* #1 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "upper" }, /* #2 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "lower" }, /* #3 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "toupper" }, /* #4 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "tolower" }, /* #5 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "xxxxx" }, /* #6 */
+ /*exp*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twctrans, TST_LOC_enUS },
+ {
+ { /*inp*/ { "" }, /* #1 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "upper" }, /* #2 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "lower" }, /* #3 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "toupper" }, /* #4 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "tolower" }, /* #5 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "xxxxx" }, /* #6 */
+ /*exp*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ { { Twctrans, TST_LOC_eucJP },
+#else
+ { { Twctrans, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*inp*/ { "" }, /* #1 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "upper" }, /* #2 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "lower" }, /* #3 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "toupper" }, /* #4 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "tolower" }, /* #5 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "xxxxx" }, /* #6 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "tojhira" }, /* #7 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "tojkata" }, /* #8 */
+ /*exp*/ { 0,0,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twctrans, TST_LOC_end }}
+};
diff --git a/test/locale-mbwc/dat_wctype.c b/test/locale-mbwc/dat_wctype.c
new file mode 100644
index 0000000..db3bf33
--- /dev/null
+++ b/test/locale-mbwc/dat_wctype.c
@@ -0,0 +1,189 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ * FILE: dat_wctype.c
+ *
+ * WCTYPE: wctype_t wctype( const char *class );
+ */
+
+/*
+ * NOTE:
+ * When a return value is expected to be 0 (false),
+ * set ret_flg=1 and set ret_val=0.
+ * Otherwise just set ret_flg=0.
+ */
+
+
+TST_WCTYPE tst_wctype_loc [] = {
+
+ { { Twctype, TST_LOC_de },
+ {
+ { /*inp*/ { "alnum" }, /* #01 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "alpha" }, /* #02 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "cntrl" }, /* #03 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "digit" }, /* #04 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "graph" }, /* #05 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "lower" }, /* #06 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "print" }, /* #07 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "punct" }, /* #08 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "space" }, /* #09 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "upper" }, /* #10 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "xdigit" }, /* #11 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "" }, /* #12 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "ideograph" }, /* #13 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "english" }, /* #14 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "ascii" }, /* #15 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "special" }, /* #16 */
+ /*exp*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twctype, TST_LOC_enUS },
+ {
+ { /*inp*/ { "alnum" }, /* #01 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "alpha" }, /* #02 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "cntrl" }, /* #03 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "digit" }, /* #04 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "graph" }, /* #05 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "lower" }, /* #06 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "print" }, /* #07 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "punct" }, /* #08 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "space" }, /* #09 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "upper" }, /* #10 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "xdigit" }, /* #11 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "" }, /* #12 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "ideograph" }, /* #13 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "english" }, /* #14 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "ascii" }, /* #15 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "special" }, /* #16 */
+ /*exp*/ { 0,1,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ { { Twctype, TST_LOC_eucJP },
+#else
+ { { Twctype, TST_LOC_ja_UTF8 },
+#endif
+ {
+ { /*inp*/ { "alnum" }, /* #01 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "alpha" }, /* #02 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "cntrl" }, /* #03 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "digit" }, /* #04 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "graph" }, /* #05 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "lower" }, /* #06 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "print" }, /* #07 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "punct" }, /* #08 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "space" }, /* #09 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "upper" }, /* #10 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "xdigit" }, /* #11 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "ideogram" }, /* #12 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "phonogram" }, /* #13 */
+ /*exp*/ { 0,1,0, },
+ },
+ { /*inp*/ { "jspace" }, /* #14 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "jhira" }, /* #15 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "jkata" }, /* #16 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "jkanji" }, /* #17 */
+ /*exp*/ { 0,0,0, },
+ },
+ { /*inp*/ { "jdigit" }, /* #18 */
+ /*exp*/ { 0,0,0, },
+ },
+ { .is_last = 1 }
+ }
+ },
+ { { Twctype, TST_LOC_end }}
+};
diff --git a/test/locale-mbwc/dat_wcwidth.c b/test/locale-mbwc/dat_wcwidth.c
new file mode 100644
index 0000000..b6b7c29
--- /dev/null
+++ b/test/locale-mbwc/dat_wcwidth.c
@@ -0,0 +1,149 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: dat_wcwidth.c
+ *
+ * WCWIDTH: int wcwidth (wchar_t wc);
+ */
+
+TST_WCWIDTH tst_wcwidth_loc [] = {
+ {
+ { Twcwidth, TST_LOC_de },
+ {
+ { /*inp*/ { 0x0000 }, /* #01 */
+ /*exp*/ { 0, 1,0, },
+ },
+ { /*inp*/ { 0x0020 }, /* #02 */
+ /*exp*/ { 0, 1,1, },
+ },
+ { /*inp*/ { 0x007F }, /* #03 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x0080 }, /* #04 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x00A1 }, /* #05 */
+ /*exp*/ { 0, 1,1, },
+ },
+ { /*inp*/ { 0x00C1 }, /* #06 */
+ /*exp*/ { 0, 1,1, },
+ },
+#ifdef SHOJI_IS_RIGHT
+ /* <WAIVER> */ /* CHECK : wint_t */
+ { /*inp*/ { 0x3041 }, /* #07 */
+ /*exp*/ { 0, 1,0, },
+ },
+#else
+ { /*inp*/ { 0x3041 }, /* #07 */
+ /*exp*/ { 0, 1,EOF, },
+ },
+#endif
+ { .is_last = 1 }
+ }
+ },
+ {
+ { Twcwidth, TST_LOC_enUS },
+ {
+ { /*inp*/ { 0x0000 }, /* #01 */
+ /*exp*/ { 0, 1,0, },
+ },
+ { /*inp*/ { 0x0020 }, /* #02 */
+ /*exp*/ { 0, 1,1, },
+ },
+ { /*inp*/ { 0x007F }, /* #03 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x0080 }, /* #04 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x00A1 }, /* #05 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x00C1 }, /* #06 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x3041 }, /* #07 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { .is_last = 1 }
+ }
+ },
+#if 0
+ {
+ { Twcwidth, TST_LOC_eucJP },
+ {
+ { /*inp*/ { 0x0000 }, /* #01 */
+ /*exp*/ { 0, 1,0, },
+ },
+ { /*inp*/ { 0x0020 }, /* #02 */
+ /*exp*/ { 0, 1,1, },
+ },
+ { /*inp*/ { 0x007F }, /* #03 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x0080 }, /* #04 */
+ /*exp*/ { 0, 1,-1, },
+ },
+#ifdef SHOJI_IS_RIGHT
+ /* <NO_WAIVER> */
+ { /*inp*/ { 0x00A1 }, /* #05 */
+ /*exp*/ { 0, 1,0, },
+ },
+#else
+ /* XXX U00A1 is a valid character in EUC-JP. */
+ { /*inp*/ { 0x00A1 }, /* #05 */
+ /*exp*/ { 0, 1,2, },
+ },
+#endif
+ /* jisx0212 */
+ { /*inp*/ { 0x00C1 }, /* #06 */
+ /*exp*/ { 0, 1,2, },
+ },
+ { /*inp*/ { 0x3041 }, /* #07 */
+ /*exp*/ { 0, 1,2, },
+ },
+ { .is_last = 1 }
+ }
+ },
+#else
+ {
+ { Twcwidth, TST_LOC_ja_UTF8 },
+ {
+ { /*inp*/ { 0x0000 }, /* #01 */
+ /*exp*/ { 0, 1,0, },
+ },
+ { /*inp*/ { 0x0020 }, /* #02 */
+ /*exp*/ { 0, 1,1, },
+ },
+ { /*inp*/ { 0x007F }, /* #03 */
+ /*exp*/ { 0, 1,-1, },
+ },
+ { /*inp*/ { 0x0080 }, /* #04 */
+ /*exp*/ { 0, 1,-1, },
+ },
+#ifdef SHOJI_IS_RIGHT
+ /* <NO_WAIVER> */
+ { /*inp*/ { 0x00A1 }, /* #05 */
+ /*exp*/ { 0, 1,0, },
+ },
+#else
+ /* XXX U00A1 is a valid character in EUC-JP.UTF-8. */
+ { /*inp*/ { 0x00A1 }, /* #05 */
+ /*exp*/ { 0, 1,1, },
+ },
+#endif
+ /* jisx0212 */
+ { /*inp*/ { 0x00C1 }, /* #06 */
+ /*exp*/ { 0, 1,1, },
+ },
+ { /*inp*/ { 0x3041 }, /* #07 */
+ /*exp*/ { 0, 1,2, },
+ },
+ { .is_last = 1 }
+ }
+ },
+#endif
+ {
+ { Twcwidth, TST_LOC_end }
+ }
+};
diff --git a/test/locale-mbwc/tgn_funcdef.h b/test/locale-mbwc/tgn_funcdef.h
new file mode 100644
index 0000000..ec24792
--- /dev/null
+++ b/test/locale-mbwc/tgn_funcdef.h
@@ -0,0 +1,160 @@
+#ifndef TGN_FUNCDEF_H
+#define TGN_FUNCDEF_H
+
+/* Unique number for each test. */
+#define Tiswalnum 1
+#define Tiswalpha 2
+#define Tiswcntrl 3
+#define Tiswctype 4
+#define Tiswdigit 5
+#define Tiswgraph 6
+#define Tiswlower 7
+#define Tiswprint 8
+#define Tiswpunct 9
+#define Tiswspace 10
+#define Tiswupper 11
+#define Tiswxdigit 12
+#define Tmblen 13
+#define Tmbrlen 14
+#define Tmbrtowc 15
+#define Tmbsrtowcs 16
+#define Tmbstowcs 17
+#define Tmbtowc 18
+#define Tstrcoll 19
+#define Tstrfmon 20
+#define Tstrxfrm 21
+#define Tswscanf 22
+#define Ttowctrans 23
+#define Ttowlower 24
+#define Ttowupper 25
+#define Twcrtomb 26
+#define Twcscat 27
+#define Twcschr 28
+#define Twcscmp 29
+#define Twcscoll 30
+#define Twcscpy 31
+#define Twcscspn 32
+#define Twcslen 33
+#define Twcsncat 34
+#define Twcsncmp 35
+#define Twcsncpy 36
+#define Twcspbrk 37
+#define Twcsrtombs 38
+#define Twcsspn 39
+#define Twcsstr 40
+#define Twcstod 41
+#define Twcstok 42
+#define Twcstombs 43
+#define Twcswidth 44
+#define Twcsxfrm 45
+#define Twctob 46
+#define Twctomb 47
+#define Twctrans 48
+#define Twctype 49
+#define Twcwidth 50
+
+/* Name of each test. */
+#define S_ISWALNUM "iswalnum"
+#define S_ISWALPHA "iswalpha"
+#define S_ISWCNTRL "iswcntrl"
+#define S_ISWCTYPE "iswctype"
+#define S_ISWDIGIT "iswdigit"
+#define S_ISWGRAPH "iswgraph"
+#define S_ISWLOWER "iswlower"
+#define S_ISWPRINT "iswprint"
+#define S_ISWPUNCT "iswpunct"
+#define S_ISWSPACE "iswspace"
+#define S_ISWUPPER "iswupper"
+#define S_ISWXDIGIT "iswxdigit"
+#define S_MBLEN "mblen"
+#define S_MBRLEN "mbrlen"
+#define S_MBRTOWC "mbrtowc"
+#define S_MBSRTOWCS "mbsrtowcs"
+#define S_MBSTOWCS "mbstowcs"
+#define S_MBTOWC "mbtowc"
+#define S_STRCOLL "strcoll"
+#define S_STRFMON "strfmon"
+#define S_STRXFRM "strxfrm"
+#define S_SWSCANF "swscanf"
+#define S_TOWCTRANS "towctrans"
+#define S_TOWLOWER "towlower"
+#define S_TOWUPPER "towupper"
+#define S_WCRTOMB "wcrtomb"
+#define S_WCSCAT "wcscat"
+#define S_WCSCHR "wcschr"
+#define S_WCSCMP "wcscmp"
+#define S_WCSCOLL "wcscoll"
+#define S_WCSCPY "wcscpy"
+#define S_WCSCSPN "wcscspn"
+#define S_WCSLEN "wcslen"
+#define S_WCSNCAT "wcsncat"
+#define S_WCSNCMP "wcsncmp"
+#define S_WCSNCPY "wcsncpy"
+#define S_WCSPBRK "wcspbrk"
+#define S_WCSRTOMBS "wcsrtombs"
+#define S_WCSSPN "wcsspn"
+#define S_WCSSTR "wcsstr"
+#define S_WCSTOD "wcstod"
+#define S_WCSTOK "wcstok"
+#define S_WCSTOMBS "wcstombs"
+#define S_WCSWIDTH "wcswidth"
+#define S_WCSXFRM "wcsxfrm"
+#define S_WCTOB "wctob"
+#define S_WCTOMB "wctomb"
+#define S_WCTRANS "wctrans"
+#define S_WCTYPE "wctype"
+#define S_WCWIDTH "wcwidth"
+
+/* Prototypes for test functions. */
+extern int tst_iswalnum (FILE *, int);
+extern int tst_iswalpha (FILE *, int);
+extern int tst_iswcntrl (FILE *, int);
+extern int tst_iswctype (FILE *, int);
+extern int tst_iswdigit (FILE *, int);
+extern int tst_iswgraph (FILE *, int);
+extern int tst_iswlower (FILE *, int);
+extern int tst_iswprint (FILE *, int);
+extern int tst_iswpunct (FILE *, int);
+extern int tst_iswspace (FILE *, int);
+extern int tst_iswupper (FILE *, int);
+extern int tst_iswxdigit (FILE *, int);
+extern int tst_mblen (FILE *, int);
+extern int tst_mbrlen (FILE *, int);
+extern int tst_mbrtowc (FILE *, int);
+extern int tst_mbsrtowcs (FILE *, int);
+extern int tst_mbstowcs (FILE *, int);
+extern int tst_mbtowc (FILE *, int);
+extern int tst_strcoll (FILE *, int);
+extern int tst_strfmon (FILE *, int);
+extern int tst_strxfrm (FILE *, int);
+extern int tst_swscanf (FILE *, int);
+extern int tst_towctrans (FILE *, int);
+extern int tst_towlower (FILE *, int);
+extern int tst_towupper (FILE *, int);
+extern int tst_wcrtomb (FILE *, int);
+extern int tst_wcscat (FILE *, int);
+extern int tst_wcschr (FILE *, int);
+extern int tst_wcscmp (FILE *, int);
+extern int tst_wcscoll (FILE *, int);
+extern int tst_wcscpy (FILE *, int);
+extern int tst_wcscspn (FILE *, int);
+extern int tst_wcslen (FILE *, int);
+extern int tst_wcsncat (FILE *, int);
+extern int tst_wcsncmp (FILE *, int);
+extern int tst_wcsncpy (FILE *, int);
+extern int tst_wcspbrk (FILE *, int);
+extern int tst_wcsrtombs (FILE *, int);
+extern int tst_wcsspn (FILE *, int);
+extern int tst_wcsstr (FILE *, int);
+extern int tst_wcstod (FILE *, int);
+extern int tst_wcstok (FILE *, int);
+extern int tst_wcstombs (FILE *, int);
+extern int tst_wcswidth (FILE *, int);
+extern int tst_wcsxfrm (FILE *, int);
+extern int tst_wctob (FILE *, int);
+extern int tst_wctomb (FILE *, int);
+extern int tst_wctrans (FILE *, int);
+extern int tst_wctype (FILE *, int);
+extern int tst_wcwidth (FILE *, int);
+
+#endif /* TGN_FUNCDEF_H */
diff --git a/test/locale-mbwc/tgn_locdef.h b/test/locale-mbwc/tgn_locdef.h
new file mode 100644
index 0000000..89146a7
--- /dev/null
+++ b/test/locale-mbwc/tgn_locdef.h
@@ -0,0 +1,32 @@
+#ifndef TGN_LOCDEF_H
+#define TGN_LOCDEF_H
+
+/* Defines for all locales used in the suite. */
+
+/* POSIX C locale. */
+#define TST_LOC_C "C"
+
+/* German locale with ISO-8859-1. */
+#define TST_LOC_de "de_DE.ISO-8859-1"
+
+/* For US we use ANSI_X3.4-1968 (ASCII). Changed in en_US.ISO-8859-1 */
+#define TST_LOC_en "en_US.ISO-8859-1"
+#define TST_LOC_enUS TST_LOC_C
+
+/* NOTE: ja_JP.EUC-JP locale isn't supported into the uClibc!
+ UTF-8 is the only multibyte codeset supported. */
+/* Japanese locale with EUC-JP. */
+#if 0
+#define TST_LOC_eucJP "ja_JP.EUC-JP"
+#endif
+
+/* Japanese locale with UTF-8. */
+#define TST_LOC_ja_UTF8 "ja_JP.UTF-8"
+
+/* German locale with UTF-8. */
+#define TST_LOC_de_UTF8 "de_DE.UTF-8"
+
+/* End marker - must appear in each table as last entry. */
+#define TST_LOC_end "lastEntry"
+
+#endif /* TGN_LOCDEF_H */
diff --git a/test/locale-mbwc/tsp_common.c b/test/locale-mbwc/tsp_common.c
new file mode 100644
index 0000000..cd88274
--- /dev/null
+++ b/test/locale-mbwc/tsp_common.c
@@ -0,0 +1,64 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ * Main driver
+ */
+
+
+#define TST_FUNCTION_CALL(func) _TST_FUNCTION_CALL(func)
+#define _TST_FUNCTION_CALL(func) tst ##_## func
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <errno.h>
+#include <signal.h>
+
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+
+int
+main (int argc, char *argv[])
+{
+ int ret;
+ int debug;
+
+ debug = argc > 1 ? atoi (argv[1]) : 0;
+
+ if (debug)
+ {
+ fprintf (stdout, "\nTST_MBWC ===> %s ...\n", argv[0]);
+ }
+ ret = TST_FUNCTION_CALL (TST_FUNCTION) (stdout, debug);
+
+ return (ret != 0);
+}
+
+#define MAX_RESULT_REC 132
+char result_rec[MAX_RESULT_REC];
+
+
+int
+result (FILE * fp, char res, const char *func, const char *loc, int rec_no,
+ int seq_no, int case_no, const char *msg)
+{
+ if (fp == NULL
+ || strlen (func) + strlen (loc) + strlen (msg) + 32 > MAX_RESULT_REC)
+ {
+ fprintf (stderr,
+ "Warning: result(): can't write the result: %s:%s:%d:%d:%s\n",
+ func, loc, rec_no, case_no, msg);
+ return 0;
+ }
+
+ sprintf (result_rec, "%s:%s:%d:%d:%d:%c:%s\n", func, loc, rec_no, seq_no,
+ case_no, res, msg);
+
+ if (fputs (result_rec, fp) == EOF)
+ {
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/test/locale-mbwc/tst2_mbrtowc.c b/test/locale-mbwc/tst2_mbrtowc.c
new file mode 100644
index 0000000..92e1283
--- /dev/null
+++ b/test/locale-mbwc/tst2_mbrtowc.c
@@ -0,0 +1,21 @@
+#include <wchar.h>
+#include <assert.h>
+#include <stdlib.h>
+
+/* bugs.uclibc.org/1471 : make sure output is 0 */
+static int
+do_test(void)
+{
+ wchar_t output;
+ int result;
+
+ output = L'A'; /* anything other than 0 will do... */
+ result = mbrtowc (&output, "", 1, 0);
+
+ assert (result == 0);
+ assert (output == 0);
+
+ return EXIT_SUCCESS;
+}
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/locale-mbwc/tst_funcs.h b/test/locale-mbwc/tst_funcs.h
new file mode 100644
index 0000000..02d5d34
--- /dev/null
+++ b/test/locale-mbwc/tst_funcs.h
@@ -0,0 +1,294 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: tst_funcs.h
+ *
+ * Definitions of macros
+ */
+
+
+#ifndef TST_FUNCS_H
+#define TST_FUNCS_H
+
+#define C_SUCCESS 'S' /* test case test passed */
+#define C_FAILURE 'F' /* test case failed */
+#define C_IGNORED 'I' /* test case/result ignored (not tested) */
+#define C_INVALID 'D' /* test data may be wrong */
+#define C_LOCALES 'L' /* can't set locale (skip) */
+
+
+extern int result (FILE * fp, char res, const char *func, const char *loc,
+ int rec_no, int seq_num, int case_no, const char *msg);
+
+#define Result(C, S, E, M) \
+ result (fp, (C), (S), locale, rec+1, seq_num+1, (E), (M))
+
+#define CASE_0 0
+#define CASE_1 1
+#define CASE_2 2
+#define CASE_3 3
+#define CASE_4 4
+#define CASE_5 5
+#define CASE_6 6
+#define CASE_7 7
+#define CASE_8 8
+#define CASE_9 9
+
+#define MS_PASSED "PASSED"
+#define MS_SPACE " "
+#define MS_FAILED " "
+#define MS_NOTEST "NOTEST"
+#define MS_ABORTU "ABEND0"
+#define MS_ABORT "ABEND1"
+
+#define MK_PASSED 0x00
+#define MK_SPACE 0x01
+#define MK_NOTEST 0x02
+#define MK_ABORTU 0x04
+#define MK_ABORT 0x08
+
+
+
+/* ------------------ COMMON MACROS ------------------ */
+
+#define TST_ABS(x) (((x) > 0) ? (x) : -(x))
+
+#define TMD_ERRET(_type_) int err_val; \
+ int ret_flg; \
+ _type_ ret_val
+
+#define TMD_RECHEAD(_FUNC_) \
+ \
+ typedef struct { \
+ TIN_##_FUNC_##_REC input; \
+ TEX_##_FUNC_##_REC expect; \
+ int is_last; \
+ } TST_##_FUNC_##_REC; \
+ typedef struct { \
+ TST_HEAD hd; \
+ TST_##_FUNC_##_REC rec[ MAX_LOC_TEST ]; \
+ } TST_##_FUNC_
+
+#define TST_FTYP(func) tst_##func##_loc
+#define TST_HEAD(func) tst_##func##_loc[ loc ].hd
+#define TST_INPUT(func) tst_##func##_loc[ loc ].rec[ rec ].input
+#define TST_EXPECT(func) tst_##func##_loc[ loc ].rec[ rec ].expect
+#define TST_INPUT_SEQ(func) \
+ tst_##func##_loc[ loc ].rec[ rec ].input.seq[ seq_num ]
+#define TST_EXPECT_SEQ(func) \
+ tst_##func##_loc[ loc ].rec[ rec ].expect.seq[ seq_num ]
+#define TST_IS_LAST(func) \
+ tst_##func##_loc[ loc ].rec[ rec ].is_last
+
+
+#define TST_DECL_VARS(_type_) \
+ int loc, rec, err_count = 0; \
+ int warn_count __attribute__ ((unused)); \
+ int seq_num = 0; \
+ const char *locale; \
+ int err_exp, ret_flg; \
+ int errno_save = 0; \
+ _type_ ret_exp; \
+ _type_ ret
+
+#define TST_DO_TEST(o_func) \
+ for (loc = 0; strcmp (TST_HEAD (o_func).locale, TST_LOC_end); ++loc)
+
+
+#ifdef __UCLIBC_HAS_LOCALE__
+#define TST_HEAD_LOCALE(ofunc, s_func) \
+ locale = TST_HEAD (ofunc).locale; \
+ if (setlocale (LC_ALL, locale) == NULL) \
+ { \
+ fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n", \
+ locale); \
+ result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale"); \
+ ++err_count; \
+ continue; \
+ }
+#else
+#define TST_HEAD_LOCALE(ofunc, s_func) \
+ locale = TST_HEAD (ofunc).locale; \
+ if (strcmp(locale, "C") == 0) \
+ { \
+ if (setlocale (LC_ALL, locale) == NULL) \
+ { \
+ fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n", \
+ locale); \
+ result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale"); \
+ ++err_count; \
+ continue; \
+ } \
+ } \
+ else \
+ { \
+ fprintf (stderr, "Warning : locale %s unsupported\n\n", \
+ locale); \
+ result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "unsupported"); \
+ continue; \
+ }
+#endif
+
+#define TST_DO_REC(ofunc) \
+ for (rec=0; !TST_IS_LAST (ofunc); ++rec)
+
+#define TST_DO_SEQ(_count_) \
+ for (seq_num=0; seq_num < _count_; seq_num++)
+
+#define TST_GET_ERRET(_ofunc_) \
+ err_exp = TST_EXPECT (_ofunc_).err_val; \
+ ret_flg = TST_EXPECT (_ofunc_).ret_flg; \
+ ret_exp = TST_EXPECT (_ofunc_).ret_val
+
+#define TST_GET_ERRET_SEQ(_ofunc_) \
+ err_exp = TST_EXPECT_SEQ (_ofunc_).err_val; \
+ ret_flg = TST_EXPECT_SEQ (_ofunc_).ret_flg; \
+ ret_exp = TST_EXPECT_SEQ (_ofunc_).ret_val
+
+#define TST_CLEAR_ERRNO \
+ errno = 0
+
+#define TST_SAVE_ERRNO \
+ errno_save = errno
+
+/* Test value of ret and of errno if it should have a value. */
+#define TST_IF_RETURN(_s_func_) \
+ if (err_exp != 0) \
+ { \
+ if (errno_save == err_exp) \
+ { \
+ result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 1, \
+ MS_PASSED); \
+ } \
+ else \
+ { \
+ err_count++; \
+ result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 1, \
+ "the value of errno is different from an expected value"); \
+ } \
+ } \
+ \
+ if (ret_flg == 1) \
+ { \
+ if (ret == ret_exp) \
+ { \
+ result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 2, \
+ MS_PASSED); \
+ } \
+ else \
+ { \
+ err_count++; \
+ result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 2, \
+ "the return value is different from an expected value"); \
+ } \
+ } \
+ else
+
+#define TEX_ERRET_REC(_type_) \
+ struct { \
+ TMD_ERRET (_type_); \
+ }
+
+#define TEX_ERRET_REC_SEQ(_type_, _count_) \
+ struct { \
+ struct { \
+ TMD_ERRET (_type_); \
+ } seq[ _count_ ]; \
+ }
+
+
+
+/* ------------------ FUNCTION: ISW*() ------------------- */
+
+#define TST_ISW_STRUCT(_FUNC_, _func_) \
+ typedef \
+ struct { \
+ wint_t wc; \
+ } TIN_ISW##_FUNC_##_REC; \
+ typedef \
+ TEX_ERRET_REC (int) TEX_ISW##_FUNC_##_REC; \
+ TMD_RECHEAD (ISW##_FUNC_)
+
+#define TST_FUNC_ISW(_FUNC_, _func_) \
+int \
+tst_isw##_func_ (FILE *fp, int debug_flg) \
+{ \
+ TST_DECL_VARS(int); \
+ wint_t wc; \
+ TST_DO_TEST (isw##_func_) \
+ { \
+ TST_HEAD_LOCALE (isw##_func_, S_ISW##_FUNC_); \
+ TST_DO_REC(isw##_func_) \
+ { \
+ TST_GET_ERRET (isw##_func_); \
+ wc = TST_INPUT (isw##_func_).wc; \
+ ret = isw##_func_ (wc); \
+ if (debug_flg) \
+ { \
+ fprintf (stdout, "isw*() [ %s : %d ] ret = %d\n", locale, \
+ rec+1, ret); \
+ } \
+ \
+ TST_IF_RETURN (S_ISW##_FUNC_) \
+ { \
+ if (ret != 0) \
+ { \
+ result (fp, C_SUCCESS, S_ISW##_FUNC_, locale, rec+1, \
+ seq_num+1, 3, MS_PASSED); \
+ } \
+ else \
+ { \
+ err_count++; \
+ result (fp, C_FAILURE, S_ISW##_FUNC_, locale, rec+1, \
+ seq_num+1, 3, \
+ "the function returned 0, but should be non-zero"); \
+ } \
+ } \
+ } \
+ } \
+ \
+ return err_count; \
+}
+
+
+
+/* ------------------ FUNCTION: TOW*() ------------------ */
+
+#define TST_TOW_STRUCT(_FUNC_, _func_) \
+ typedef \
+ struct { \
+ wint_t wc; \
+ } TIN_TOW##_FUNC_##_REC; \
+ typedef \
+ TEX_ERRET_REC (wint_t) TEX_TOW##_FUNC_##_REC; \
+ TMD_RECHEAD (TOW##_FUNC_)
+
+#define TST_FUNC_TOW(_FUNC_, _func_) \
+int \
+tst_tow##_func_ (FILE *fp, int debug_flg) \
+{ \
+ TST_DECL_VARS (wint_t); \
+ wint_t wc; \
+ TST_DO_TEST (tow##_func_) \
+ { \
+ TST_HEAD_LOCALE (tow##_func_, S_TOW##_FUNC_); \
+ TST_DO_REC (tow##_func_) \
+ { \
+ TST_GET_ERRET (tow##_func_); \
+ wc = TST_INPUT (tow##_func_).wc; \
+ ret = tow##_func_ (wc); \
+ if (debug_flg) \
+ { \
+ fprintf (stdout, "tow*() [ %s : %d ] ret = 0x%x\n", \
+ locale, rec+1, ret); \
+ } \
+ \
+ TST_IF_RETURN (S_TOW##_FUNC_) { }; \
+ } \
+ } \
+ \
+ return err_count; \
+}
+
+
+#endif /* TST_FUNCS_H */
diff --git a/test/locale-mbwc/tst_iswalnum.c b/test/locale-mbwc/tst_iswalnum.c
new file mode 100644
index 0000000..95ba863
--- /dev/null
+++ b/test/locale-mbwc/tst_iswalnum.c
@@ -0,0 +1,10 @@
+/*
+ ISWALNUM: int iswalnum (wint_t wc)
+*/
+
+#define TST_FUNCTION iswalnum
+
+#include "tsp_common.c"
+#include "dat_iswalnum.c"
+
+TST_FUNC_ISW (ALNUM, alnum);
diff --git a/test/locale-mbwc/tst_iswalpha.c b/test/locale-mbwc/tst_iswalpha.c
new file mode 100644
index 0000000..8eff2cc
--- /dev/null
+++ b/test/locale-mbwc/tst_iswalpha.c
@@ -0,0 +1,10 @@
+/*
+ ISWALPHA: int iswalpha (wint_t wc);
+*/
+
+#define TST_FUNCTION iswalpha
+
+#include "tsp_common.c"
+#include "dat_iswalpha.c"
+
+TST_FUNC_ISW (ALPHA, alpha);
diff --git a/test/locale-mbwc/tst_iswcntrl.c b/test/locale-mbwc/tst_iswcntrl.c
new file mode 100644
index 0000000..4e1baa8
--- /dev/null
+++ b/test/locale-mbwc/tst_iswcntrl.c
@@ -0,0 +1,10 @@
+/*
+ ISWCNTRL: int iswcntrl (wint_t wc);
+*/
+
+#define TST_FUNCTION iswcntrl
+
+#include "tsp_common.c"
+#include "dat_iswcntrl.c"
+
+TST_FUNC_ISW (CNTRL, cntrl);
diff --git a/test/locale-mbwc/tst_iswctype.c b/test/locale-mbwc/tst_iswctype.c
new file mode 100644
index 0000000..3e79e09
--- /dev/null
+++ b/test/locale-mbwc/tst_iswctype.c
@@ -0,0 +1,53 @@
+/*
+ ISWCTYPE: int iswctype (wint_t wc, wctype_t desc);
+*/
+
+#define TST_FUNCTION iswctype
+
+#include "tsp_common.c"
+#include "dat_iswctype.c"
+
+
+int
+tst_iswctype (FILE *fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wint_t wc;
+ const char *ts;
+
+ TST_DO_TEST (iswctype)
+ {
+ TST_HEAD_LOCALE (iswctype, S_ISWCTYPE);
+ TST_DO_REC (iswctype)
+ {
+ TST_GET_ERRET (iswctype);
+ wc = TST_INPUT (iswctype).wc;
+ ts = TST_INPUT (iswctype).ts;
+ ret = iswctype (wc, wctype (ts));
+ TST_SAVE_ERRNO;
+ if (debug_flg)
+ {
+ fprintf (stdout, "iswctype() [ %s : %d ] ret = %d\n",
+ locale, rec+1, ret);
+ }
+
+ TST_IF_RETURN (S_ISWCTYPE)
+ {
+ if (ret != 0)
+ {
+ result (fp, C_SUCCESS, S_ISWCTYPE, locale, rec+1,
+ seq_num+1, 3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ result (fp, C_FAILURE, S_ISWCTYPE, locale, rec+1,
+ seq_num+1, 3,
+ "the function returned 0, but should be non-zero");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_iswdigit.c b/test/locale-mbwc/tst_iswdigit.c
new file mode 100644
index 0000000..5429ed0
--- /dev/null
+++ b/test/locale-mbwc/tst_iswdigit.c
@@ -0,0 +1,11 @@
+/*
+ ISWDIGIT: int iswdigit (wint_t wc);
+*/
+
+
+#define TST_FUNCTION iswdigit
+
+#include "tsp_common.c"
+#include "dat_iswdigit.c"
+
+TST_FUNC_ISW (DIGIT, digit);
diff --git a/test/locale-mbwc/tst_iswgraph.c b/test/locale-mbwc/tst_iswgraph.c
new file mode 100644
index 0000000..91a70e2
--- /dev/null
+++ b/test/locale-mbwc/tst_iswgraph.c
@@ -0,0 +1,10 @@
+/*
+ ISWGRAPH: int iswgraph (wint_t wc);
+*/
+
+#define TST_FUNCTION iswgraph
+
+#include "tsp_common.c"
+#include "dat_iswgraph.c"
+
+TST_FUNC_ISW (GRAPH, graph);
diff --git a/test/locale-mbwc/tst_iswlower.c b/test/locale-mbwc/tst_iswlower.c
new file mode 100644
index 0000000..e091100
--- /dev/null
+++ b/test/locale-mbwc/tst_iswlower.c
@@ -0,0 +1,10 @@
+/*
+ ISWLOWER: int iswlower (wint_t wc);
+*/
+
+#define TST_FUNCTION iswlower
+
+#include "tsp_common.c"
+#include "dat_iswlower.c"
+
+TST_FUNC_ISW (LOWER, lower);
diff --git a/test/locale-mbwc/tst_iswprint.c b/test/locale-mbwc/tst_iswprint.c
new file mode 100644
index 0000000..8d5bde5
--- /dev/null
+++ b/test/locale-mbwc/tst_iswprint.c
@@ -0,0 +1,10 @@
+/*
+ ISWPRINT: int iswprint (wint_t wc);
+*/
+
+#define TST_FUNCTION iswprint
+
+#include "tsp_common.c"
+#include "dat_iswprint.c"
+
+TST_FUNC_ISW (PRINT, print);
diff --git a/test/locale-mbwc/tst_iswpunct.c b/test/locale-mbwc/tst_iswpunct.c
new file mode 100644
index 0000000..4749d61
--- /dev/null
+++ b/test/locale-mbwc/tst_iswpunct.c
@@ -0,0 +1,10 @@
+/*
+ ISWPUNCT: int iswpunct (wint_t wc);
+*/
+
+#define TST_FUNCTION iswpunct
+
+#include "tsp_common.c"
+#include "dat_iswpunct.c"
+
+TST_FUNC_ISW (PUNCT, punct);
diff --git a/test/locale-mbwc/tst_iswspace.c b/test/locale-mbwc/tst_iswspace.c
new file mode 100644
index 0000000..6c26d5f
--- /dev/null
+++ b/test/locale-mbwc/tst_iswspace.c
@@ -0,0 +1,10 @@
+/*
+ ISWSPACE: int iswspace (wint_t wc);
+*/
+
+#define TST_FUNCTION iswspace
+
+#include "tsp_common.c"
+#include "dat_iswspace.c"
+
+TST_FUNC_ISW (SPACE, space);
diff --git a/test/locale-mbwc/tst_iswupper.c b/test/locale-mbwc/tst_iswupper.c
new file mode 100644
index 0000000..dfe5a5b
--- /dev/null
+++ b/test/locale-mbwc/tst_iswupper.c
@@ -0,0 +1,10 @@
+/*
+ ISWUPPER: int iswupper (wint_t wc);
+*/
+
+#define TST_FUNCTION iswupper
+
+#include "tsp_common.c"
+#include "dat_iswupper.c"
+
+TST_FUNC_ISW (UPPER, upper);
diff --git a/test/locale-mbwc/tst_iswxdigit.c b/test/locale-mbwc/tst_iswxdigit.c
new file mode 100644
index 0000000..5f9c0c5
--- /dev/null
+++ b/test/locale-mbwc/tst_iswxdigit.c
@@ -0,0 +1,10 @@
+/*
+ ISWXDIGIT: int iswxdigit (wint_t wc);
+*/
+
+#define TST_FUNCTION iswxdigit
+
+#include "tsp_common.c"
+#include "dat_iswxdigit.c"
+
+TST_FUNC_ISW (XDIGIT, xdigit);
diff --git a/test/locale-mbwc/tst_mblen.c b/test/locale-mbwc/tst_mblen.c
new file mode 100644
index 0000000..35ccf6c
--- /dev/null
+++ b/test/locale-mbwc/tst_mblen.c
@@ -0,0 +1,85 @@
+/*
+ MBLEN: int mblen (char *s, size_t n)
+*/
+
+#define TST_FUNCTION mblen
+
+#include "tsp_common.c"
+#include "dat_mblen.c"
+
+int
+tst_mblen (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ char s_flg;
+ const char *s_in;
+ size_t n;
+
+ TST_DO_TEST (mblen)
+ {
+ TST_HEAD_LOCALE (mblen, S_MBLEN);
+ TST_DO_REC (mblen)
+ {
+ TST_GET_ERRET (mblen);
+ s_flg = TST_INPUT (mblen).s_flg;
+ s_in = TST_INPUT (mblen).s;
+ n = TST_INPUT (mblen).n;
+
+ if (s_flg == 0)
+ {
+ s_in = NULL;
+ }
+
+ if (n == USE_MBCURMAX)
+ {
+ n = MB_CUR_MAX;
+ }
+
+ TST_CLEAR_ERRNO;
+ ret = mblen (s_in, n);
+ TST_SAVE_ERRNO;
+
+ TST_IF_RETURN (S_MBLEN)
+ {
+ if (s_in == NULL)
+ { /* state dependency */
+ if (ret_exp == +1)
+ { /* state-dependent */
+ if (ret != 0)
+ {
+ /* non-zero: state-dependent encoding */
+ Result (C_SUCCESS, S_MBLEN, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBLEN, CASE_3,
+ "should be state-dependent encoding, "
+ "but the return value shows it is"
+ " state-independent");
+ }
+ }
+
+ if (ret_exp == 0)
+ { /* state-independent */
+ if (ret == 0)
+ {
+ /* non-zero: state-dependent encoding */
+ Result (C_SUCCESS, S_MBLEN, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBLEN, CASE_3,
+ "should be state-independent encoding, "
+ "but the return value shows it is"
+ " state-dependent");
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_mbrlen.c b/test/locale-mbwc/tst_mbrlen.c
new file mode 100644
index 0000000..b8681b7
--- /dev/null
+++ b/test/locale-mbwc/tst_mbrlen.c
@@ -0,0 +1,82 @@
+/*
+ MBRLEN: size_t mbrlen (char *s, size_t n, mbstate_t *ps)
+*/
+
+#define TST_FUNCTION mbrlen
+
+#include "tsp_common.c"
+#include "dat_mbrlen.c"
+
+
+int
+tst_mbrlen (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ char s_flg;
+ const char *s_in;
+ size_t n;
+ char t_flg;
+ char t_ini;
+ static mbstate_t s = { 0 };
+ mbstate_t *ps;
+
+ TST_DO_TEST (mbrlen)
+ {
+ TST_HEAD_LOCALE (mbrlen, S_MBRLEN);
+ TST_DO_REC (mbrlen)
+ {
+ if (mbrlen (NULL, 0, &s) != 0)
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBRLEN, CASE_3,
+ "Initialization (external mbstate object) failed "
+ "- skipped this test case.");
+ continue;
+ }
+
+ TST_DO_SEQ (MBRLEN_SEQNUM)
+ {
+ TST_GET_ERRET_SEQ (mbrlen);
+ s_flg = TST_INPUT_SEQ (mbrlen).s_flg;
+ s_in = TST_INPUT_SEQ (mbrlen).s;
+ n = TST_INPUT_SEQ (mbrlen).n;
+ t_flg = TST_INPUT_SEQ (mbrlen).t_flg;
+ t_ini = TST_INPUT_SEQ (mbrlen).t_init;
+ if (s_flg == 0)
+ {
+ s_in = NULL;
+ }
+
+ if (n == USE_MBCURMAX) /* rewrite tst_mblen() like this */
+ {
+ n = MB_CUR_MAX;
+ }
+
+ ps = (t_flg == 0) ? NULL : &s;
+
+ if (t_ini != 0)
+ {
+ memset (&s, 0, sizeof (s));
+ mbrlen (NULL, 0, NULL);
+ }
+
+ TST_CLEAR_ERRNO;
+ ret = mbrlen (s_in, n, ps);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "mbrlen() [ %s : %d : %d ] ret = %zd\n",
+ locale, rec + 1, seq_num + 1, ret);
+ fprintf (stdout, " errno = %d\n", errno_save);
+ }
+
+ TST_IF_RETURN (S_MBRLEN)
+ {
+ };
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_mbrtowc.c b/test/locale-mbwc/tst_mbrtowc.c
new file mode 100644
index 0000000..b6247ce
--- /dev/null
+++ b/test/locale-mbwc/tst_mbrtowc.c
@@ -0,0 +1,96 @@
+/*
+ MBRTOWC: size_t mbrtowc (wchar_t *pwc, const char *s, size_t n,
+ mbstate_t *ps)
+*/
+
+#define TST_FUNCTION mbrtowc
+
+#include "tsp_common.c"
+#include "dat_mbrtowc.c"
+
+
+int
+tst_mbrtowc (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ char w_flg, s_flg;
+ char *s;
+ size_t n;
+ char t_flg;
+ static mbstate_t t = { 0 };
+ mbstate_t *pt;
+ wchar_t wc, *pwc, wc_ex;
+
+ TST_DO_TEST (mbrtowc)
+ {
+ TST_HEAD_LOCALE (mbrtowc, S_MBRTOWC);
+ TST_DO_REC (mbrtowc)
+ {
+ if (mbrtowc (NULL, "", 0, &t) != 0)
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBRTOWC, CASE_3,
+ "Initialization failed - skipping this test case.");
+ continue;
+ }
+
+ TST_DO_SEQ (MBRTOWC_SEQNUM)
+ {
+ TST_GET_ERRET_SEQ (mbrtowc);
+ w_flg = TST_INPUT_SEQ (mbrtowc).w_flg;
+ s_flg = TST_INPUT_SEQ (mbrtowc).s_flg;
+ s = TST_INPUT_SEQ (mbrtowc).s;
+ n = TST_INPUT_SEQ (mbrtowc).n;
+ t_flg = TST_INPUT_SEQ (mbrtowc).t_flg;
+ pwc = (w_flg == 0) ? NULL : &wc;
+
+ if (s_flg == 0)
+ {
+ s = NULL;
+ }
+
+ if (n == USE_MBCURMAX)
+ {
+ n = MB_CUR_MAX;
+ }
+
+ pt = (t_flg == 0) ? NULL : &t;
+ TST_CLEAR_ERRNO;
+ ret = mbrtowc (pwc, s, n, pt);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "mbrtowc() [ %s : %d : %d ] ret = %zd\n",
+ locale, rec + 1, seq_num + 1, ret);
+ fprintf (stdout, " errno = %hd\n",
+ errno_save);
+ }
+
+ TST_IF_RETURN (S_MBRTOWC)
+ {
+ };
+
+ if (pwc == NULL || s == NULL || ret == (size_t) - 1
+ || ret == (size_t) - 2)
+ {
+ continue;
+ }
+
+ wc_ex = TST_EXPECT_SEQ (mbrtowc).wc;
+ if (wc_ex == wc)
+ {
+ Result (C_SUCCESS, S_MBRTOWC, CASE_4, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBRTOWC, CASE_4,
+ "converted wc is different from an expected wc");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_mbsrtowcs.c b/test/locale-mbwc/tst_mbsrtowcs.c
new file mode 100644
index 0000000..3f3ea71
--- /dev/null
+++ b/test/locale-mbwc/tst_mbsrtowcs.c
@@ -0,0 +1,109 @@
+/*
+ MBSRTOWCS: size_t mbsrtowcs (wchar_t *ws, const char **s, size_t n,
+ mbstate_t *ps)
+*/
+
+#define TST_FUNCTION mbsrtowcs
+
+#include "tsp_common.c"
+#include "dat_mbsrtowcs.c"
+
+int
+tst_mbsrtowcs (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ char w_flg;
+ const char *s, *p;
+ size_t n;
+ char t_flg, t_ini;
+ static mbstate_t t = { 0 };
+ mbstate_t *pt;
+ wchar_t ws[WCSSIZE], *ws_ex, *wp;
+ int err, i;
+
+ TST_DO_TEST (mbsrtowcs)
+ {
+ TST_HEAD_LOCALE (mbsrtowcs, S_MBSRTOWCS);
+ TST_DO_REC (mbsrtowcs)
+ {
+ s = "";
+ if (mbsrtowcs (NULL, &s, 0, &t) != 0)
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBSRTOWCS, CASE_3,
+ "Initialization failed - skipping this test case.");
+ continue;
+ }
+
+ TST_DO_SEQ (MBSRTOWCS_SEQNUM)
+ {
+ TST_GET_ERRET_SEQ (mbsrtowcs);
+ w_flg = TST_INPUT_SEQ (mbsrtowcs).w_flg;
+ p = s = TST_INPUT_SEQ (mbsrtowcs).s;
+ n = TST_INPUT_SEQ (mbsrtowcs).n;
+ t_flg = TST_INPUT_SEQ (mbsrtowcs).t_flg;
+ t_ini = TST_INPUT_SEQ (mbsrtowcs).t_init;
+ wp = (w_flg == 0) ? NULL : ws;
+
+ if (n == USE_MBCURMAX)
+ {
+ n = MB_CUR_MAX;
+ }
+
+ pt = (t_flg == 0) ? NULL : &t;
+
+ if (t_ini != 0)
+ {
+ memset (&t, 0, sizeof (t));
+ }
+
+ TST_CLEAR_ERRNO;
+ ret = mbsrtowcs (wp, &p, n, pt);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "mbsrtowcs: [ %d ] : ret = %zd\n", rec + 1, ret);
+ }
+
+ TST_IF_RETURN (S_MBSRTOWCS)
+ {
+ };
+
+ if (wp == NULL || ret == (size_t) - 1 || ret == (size_t) - 2)
+ {
+ continue;
+ }
+
+ ws_ex = TST_EXPECT_SEQ (mbsrtowcs).ws;
+ for (err = 0, i = 0; i < ret; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr,
+ "mbsrtowcs: ws[%d] => 0x%lx : 0x%lx <= ws_ex[%d]\n",
+ i, (unsigned long int) ws[i],
+ (unsigned long int) ws_ex[i], i);
+ }
+
+ if (ws[i] != ws_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_MBSRTOWCS, CASE_4,
+ "the converted wc string has "
+ "different value from an expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_MBSRTOWCS, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_mbstowcs.c b/test/locale-mbwc/tst_mbstowcs.c
new file mode 100644
index 0000000..878df6a
--- /dev/null
+++ b/test/locale-mbwc/tst_mbstowcs.c
@@ -0,0 +1,98 @@
+/*
+ MBSTOWCS: size_t mbstowcs (wchar_t *ws, char *s, size_t n)
+*/
+
+#define TST_FUNCTION mbstowcs
+
+#include "tsp_common.c"
+#include "dat_mbstowcs.c"
+
+int
+tst_mbstowcs (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ char w_flg, s_flg;
+ const char *s;
+ size_t n;
+ wchar_t ws[WCSSIZE], *ws_ex, *wp;
+ int err, i;
+
+ TST_DO_TEST (mbstowcs)
+ {
+ TST_HEAD_LOCALE (mbstowcs, S_MBSTOWCS);
+ TST_DO_REC (mbstowcs)
+ {
+ if (mbstowcs (NULL, "", 0) != 0)
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBSTOWCS, CASE_3,
+ "Initialization failed - skipping this test case.");
+ continue;
+ }
+
+ TST_DO_SEQ (MBSTOWCS_SEQNUM)
+ {
+ TST_GET_ERRET_SEQ (mbstowcs);
+ w_flg = TST_INPUT_SEQ (mbstowcs).w_flg;
+ s_flg = TST_INPUT_SEQ (mbstowcs).s_flg;
+ n = TST_INPUT_SEQ (mbstowcs).n;
+
+ if (s_flg == 0)
+ s = NULL;
+ else
+ s = TST_INPUT_SEQ (mbstowcs).s;
+
+
+ wp = (wchar_t *) ((w_flg == 0) ? NULL : ws);
+
+ TST_CLEAR_ERRNO;
+ ret = mbstowcs (wp, s, n);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "mbstowcs: ret = %zd\n", ret);
+ }
+
+ TST_IF_RETURN (S_MBSTOWCS)
+ {
+ };
+
+ if (s == NULL || wp == NULL || ret == (size_t) - 1)
+ {
+ continue;
+ }
+
+ ws_ex = TST_EXPECT_SEQ (mbstowcs).ws;
+
+ for (err = 0, i = 0; i < ret; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr,
+ "mbstowcs: ws[%d] => 0x%lx : 0x%lx <= ws_ex[%d]\n",
+ i, (unsigned long int) ws[i],
+ (unsigned long int) ws_ex[i], i);
+ }
+
+ if (ws[i] != ws_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_MBSTOWCS, CASE_4,
+ "the converted wc string has "
+ "different value from an expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_MBSTOWCS, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_mbtowc.c b/test/locale-mbwc/tst_mbtowc.c
new file mode 100644
index 0000000..7c274f6
--- /dev/null
+++ b/test/locale-mbwc/tst_mbtowc.c
@@ -0,0 +1,130 @@
+/*
+ MBTOWC: int mbtowc (wchar_t *wc, char *s, size_t n)
+*/
+
+#define TST_FUNCTION mbtowc
+
+#include "tsp_common.c"
+#include "dat_mbtowc.c"
+
+
+int
+tst_mbtowc (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ char w_flg, s_flg;
+ const char *s_in;
+ size_t n;
+ wchar_t wc, wc_ex, *wp;
+
+ TST_DO_TEST (mbtowc)
+ {
+ TST_HEAD_LOCALE (mbtowc, S_MBTOWC);
+ TST_DO_REC (mbtowc)
+ {
+ if (mbstowcs (NULL, "", 0) != 0)
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBSTOWCS, CASE_3,
+ "Initialization failed - skipping this test case.");
+ continue;
+ }
+
+ TST_DO_SEQ (MBTOWC_SEQNUM)
+ {
+ TST_GET_ERRET_SEQ (mbtowc);
+ w_flg = TST_INPUT_SEQ (mbtowc).w_flg;
+ s_flg = TST_INPUT_SEQ (mbtowc).s_flg;
+ n = TST_INPUT_SEQ (mbtowc).n;
+
+ if (n == USE_MBCURMAX)
+ {
+ n = MB_CUR_MAX;
+ }
+
+ if (s_flg == 0)
+ s_in = NULL;
+ else
+ s_in = TST_INPUT_SEQ (mbtowc).s;
+
+ wp = (wchar_t *) ((w_flg == 0) ? NULL : &wc);
+
+ /* XXX Clear the internal state. We should probably have
+ a flag for this. */
+ mbtowc (NULL, NULL, 0);
+
+ TST_CLEAR_ERRNO;
+ ret = mbtowc (wp, s_in, n);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "mbtowc() [ %s : %d ] ret = %d\n", locale,
+ rec + 1, ret);
+ fprintf (stdout, " errno = %d\n",
+ errno_save);
+ }
+
+ TST_IF_RETURN (S_MBTOWC)
+ {
+ if (s_in == NULL)
+ { /* state dependency */
+ if (ret_exp == +1)
+ { /* state-dependent */
+ if (ret != 0)
+ {
+ /* Non-zero: state-dependent encoding. */
+ Result (C_SUCCESS, S_MBTOWC, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBTOWC, CASE_3,
+ "should be state-dependent encoding, "
+ "but a return value shows it is "
+ "state-independent");
+ }
+ }
+
+ if (ret_exp == 0)
+ { /* state-independent */
+ if (ret == 0)
+ {
+ /* Non-zero: state-dependent encoding. */
+ Result (C_SUCCESS, S_MBTOWC, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBTOWC, CASE_3,
+ "should be state-independent encoding, "
+ "but a return value shows it is "
+ "state-dependent");
+ }
+ }
+ }
+ }
+
+ if ((wp == NULL || s_in == NULL || s_in[0] == 0) || ret <= 0)
+ {
+ continue;
+ }
+
+ wc_ex = TST_EXPECT_SEQ (mbtowc).wc;
+
+ if (wc_ex == wc)
+ {
+ Result (C_SUCCESS, S_MBTOWC, CASE_4, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_MBTOWC, CASE_4,
+ "converted wc is different from an expected wc");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_strcoll.c b/test/locale-mbwc/tst_strcoll.c
new file mode 100644
index 0000000..4c5a84f
--- /dev/null
+++ b/test/locale-mbwc/tst_strcoll.c
@@ -0,0 +1,87 @@
+/*
+ STRCOLL: int strcoll (const char *s1, const char *s2)
+*/
+
+#define TST_FUNCTION strcoll
+
+#include "tsp_common.c"
+#include "dat_strcoll.c"
+
+int
+tst_strcoll (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ const char *s1, *s2;
+
+ TST_DO_TEST (strcoll)
+ {
+ TST_HEAD_LOCALE (strcoll, S_STRCOLL);
+ TST_DO_REC (strcoll)
+ {
+ TST_GET_ERRET (strcoll);
+ s1 = TST_INPUT (strcoll).s1;
+ s2 = TST_INPUT (strcoll).s2;
+
+ TST_CLEAR_ERRNO;
+ ret = strcoll (s1, s2);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "strcoll() [ %s : %d ] ret = %d\n", locale,
+ rec + 1, ret);
+ fprintf (stdout, " errno = %d\n",
+ errno_save);
+ fprintf (stdout, " LC_COLLATE = %s\n",
+ (setlocale (LC_COLLATE, NULL)) ? setlocale (LC_COLLATE,
+ NULL) : "");
+ }
+
+ TST_IF_RETURN (S_STRCOLL)
+ {
+ if (ret_exp == +1)
+ {
+ if (ret > 0)
+ {
+ Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_STRCOLL, CASE_3,
+ "the return value should be greater than 0,"
+ " but is not ...");
+ }
+ }
+ else if (ret_exp == -1)
+ {
+ if (ret < 0)
+ {
+ Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_STRCOLL, CASE_3,
+ "the return value should less than 0, but not ...");
+ }
+ }
+ else if (ret_exp != 0)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr, "*** Warning *** : tst_strcoll : "
+ "(check the test data); should set ret_flg=1"
+ " to check a return value");
+ }
+
+ warn_count++;
+ Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data); "
+ "should set ret_flg=1 to check a return value");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_strfmon.c b/test/locale-mbwc/tst_strfmon.c
new file mode 100644
index 0000000..88e9316
--- /dev/null
+++ b/test/locale-mbwc/tst_strfmon.c
@@ -0,0 +1,74 @@
+/*
+ STRFMON: size_t strfmon (char *buf, size_t nbyte, const char *fmt, ...)
+*/
+
+#define TST_FUNCTION strfmon
+
+#include "tsp_common.c"
+#include "dat_strfmon.c"
+#include <monetary.h>
+
+int
+tst_strfmon (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ char buf[MONSIZE], *mon;
+ size_t nbt;
+ char *fmt;
+ double val;
+
+ TST_DO_TEST (strfmon)
+ {
+ TST_HEAD_LOCALE (strfmon, S_STRFMON);
+ TST_DO_REC (strfmon)
+ {
+ TST_GET_ERRET (strfmon);
+ nbt = TST_INPUT (strfmon).nbytes;
+ fmt = TST_INPUT (strfmon).fmt;
+ val = TST_INPUT (strfmon).val;
+ memset (buf, 0, MONSIZE);
+ if (nbt > MONSIZE)
+ {
+ err_count++;
+ Result (C_FAILURE, S_STRFMON, CASE_3, "buffer too small in test");
+ continue;
+ }
+
+ TST_CLEAR_ERRNO;
+ ret = strfmon (buf, nbt, fmt, val, val, val);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg) /* seems fprintf doesn't update the errno */
+ {
+ fprintf (stdout, "strfmon() [ %s : %d ]\n", locale, rec + 1);
+ fprintf (stdout, " : err = %d | %s\n", errno_save,
+ strerror (errno));
+ fprintf (stdout, " : ret = %zd; \t fmt = |%s|\n", ret, fmt);
+ fprintf (stdout, " : buf = |%s|\n\n", buf);
+ }
+
+ TST_IF_RETURN (S_STRFMON)
+ {
+ };
+ if (errno != 0 || ret == -1)
+ {
+ continue;
+ }
+
+ mon = TST_EXPECT (strfmon).mon;
+
+ if (!strcmp (buf, mon))
+ {
+ Result (C_SUCCESS, S_STRFMON, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_STRFMON, CASE_3, "the formatted string is "
+ "different from an expected result");
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_strxfrm.c b/test/locale-mbwc/tst_strxfrm.c
new file mode 100644
index 0000000..fdfeffc
--- /dev/null
+++ b/test/locale-mbwc/tst_strxfrm.c
@@ -0,0 +1,136 @@
+/*
+ STRXFRM: size_t strxfrm (char *s1, const char *s2, size_t n)
+*/
+
+#define TST_FUNCTION strxfrm
+
+#include "tsp_common.c"
+#include "dat_strxfrm.c"
+
+
+int
+tst_strxfrm (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ const char *org1, *org2;
+ char frm1[MBSSIZE], frm2[MBSSIZE];
+ size_t n1, n2;
+ int ret_coll, ret_cmp;
+
+ TST_DO_TEST (strxfrm)
+ {
+ TST_HEAD_LOCALE (strxfrm, S_STRXFRM);
+ TST_DO_REC (strxfrm)
+ {
+ TST_GET_ERRET (strxfrm);
+ org1 = TST_INPUT (strxfrm).org1;
+ org2 = TST_INPUT (strxfrm).org2;
+ n1 = TST_INPUT (strxfrm).n1;
+ n2 = TST_INPUT (strxfrm).n2;
+
+ if (n1 < 0 || sizeof (frm1) < n1 || sizeof (frm2) < n2)
+ {
+ warn_count++;
+ Result (C_IGNORED, S_STRXFRM, CASE_9,
+ "input data n1 or n2 is invalid");
+ continue;
+ }
+
+ /* An errno and a return value are checked
+ only for 2nd strxfrm() call.
+ A result of 1st call is used for comparing
+ those 2 values by using strcmp().
+ */
+
+ /*-- First call --*/
+
+ TST_CLEAR_ERRNO;
+ ret = strxfrm (frm1, org1, n1);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "strxfrm() [ %s : %d ] ( 1st call )\n", locale,
+ rec + 1);
+ fprintf (stdout, " : err = %d | %s\n", errno_save,
+ strerror (errno));
+ fprintf (stdout, " : ret = %zu\n", ret);
+ fprintf (stdout, " : org = %s\n", org1);
+ }
+
+ if (ret >= n1 || errno != 0)
+ {
+ warn_count++;
+ Result (C_INVALID, S_STRXFRM, CASE_8,
+ "got an error in fist strxfrm() call");
+ continue;
+ }
+
+ /*-- Second call --*/
+
+ TST_CLEAR_ERRNO;
+ ret = strxfrm (((n2 == 0) ? NULL : frm2), org2, n2);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stderr, " ..............( 2nd call )\n");
+ fprintf (stdout, " : err = %d | %s\n", errno,
+ strerror (errno));
+ fprintf (stdout, " : ret = %zu\n", ret);
+ fprintf (stdout, " : org = %s\n", org2);
+ }
+
+ TST_IF_RETURN (S_STRXFRM)
+ {
+ };
+
+ if (n2 == 0 || ret >= n2 || errno != 0)
+ {
+#if 0
+ warn_count++;
+ Result (C_IGNORED, S_STRXFRM, CASE_7, "did not get a result");
+#endif
+ continue;
+ }
+
+ /*-- strcoll & strcmp --*/
+
+ TST_CLEAR_ERRNO;
+ /* Depends on strcoll() ... not good though ... */
+ ret_coll = strcoll (org1, org2);
+
+ if (errno != 0)
+ {
+ /* bug * bug may get correct results ... */
+ warn_count++;
+ Result (C_INVALID, S_STRXFRM, CASE_6,
+ "got an error in strcoll() call");
+ continue;
+ }
+
+ ret_cmp = strcmp (frm1, frm2);
+
+ if ((ret_coll == 0 && ret_cmp == 0)
+ || (ret_coll < 0 && ret_cmp < 0) || (ret_coll > 0 && ret_cmp > 0))
+ {
+ Result (C_SUCCESS, S_STRXFRM, CASE_3,
+ MS_PASSED "(depends on strcoll & strcmp)");
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_STRXFRM, CASE_3,
+ "results from strcoll & strcmp() do not match");
+ }
+
+ if (debug_flg)
+ {
+ fprintf (stdout, ".......... strcoll = %d <-> %d = strcmp\n",
+ ret_coll, ret_cmp);
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_swscanf.c b/test/locale-mbwc/tst_swscanf.c
new file mode 100644
index 0000000..76445d7
--- /dev/null
+++ b/test/locale-mbwc/tst_swscanf.c
@@ -0,0 +1,137 @@
+/*
+ SWSCANF: int swscanf (const wchar_t *ws, const wchar_t *fmt, ...);
+*/
+
+#define TST_FUNCTION swscanf
+
+#include "tsp_common.c"
+#include "dat_swscanf.c"
+
+int
+tst_swscanf (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t *ws;
+ wchar_t *fmt;
+ int val_int1;
+ unsigned val_int2;
+ float val_flt;
+ char val_c;
+ char val_s[MBSSIZE * 3];
+ wchar_t val_S[WCSSIZE * 3], *exp_S;
+ int i;
+
+ TST_DO_TEST (swscanf)
+ {
+ TST_HEAD_LOCALE (swscanf, S_SWSCANF);
+ TST_DO_REC (swscanf)
+ {
+ TST_GET_ERRET (swscanf);
+ ws = TST_INPUT (swscanf).ws;
+ fmt = TST_INPUT (swscanf).fmt;
+ val_int1 = val_int2 = val_flt = val_c = 0;
+ memset (val_s, 0, sizeof (val_s));
+ memset (val_S, 0, sizeof (val_S));
+
+ TST_CLEAR_ERRNO;
+
+ if (TST_INPUT (swscanf).wch)
+ {
+ ret = swscanf (ws, fmt, val_S);
+ }
+ else
+ {
+ ret =
+ swscanf (ws, fmt, &val_int1, &val_int2, &val_flt, &val_c, val_s);
+ }
+
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ { /* seems fprintf doesn't update errno */
+ fprintf (stdout, "swscanf() [ %s : %d ] ret = %d\n", locale,
+ rec + 1, ret);
+ fprintf (stdout, " errno = %d\n",
+ errno_save);
+ fprintf (stdout, " collate = %s\n",
+ (setlocale (LC_COLLATE, NULL)) ? setlocale (LC_COLLATE,
+ NULL) : "");
+
+ if (TST_INPUT (swscanf).wch)
+ {
+ fprintf (stdout, " val_S[ 0 ] = 0x%lx\n",
+ (unsigned long int) val_S[0]);
+ }
+ else
+ {
+ fprintf (stdout, " val_int1 = %d\n",
+ val_int1);
+ fprintf (stdout, " val_int2 = %d\n",
+ val_int2);
+ fprintf (stdout, " val_flt = %f\n",
+ val_flt);
+ fprintf (stdout, " val_c = %c\n",
+ val_c);
+ fprintf (stdout, " val_s = %s\n",
+ val_s);
+ }
+ }
+
+ TST_IF_RETURN (S_SWSCANF)
+ {
+ };
+
+ if (errno == 0 && TST_INPUT (swscanf).wch)
+ {
+ for (exp_S = TST_EXPECT (swscanf).val_S, i = 0; i < WCSSIZE * 3;
+ i++)
+ {
+ if (val_S[i] == L'\0' || exp_S[i] == L'\0')
+ {
+ if (val_S[i] != exp_S[i] && TST_INPUT (swscanf).wch == 'C')
+ {
+ err_count++;
+ Result (C_FAILURE, S_SWSCANF, CASE_4,
+ "the converted wide-char string is different"
+ " from an expected value.");
+ }
+ break;
+ }
+
+ if (val_S[i] != exp_S[i])
+ {
+ err_count++;
+ Result (C_FAILURE, S_SWSCANF, CASE_4,
+ "the converted wide-char string is different from"
+ " an expected value.");
+ break;
+ }
+ else
+ {
+ Result (C_SUCCESS, S_SWSCANF, CASE_4, MS_PASSED);
+ }
+ }
+ }
+
+ if (errno == 0 && !TST_INPUT (swscanf).wch)
+ {
+ if (val_int1 != TST_EXPECT (swscanf).val_int ||
+ val_int2 != TST_EXPECT (swscanf).val_uns ||
+ val_flt != TST_EXPECT (swscanf).val_flt ||
+ val_c != TST_EXPECT (swscanf).val_c ||
+ strcmp (val_s, TST_EXPECT (swscanf).val_s))
+ {
+ err_count++;
+ Result (C_FAILURE, S_SWSCANF, CASE_3,
+ "the converted values are different from expected values.");
+ }
+ else
+ {
+ Result (C_SUCCESS, S_SWSCANF, CASE_3, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_towctrans.c b/test/locale-mbwc/tst_towctrans.c
new file mode 100644
index 0000000..1d874dc
--- /dev/null
+++ b/test/locale-mbwc/tst_towctrans.c
@@ -0,0 +1,82 @@
+/*
+ TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc);
+*/
+
+#define TST_FUNCTION towctrans
+
+#include "tsp_common.c"
+#include "dat_towctrans.c"
+
+
+int
+tst_towctrans (FILE *fp, int debug_flg)
+{
+ TST_DECL_VARS (wint_t);
+ wint_t wc;
+ const char *ts;
+#if SHOJI_IS_RIGHT
+ int dummy=0;
+#endif
+ wctrans_t wto;
+
+ TST_DO_TEST (towctrans)
+ {
+ TST_HEAD_LOCALE (towctrans, S_TOWCTRANS);
+ TST_DO_REC (towctrans)
+ {
+ TST_GET_ERRET (towctrans);
+ wc = TST_INPUT (towctrans).wc;
+ ts = TST_INPUT (towctrans).ts;
+
+#if SHOJI_IS_RIGHT
+ if ((wto = wctrans (ts)) == (wctrans_t) 0)
+ {
+#if 0
+ result (fp, C_IGNORED, S_TOWCTRANS, locale, rec+1, seq_num+1, 3,
+ "Skip this data because the wctrans object is not invalid.");
+ warn_count++;
+ continue;
+#else
+ wto = &dummy; /* not good ... */
+#endif
+ if (debug_flg)
+ {
+ fprintf (stdout, "towctrans() ------ wctrans() returnd 0.\n");
+ }
+ }
+#else
+ wto = wctrans (ts);
+#endif
+
+ TST_CLEAR_ERRNO;
+ ret = towctrans (wc, wto);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "towctrans() [ %s : %d ] ret = 0x%x\n",
+ locale, rec+1, ret);
+ fprintf (stdout, " errno = %d\n",
+ errno_save);
+ }
+
+ TST_IF_RETURN (S_TOWCTRANS)
+ {
+ if (ret != 0)
+ {
+ result (fp, C_SUCCESS, S_TOWCTRANS, locale, rec+1,
+ seq_num+1, 3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ result (fp, C_FAILURE, S_TOWCTRANS, locale, rec+1,
+ seq_num+1, 3,
+ "the function returned 0, but should be non-zero");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_towlower.c b/test/locale-mbwc/tst_towlower.c
new file mode 100644
index 0000000..7719b0d
--- /dev/null
+++ b/test/locale-mbwc/tst_towlower.c
@@ -0,0 +1,11 @@
+/*
+ TOWLOWER: int towlower (wint_t wc);
+*/
+
+#define TST_FUNCTION towlower
+
+#include "tsp_common.c"
+#include "dat_towlower.c"
+
+
+TST_FUNC_TOW (LOWER, lower);
diff --git a/test/locale-mbwc/tst_towupper.c b/test/locale-mbwc/tst_towupper.c
new file mode 100644
index 0000000..a077d27
--- /dev/null
+++ b/test/locale-mbwc/tst_towupper.c
@@ -0,0 +1,10 @@
+/*
+ TOWUPPER: int towupper (wint_t wc);
+*/
+
+#define TST_FUNCTION towupper
+
+#include "tsp_common.c"
+#include "dat_towupper.c"
+
+TST_FUNC_TOW (UPPER, upper);
diff --git a/test/locale-mbwc/tst_types.h b/test/locale-mbwc/tst_types.h
new file mode 100644
index 0000000..3d18279
--- /dev/null
+++ b/test/locale-mbwc/tst_types.h
@@ -0,0 +1,729 @@
+/*
+ * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ * FILE: tst_types.h
+ *
+ * Definitions of data types for each test function
+ */
+
+
+#ifndef TST_TYPES_H
+#define TST_TYPES_H
+
+#include <stdio.h>
+#include <wchar.h>
+#include <wctype.h>
+#include "tst_funcs.h"
+#include "tgn_funcdef.h"
+
+#define MBSSIZE 24
+#define WCSSIZE 12
+#define MONFMTSIZE 16
+#define MONSIZE 64
+#define USE_MBCURMAX 99 /* well, but ... */
+#define TST_DBL_EPS 2.22153e-16
+#define WCSTOK_SEQNUM 3
+#define MBLEN_SEQNUM 3
+#define MBTOWC_SEQNUM 3
+#define MBSTOWCS_SEQNUM 3
+#define WCTOMB_SEQNUM 3
+#define WCSTOMBS_SEQNUM 3
+#define MBRLEN_SEQNUM 3
+#define MBRTOWC_SEQNUM 3
+#define MBSRTOWCS_SEQNUM 3
+#define WCRTOMB_SEQNUM 3
+#define WCSRTOMBS_SEQNUM 3
+
+/* Maximum numbers of test in one of the _loc arrays. */
+#define MAX_LOC_TEST 300
+
+
+/*----------------------------------------------------------------------*/
+/* FUNCTION */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ char *func_str;
+ int func_id;
+}
+TST_FID;
+
+typedef struct
+{
+ int func_id;
+ const char *locale;
+}
+TST_HEAD;
+
+typedef struct
+{
+ TST_HEAD *head;
+}
+TST_FUNCS;
+
+
+/*----------------------------------------------------------------------*/
+/* ISW*: int isw* (wchar_t wc) */
+/*----------------------------------------------------------------------*/
+
+TST_ISW_STRUCT (ALNUM, alnum);
+TST_ISW_STRUCT (ALPHA, alpha);
+TST_ISW_STRUCT (CNTRL, cntrl);
+TST_ISW_STRUCT (DIGIT, digit);
+TST_ISW_STRUCT (GRAPH, graph);
+TST_ISW_STRUCT (LOWER, lower);
+TST_ISW_STRUCT (PRINT, print);
+TST_ISW_STRUCT (PUNCT, punct);
+TST_ISW_STRUCT (SPACE, space);
+TST_ISW_STRUCT (UPPER, upper);
+TST_ISW_STRUCT (XDIGIT, xdigit);
+
+typedef struct
+{
+ wint_t wc;
+ const char *ts;
+}
+TIN_ISWCTYPE_REC;
+
+typedef
+TEX_ERRET_REC (int)
+ TEX_ISWCTYPE_REC;
+TMD_RECHEAD (ISWCTYPE);
+
+
+/*----------------------------------------------------------------------*/
+/* MBLEN: int mblen (const char *s, size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ char s_flg;
+ char s[MBSSIZE];
+ size_t n;
+}
+TIN_MBLEN_REC;
+
+typedef TEX_ERRET_REC (int) TEX_MBLEN_REC;
+TMD_RECHEAD (MBLEN);
+
+
+/*----------------------------------------------------------------------*/
+/* MBRLEN: size_t mbrlen (const char *s, size_t n, mbstate_t *ps) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ struct
+ {
+ int s_flg;
+ char s[MBSSIZE];
+ size_t n;
+ int t_flg;
+ int t_init;
+ }
+ seq[WCSTOK_SEQNUM];
+}
+TIN_MBRLEN_REC;
+
+typedef TEX_ERRET_REC_SEQ (size_t, MBRLEN_SEQNUM) TEX_MBRLEN_REC;
+TMD_RECHEAD (MBRLEN);
+
+
+/*----------------------------------------------------------------------*/
+/* MBRTOWC: size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, */
+/* mbstate_t *ps) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ struct
+ {
+ int w_flg;
+ int s_flg;
+ char s[MBSSIZE];
+ size_t n;
+ int t_flg;
+ int t_init;
+ }
+ seq[MBRTOWC_SEQNUM];
+}
+TIN_MBRTOWC_REC;
+
+typedef struct
+{
+ struct
+ {
+ TMD_ERRET (size_t);
+ wchar_t wc;
+ }
+ seq[MBRTOWC_SEQNUM];
+}
+TEX_MBRTOWC_REC;
+
+TMD_RECHEAD (MBRTOWC);
+
+
+/*----------------------------------------------------------------------*/
+/* MBSRTOWCS: size_t mbsrtowcs (wchar_t *ws, const char **s, size_t n, */
+/* mbstate_t *ps ) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ struct
+ {
+ int w_flg;
+ char s[MBSSIZE];
+ size_t n;
+ int t_flg;
+ int t_init;
+ }
+ seq[MBSRTOWCS_SEQNUM];
+}
+TIN_MBSRTOWCS_REC;
+
+typedef struct
+{
+ struct
+ {
+ TMD_ERRET (size_t);
+ wchar_t ws[WCSSIZE];
+ }
+ seq[MBSRTOWCS_SEQNUM];
+}
+TEX_MBSRTOWCS_REC;
+
+TMD_RECHEAD (MBSRTOWCS);
+
+
+/*----------------------------------------------------------------------*/
+/* MBSTOWCS: size_t mbstowcs (wchar_t *ws, const char *s, size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ struct
+ {
+ int w_flg;
+ int s_flg;
+ const char *s;
+ size_t n;
+ }
+ seq[MBSTOWCS_SEQNUM];
+}
+TIN_MBSTOWCS_REC;
+
+typedef TEX_MBSRTOWCS_REC TEX_MBSTOWCS_REC;
+/* MBSRTOWCS_SEQNUM == MBSTOWCS_SEQNUM */
+TMD_RECHEAD (MBSTOWCS);
+
+
+/*----------------------------------------------------------------------*/
+/* MBTOWC: int mbtowc (wchar_t *wc, const char *s, size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_MBSTOWCS_REC TIN_MBTOWC_REC;
+/* MBTOWC_SEQNUM == MBSTOWCS_SEQNUM */
+
+typedef struct
+{
+ struct
+ {
+ TMD_ERRET (int);
+ wchar_t wc;
+ }
+ seq[MBTOWC_SEQNUM];
+}
+TEX_MBTOWC_REC;
+
+TMD_RECHEAD (MBTOWC);
+
+
+/*----------------------------------------------------------------------*/
+/* STRCOLL: int strcoll (const char *s1, const char *s2) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ char s1[MBSSIZE];
+ char s2[MBSSIZE];
+}
+TIN_STRCOLL_REC;
+
+typedef TEX_ERRET_REC (int) TEX_STRCOLL_REC;
+TMD_RECHEAD (STRCOLL);
+
+
+/*----------------------------------------------------------------------*/
+/* STRFMON: size_t strfmon (char *buf, size_t nbytes, */
+/* const char *fmt, ... ) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ int nbytes;
+ char fmt[MONFMTSIZE];
+ double val;
+}
+TIN_STRFMON_REC;
+
+typedef struct
+{
+ TMD_ERRET (size_t);
+ char mon[MONSIZE];
+}
+TEX_STRFMON_REC;
+
+TMD_RECHEAD (STRFMON);
+
+
+/*----------------------------------------------------------------------*/
+/* STRXFRM: size_t strxfrm (char *s1, const char *s2, size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ char org1[MBSSIZE];
+ char org2[MBSSIZE];
+ size_t n1, n2;
+}
+TIN_STRXFRM_REC;
+
+typedef TEX_ERRET_REC (size_t) TEX_STRXFRM_REC; /* only for org2[] */
+TMD_RECHEAD (STRXFRM);
+
+
+/*----------------------------------------------------------------------*/
+/* SWSCANF: int swscanf (const wchar_t *ws, const wchar_t *fmt, ...) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t ws[WCSSIZE * 3];
+ wchar_t fmt[WCSSIZE * 3];
+ int wch;
+}
+TIN_SWSCANF_REC;
+
+typedef struct
+{
+ TMD_ERRET (int);
+ int val_int; /* %d */
+ unsigned val_uns; /* %u */
+ float val_flt; /* %f */
+ int val_c; /* %c */
+ char val_s[MBSSIZE * 2]; /* %s */
+ wchar_t val_S[WCSSIZE * 2]; /* %lc, %ls, %C, %S */
+}
+TEX_SWSCANF_REC;
+
+TMD_RECHEAD (SWSCANF);
+
+
+/*----------------------------------------------------------------------*/
+/* TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_ISWCTYPE_REC TIN_TOWCTRANS_REC;
+typedef TEX_ERRET_REC (wint_t) TEX_TOWCTRANS_REC;
+TMD_RECHEAD (TOWCTRANS);
+
+
+/*----------------------------------------------------------------------*/
+/* TOW*ER: wint_t tow*er (wint_t wc) */
+/*----------------------------------------------------------------------*/
+
+TST_TOW_STRUCT (LOWER, lower);
+TST_TOW_STRUCT (UPPER, upper);
+
+
+/*----------------------------------------------------------------------*/
+/* WCRTOMB: wchar_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ int s_flg;
+ wchar_t wc;
+ int t_flg;
+ int t_init;
+}
+TIN_WCRTOMB_REC;
+
+typedef struct
+{
+ TMD_ERRET (wchar_t);
+ char s[MBSSIZE];
+}
+TEX_WCRTOMB_REC;
+
+TMD_RECHEAD (WCRTOMB);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSCAT: wchar_t *wcscat (wchar_t *ws1, wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t ws1[WCSSIZE];
+ wchar_t ws2[WCSSIZE];
+}
+TIN_WCSCAT_REC;
+
+typedef struct
+{
+ TMD_ERRET (wchar_t *);
+ wchar_t ws[WCSSIZE];
+}
+TEX_WCSCAT_REC;
+
+TMD_RECHEAD (WCSCAT);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc); */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t ws[WCSSIZE];
+ wchar_t wc;
+}
+TIN_WCSCHR_REC;
+
+typedef TEX_ERRET_REC (wchar_t *) TEX_WCSCHR_REC;
+TMD_RECHEAD (WCSCHR);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCAT_REC TIN_WCSCMP_REC;
+typedef TEX_ERRET_REC (int) TEX_WCSCMP_REC;
+TMD_RECHEAD (WCSCMP);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCMP_REC TIN_WCSCOLL_REC;
+typedef struct
+{
+ TMD_ERRET (int);
+ int cmp_flg;
+}
+TEX_WCSCOLL_REC;
+TMD_RECHEAD (WCSCOLL);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSCPY: wchar_t *wcscpy (wchar_t *ws1, const wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t ws[WCSSIZE]; /* ws2: original string */
+}
+TIN_WCSCPY_REC;
+
+typedef TEX_WCSCAT_REC TEX_WCSCPY_REC;
+TMD_RECHEAD (WCSCPY);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSCSPN: size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCAT_REC TIN_WCSCSPN_REC;
+typedef TEX_ERRET_REC (size_t) TEX_WCSCSPN_REC;
+TMD_RECHEAD (WCSCSPN);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSLEN: size_t wcslen (const wchar_t *ws) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCPY_REC TIN_WCSLEN_REC;
+typedef TEX_ERRET_REC (size_t) TEX_WCSLEN_REC;
+TMD_RECHEAD (WCSLEN);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, */
+/* size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t ws1[WCSSIZE];
+ wchar_t ws2[WCSSIZE];
+ size_t n;
+}
+TIN_WCSNCAT_REC;
+
+typedef TEX_WCSCAT_REC TEX_WCSNCAT_REC;
+TMD_RECHEAD (WCSNCAT);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSNCMP: int *wcsncmp (const wchar_t *ws1, const wchar_t *ws2, */
+/* size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSNCAT_REC TIN_WCSNCMP_REC;
+typedef TEX_ERRET_REC (int) TEX_WCSNCMP_REC;
+TMD_RECHEAD (WCSNCMP);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2, */
+/* size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t ws[WCSSIZE]; /* ws2: original string */
+ size_t n;
+}
+TIN_WCSNCPY_REC;
+
+typedef TEX_WCSCPY_REC TEX_WCSNCPY_REC;
+TMD_RECHEAD (WCSNCPY);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCSPN_REC TIN_WCSPBRK_REC;
+
+typedef struct
+{
+ TMD_ERRET (wchar_t *);
+ wchar_t wc;
+}
+TEX_WCSPBRK_REC;
+
+TMD_RECHEAD (WCSPBRK);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSRTOMBS: size_t wcsrtombs (char *s, const wchar_t **ws, size_t n, */
+/* mbstate_t *ps) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ int s_flg;
+ int w_flg; /* don't need this */
+ wchar_t ws[WCSSIZE];
+ size_t n;
+ int t_flg;
+ int t_init;
+}
+TIN_WCSRTOMBS_REC;
+
+typedef struct
+{
+ TMD_ERRET (size_t);
+ char s[MBSSIZE];
+}
+TEX_WCSRTOMBS_REC;
+
+TMD_RECHEAD (WCSRTOMBS);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSSPN: size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCSPN_REC TIN_WCSSPN_REC;
+typedef TEX_WCSCSPN_REC TEX_WCSSPN_REC;
+TMD_RECHEAD (WCSSPN);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCSPN_REC TIN_WCSSTR_REC;
+typedef TEX_ERRET_REC (wchar_t *) TEX_WCSSTR_REC;
+TMD_RECHEAD (WCSSTR);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSTOD: double wcstod (const wchar_t *np, wchar_t **endp) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t np[WCSSIZE];
+}
+TIN_WCSTOD_REC;
+
+typedef struct
+{
+ TMD_ERRET (double);
+ double val;
+ wchar_t fwc;
+}
+TEX_WCSTOD_REC;
+
+TMD_RECHEAD (WCSTOD);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm, */
+/* wchar_t **pt) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ struct
+ {
+ int w_flg;
+ wchar_t ws[WCSSIZE];
+ wchar_t dt[WCSSIZE]; /* delimiter */
+ }
+ seq[WCSTOK_SEQNUM];
+}
+TIN_WCSTOK_REC;
+
+typedef struct
+{
+ struct
+ {
+ TMD_ERRET (wchar_t *);
+ wchar_t ws[WCSSIZE];
+ }
+ seq[WCSTOK_SEQNUM];
+}
+TEX_WCSTOK_REC;
+
+TMD_RECHEAD (WCSTOK);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSTOMBS: size_t wcstombs (char s, const wchar_t *ws, size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ int s_flg;
+ int w_flg; /* currently we don't need it. */
+ wchar_t ws[WCSSIZE];
+ size_t n;
+}
+TIN_WCSTOMBS_REC;
+
+typedef struct
+{
+ TMD_ERRET (size_t);
+ char s[MBSSIZE];
+}
+TEX_WCSTOMBS_REC;
+
+TMD_RECHEAD (WCSTOMBS);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSNCPY_REC TIN_WCSWIDTH_REC;
+typedef TEX_ERRET_REC (int) TEX_WCSWIDTH_REC;
+TMD_RECHEAD (WCSWIDTH);
+
+
+/*----------------------------------------------------------------------*/
+/* WCSXFRM: size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t n)*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t org1[WCSSIZE];
+ wchar_t org2[WCSSIZE];
+ int n1, n2;
+}
+TIN_WCSXFRM_REC;
+
+typedef TEX_ERRET_REC (size_t) TEX_WCSXFRM_REC; /* only for org2[] */
+TMD_RECHEAD (WCSXFRM);
+
+
+/*----------------------------------------------------------------------*/
+/* WCTOB: int wctob (wint_t wc) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wint_t wc;
+}
+TIN_WCTOB_REC;
+
+typedef TEX_ERRET_REC (int) TEX_WCTOB_REC;
+TMD_RECHEAD (WCTOB);
+
+
+/*----------------------------------------------------------------------*/
+/* WCTOMB: int wctomb (char *s, wchar_t wc) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ int s_flg;
+ wchar_t wc;
+}
+TIN_WCTOMB_REC;
+
+typedef struct
+{
+ TMD_ERRET (int);
+ char s[MBSSIZE];
+}
+TEX_WCTOMB_REC;
+
+TMD_RECHEAD (WCTOMB);
+
+
+/*----------------------------------------------------------------------*/
+/* WCTRANS: wctrans_t wctrans (const char *charclass) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ char class[MBSSIZE];
+}
+TIN_WCTRANS_REC;
+
+typedef TEX_ERRET_REC (wctrans_t) TEX_WCTRANS_REC;
+TMD_RECHEAD (WCTRANS);
+
+
+/*----------------------------------------------------------------------*/
+/* WCTYPE: wctype_t wctype (const char *class) */
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCTRANS_REC TIN_WCTYPE_REC;
+typedef TEX_ERRET_REC (wctype_t) TEX_WCTYPE_REC;
+TMD_RECHEAD (WCTYPE);
+
+
+/*----------------------------------------------------------------------*/
+/* WCWIDTH: int wcwidth (wchar_t wc) */
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+ wchar_t wc;
+}
+TIN_WCWIDTH_REC;
+
+typedef TEX_ERRET_REC (int) TEX_WCWIDTH_REC;
+TMD_RECHEAD (WCWIDTH);
+
+#endif /* TST_TYPES_H */
diff --git a/test/locale-mbwc/tst_wcrtomb.c b/test/locale-mbwc/tst_wcrtomb.c
new file mode 100644
index 0000000..0029a49
--- /dev/null
+++ b/test/locale-mbwc/tst_wcrtomb.c
@@ -0,0 +1,79 @@
+/*
+ WCRTOMB: wchar_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
+*/
+
+#define TST_FUNCTION wcrtomb
+
+#include "tsp_common.c"
+#include "dat_wcrtomb.c"
+
+
+int
+tst_wcrtomb (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t);
+ wchar_t wc;
+ char s[MBSSIZE], *s_in, *s_ex;
+ char t_flg, t_ini;
+ static mbstate_t t = { 0 };
+ mbstate_t *pt;
+ int err, i;
+
+ TST_DO_TEST (wcrtomb)
+ {
+ TST_HEAD_LOCALE (wcrtomb, S_WCRTOMB);
+ TST_DO_REC (wcrtomb)
+ {
+ TST_GET_ERRET (wcrtomb);
+ s_in = ((TST_INPUT (wcrtomb).s_flg) == 0) ? (char *) NULL : s;
+ wc = TST_INPUT (wcrtomb).wc;
+ t_flg = TST_INPUT (wcrtomb).t_flg;
+ t_ini = TST_INPUT (wcrtomb).t_init;
+ pt = (t_flg == 0) ? NULL : &t;
+
+ if (t_ini != 0)
+ {
+ memset (&t, 0, sizeof (t));
+ }
+
+ TST_CLEAR_ERRNO;
+ ret = wcrtomb (s_in, wc, pt);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "wcrtomb() [ %s : %d ] ret = %lu\n", locale,
+ rec + 1, (unsigned long int) ret);
+ fprintf (stdout, " errno = %d\n", errno_save);
+ }
+
+ TST_IF_RETURN (S_WCRTOMB)
+ {
+ };
+
+ s_ex = TST_EXPECT (wcrtomb).s;
+
+ if (s_in)
+ {
+ for (i = 0, err = 0; *(s_ex + i) != 0 && i < MBSSIZE; i++)
+ {
+ if (s_in[i] != s_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCRTOMB, CASE_4,
+ "copied string is different from an "
+ "expected string");
+ break;
+ }
+ }
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCRTOMB, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcscat.c b/test/locale-mbwc/tst_wcscat.c
new file mode 100644
index 0000000..3dc9809
--- /dev/null
+++ b/test/locale-mbwc/tst_wcscat.c
@@ -0,0 +1,78 @@
+/*
+ WCSCAT: wchar_t *wcscat (wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscat
+
+#include "tsp_common.c"
+#include "dat_wcscat.c"
+
+int
+tst_wcscat (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ wchar_t *ws1, *ws2, *ws_ex;
+ int i, err;
+
+ TST_DO_TEST (wcscat)
+ {
+ TST_HEAD_LOCALE (wcscat, S_WCSCAT);
+ TST_DO_REC (wcscat)
+ {
+ TST_GET_ERRET (wcscat);
+ ws1 = TST_INPUT (wcscat).ws1; /* external value: size WCSSIZE */
+ ws2 = TST_INPUT (wcscat).ws2;
+
+ TST_CLEAR_ERRNO;
+ ret = wcscat (ws1, ws2);
+ TST_SAVE_ERRNO;
+
+ TST_IF_RETURN (S_WCSCAT)
+ {
+ if (ret == ws1)
+ {
+ Result (C_SUCCESS, S_WCSCAT, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSCAT, CASE_3,
+ "the return address may not be correct");
+ }
+ }
+
+ /* function specific test cases here */
+
+ if (ret == ws1)
+ {
+ ws_ex = TST_EXPECT (wcscat).ws;
+ for (err = 0, i = 0;
+ (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stdout, "tst_wcscat() : ws1[%d] = 0x%lx\n", i,
+ (unsigned long int) ws1[i]);
+ }
+
+ if (ws1[i] != ws_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSCAT, CASE_4,
+ "concatinated string is different from an "
+ "expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSCAT, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcschr.c b/test/locale-mbwc/tst_wcschr.c
new file mode 100644
index 0000000..b57a05a
--- /dev/null
+++ b/test/locale-mbwc/tst_wcschr.c
@@ -0,0 +1,70 @@
+/*
+ WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc);
+*/
+
+#define TST_FUNCTION wcschr
+
+#include "tsp_common.c"
+#include "dat_wcschr.c"
+
+int
+tst_wcschr (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ wchar_t *ws, wc;
+
+ TST_DO_TEST (wcschr)
+ {
+ TST_HEAD_LOCALE (wcschr, S_WCSCHR);
+ TST_DO_REC (wcschr)
+ {
+ TST_GET_ERRET (wcschr);
+ ws = TST_INPUT (wcschr).ws; /* external value: size WCSSIZE */
+ wc = TST_INPUT (wcschr).wc;
+ ret = wcschr (ws, wc);
+
+ if (debug_flg)
+ {
+ if (ret)
+ {
+ fprintf (stderr, "wcschr: ret = 0x%lx\n",
+ (unsigned long int) *ret);
+ }
+ else
+ {
+ fprintf (stderr, "wcschr: ret = NULL pointer\n");
+ }
+ }
+
+ TST_IF_RETURN (S_WCSCHR)
+ {
+ if (ret == NULL)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr, "*** Warning *** tst_wcschr: "
+ "set ret_flg=1 to check NULL return value\n");
+ }
+
+ warn_count++;
+ Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data) "
+ "set ret_flg=1 to check NULL return value");
+ continue;
+ }
+
+ if (*ret == wc)
+ {
+ Result (C_SUCCESS, S_WCSCHR, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSCHR, CASE_3,
+ "the returned address of the string seems to be wrong");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcscmp.c b/test/locale-mbwc/tst_wcscmp.c
new file mode 100644
index 0000000..594682c
--- /dev/null
+++ b/test/locale-mbwc/tst_wcscmp.c
@@ -0,0 +1,40 @@
+/*
+ WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscmp
+
+#include "tsp_common.c"
+#include "dat_wcscmp.c"
+
+
+int
+tst_wcscmp (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t *ws1, *ws2;
+
+ TST_DO_TEST (wcscmp)
+ {
+ TST_HEAD_LOCALE (wcscmp, S_WCSCMP);
+ TST_DO_REC (wcscmp)
+ {
+ TST_GET_ERRET (wcscmp);
+ ws1 = TST_INPUT (wcscmp).ws1;
+ ws2 = TST_INPUT (wcscmp).ws2;
+ ret = wcscmp (ws1, ws2);
+ ret = (ret > 0 ? 1 : ret < 0 ? -1 : 0);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "tst_wcscmp: ret = %d\n", ret);
+ }
+
+ TST_IF_RETURN (S_WCSCMP)
+ {
+ };
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcscoll.c b/test/locale-mbwc/tst_wcscoll.c
new file mode 100644
index 0000000..929f80d
--- /dev/null
+++ b/test/locale-mbwc/tst_wcscoll.c
@@ -0,0 +1,76 @@
+/*
+ WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscoll
+
+#include "tsp_common.c"
+#include "dat_wcscoll.c"
+
+int
+tst_wcscoll (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t *ws1, *ws2;
+ int cmp;
+
+ TST_DO_TEST (wcscoll)
+ {
+ TST_HEAD_LOCALE (wcscoll, S_WCSCOLL);
+ TST_DO_REC (wcscoll)
+ {
+ TST_GET_ERRET (wcscoll);
+ ws1 = TST_INPUT (wcscoll).ws1; /* external value: size WCSSIZE */
+ ws2 = TST_INPUT (wcscoll).ws2;
+
+ TST_CLEAR_ERRNO;
+ ret = wcscoll (ws1, ws2);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "tst_wcscoll: ret = %d\n", ret);
+ }
+
+ cmp = TST_EXPECT (wcscoll).cmp_flg;
+ TST_IF_RETURN (S_WCSCOLL)
+ {
+ if (cmp != 0)
+ {
+ if ((cmp == 1 && ret > 0) || (cmp == -1 && ret < 0))
+ {
+ Result (C_SUCCESS, S_WCSCOLL, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ if (cmp == 1)
+ {
+ if (ret == 0)
+ Result (C_FAILURE, S_WCSCOLL, CASE_3,
+ "the return value should be positive"
+ " but it's zero.");
+ else
+ Result (C_FAILURE, S_WCSCOLL, CASE_3,
+ "the return value should be positive"
+ " but it's negative.");
+ }
+ else
+ {
+ if (ret == 0)
+ Result (C_FAILURE, S_WCSCOLL, CASE_3,
+ "the return value should be negative"
+ " but it's zero.");
+ else
+ Result (C_FAILURE, S_WCSCOLL, CASE_3,
+ "the return value should be negative"
+ " but it's positive.");
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcscpy.c b/test/locale-mbwc/tst_wcscpy.c
new file mode 100644
index 0000000..d5705a5
--- /dev/null
+++ b/test/locale-mbwc/tst_wcscpy.c
@@ -0,0 +1,85 @@
+/*-------------------------------------------------------------------------------------*/
+/* WCSCPY: wchar_t *wcscpy( wchar_t *ws1, const wchar_t *ws2 ) */
+/*-------------------------------------------------------------------------------------*/
+#define TST_FUNCTION wcscpy
+
+#include "tsp_common.c"
+#include "dat_wcscpy.c"
+
+int
+tst_wcscpy (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ wchar_t ws1[WCSSIZE], *ws2, *ws_ex;
+ int err, i;
+
+ TST_DO_TEST (wcscpy)
+ {
+ TST_HEAD_LOCALE (wcscpy, S_WCSCPY);
+ TST_DO_REC (wcscpy)
+ {
+ TST_GET_ERRET (wcscpy);
+ ws2 = TST_INPUT (wcscpy).ws; /* external value: size WCSSIZE */
+ ret = wcscpy (ws1, ws2);
+
+ TST_IF_RETURN (S_WCSCPY)
+ {
+ if (ret == ws1)
+ {
+ Result (C_SUCCESS, S_WCSCPY, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSCPY, CASE_3,
+ "the return address may not be correct");
+ }
+ }
+
+ if (ret == ws1)
+ {
+ ws_ex = TST_EXPECT (wcscpy).ws;
+
+ for (err = 0, i = 0;
+ (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr,
+ "ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n", i,
+ (unsigned long int) ws1[i], i,
+ (unsigned long int) ws_ex[i]);
+ }
+
+ if (ws1[i] != ws_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSCPY, CASE_4,
+ "copied string is different from an"
+ " expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSCPY, CASE_4, MS_PASSED);
+ }
+
+ if (ws1[i] == 0L)
+ {
+ Result (C_SUCCESS, S_WCSCPY, CASE_5, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSCPY, CASE_5,
+ "copied string is not null-terminated");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcscspn.c b/test/locale-mbwc/tst_wcscspn.c
new file mode 100644
index 0000000..e1c8892
--- /dev/null
+++ b/test/locale-mbwc/tst_wcscspn.c
@@ -0,0 +1,38 @@
+/*
+ WCSCSPN: size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscspn
+
+#include "tsp_common.c"
+#include "dat_wcscspn.c"
+
+int
+tst_wcscspn (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ wchar_t *ws1, *ws2;
+
+ TST_DO_TEST (wcscspn)
+ {
+ TST_HEAD_LOCALE (wcscspn, S_WCSCSPN);
+ TST_DO_REC (wcscspn)
+ {
+ TST_GET_ERRET (wcscspn);
+ ws1 = TST_INPUT (wcscspn).ws1;
+ ws2 = TST_INPUT (wcscspn).ws2; /* external value: size WCSSIZE */
+ ret = wcscspn (ws1, ws2);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "wcscspn: ret = %zu\n", ret);
+ }
+
+ TST_IF_RETURN (S_WCSCSPN)
+ {
+ };
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcslen.c b/test/locale-mbwc/tst_wcslen.c
new file mode 100644
index 0000000..d0ffa5a
--- /dev/null
+++ b/test/locale-mbwc/tst_wcslen.c
@@ -0,0 +1,31 @@
+/*
+ WCSLEN: size_t wcslen (const wchar_t *ws);
+*/
+
+#define TST_FUNCTION wcslen
+
+#include "tsp_common.c"
+#include "dat_wcslen.c"
+
+int
+tst_wcslen (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ wchar_t *ws;
+
+ TST_DO_TEST (wcslen)
+ {
+ TST_HEAD_LOCALE (wcslen, S_WCSLEN);
+ TST_DO_REC (wcslen)
+ {
+ TST_GET_ERRET (wcslen);
+ ws = TST_INPUT (wcslen).ws;
+ ret = wcslen (ws);
+ TST_IF_RETURN (S_WCSLEN)
+ {
+ };
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcsncat.c b/test/locale-mbwc/tst_wcsncat.c
new file mode 100644
index 0000000..a2f6ba0
--- /dev/null
+++ b/test/locale-mbwc/tst_wcsncat.c
@@ -0,0 +1,75 @@
+/*
+ WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, size_t n);
+*/
+
+#define TST_FUNCTION wcsncat
+
+#include "tsp_common.c"
+#include "dat_wcsncat.c"
+
+int
+tst_wcsncat (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ wchar_t *ws1, *ws2, *ws_ex;
+ int n, i, err;
+
+ TST_DO_TEST (wcsncat)
+ {
+ TST_HEAD_LOCALE (wcsncat, S_WCSNCAT);
+ TST_DO_REC (wcsncat)
+ {
+ TST_GET_ERRET (wcsncat);
+ ws1 = TST_INPUT (wcsncat).ws1; /* external value: size WCSSIZE */
+ ws2 = TST_INPUT (wcsncat).ws2;
+ n = TST_INPUT (wcsncat).n;
+ ret = wcsncat (ws1, ws2, n);
+
+ TST_IF_RETURN (S_WCSNCAT)
+ {
+ if (ret == ws1)
+ {
+ Result (C_SUCCESS, S_WCSNCAT, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSNCAT, CASE_3,
+ "the return address may not be correct");
+ }
+ }
+
+ if (ret == ws1)
+ {
+ ws_ex = TST_EXPECT (wcsncat).ws;
+
+ for (err = 0, i = 0;
+ (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr, "ws1[%d] = 0x%lx\n", i,
+ (unsigned long int) ws1[i]);
+ }
+
+ if (ws1[i] != ws_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSNCAT, CASE_4,
+ "the concatinated string has "
+ "different value from an expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSNCAT, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcsncmp.c b/test/locale-mbwc/tst_wcsncmp.c
new file mode 100644
index 0000000..d046ecd
--- /dev/null
+++ b/test/locale-mbwc/tst_wcsncmp.c
@@ -0,0 +1,40 @@
+/*-------------------------------------------------------------------------------------*/
+/* WCSNCMP: int wcsncmp( const wchar_t *ws1, const wchar_t *ws2, size_t n ) */
+/*-------------------------------------------------------------------------------------*/
+
+#define TST_FUNCTION wcsncmp
+
+#include "tsp_common.c"
+#include "dat_wcsncmp.c"
+
+int
+tst_wcsncmp (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t *ws1, *ws2;
+ size_t n;
+
+ TST_DO_TEST (wcsncmp)
+ {
+ TST_HEAD_LOCALE (wcsncmp, S_WCSNCMP);
+ TST_DO_REC (wcsncmp)
+ {
+ TST_GET_ERRET (wcsncmp);
+ ws1 = TST_INPUT (wcsncmp).ws1; /* external value: size WCSSIZE */
+ ws2 = TST_INPUT (wcsncmp).ws2;
+ n = TST_INPUT (wcsncmp).n;
+ ret = wcsncmp (ws1, ws2, n);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "tst_wcsncmp: ret = %d, 0x%x\n", ret, ret);
+ }
+
+ TST_IF_RETURN (S_WCSNCMP)
+ {
+ };
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcsncpy.c b/test/locale-mbwc/tst_wcsncpy.c
new file mode 100644
index 0000000..814bbc0
--- /dev/null
+++ b/test/locale-mbwc/tst_wcsncpy.c
@@ -0,0 +1,93 @@
+/*
+ WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2, size_t n);
+*/
+
+#define TST_FUNCTION wcsncpy
+
+#include "tsp_common.c"
+#include "dat_wcsncpy.c"
+
+#define WCSNUM_NCPY 7
+
+int
+tst_wcsncpy (FILE *fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ wchar_t ws1[WCSSIZE] =
+ { 0x9999, 0x9999, 0x9999, 0x9999, 0x9999, 0x9999, 0x0000 };
+ wchar_t *ws2, *ws_ex;
+ int err, i;
+ size_t n;
+
+ TST_DO_TEST (wcsncpy)
+ {
+ TST_HEAD_LOCALE (wcsncpy, S_WCSNCPY);
+ TST_DO_REC (wcsncpy)
+ {
+ TST_GET_ERRET (wcsncpy);
+
+ for (n = 0; n < WCSNUM_NCPY - 1; ++n)
+ {
+ ws1[n] = 0x9999;
+ }
+
+ ws1[n] = 0;
+ ws2 = TST_INPUT (wcsncpy).ws; /* external value: size WCSSIZE */
+ n = TST_INPUT (wcsncpy).n;
+ ret = wcsncpy (ws1, ws2, n);
+
+ TST_IF_RETURN (S_WCSNCPY)
+ {
+ if (ret == ws1)
+ {
+ Result (C_SUCCESS, S_WCSNCPY, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSNCPY, CASE_3,
+ "the return address may not be correct");
+ }
+ }
+
+ if (ret == ws1)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr, "\nwcsncpy: n = %zu\n\n", n);
+ }
+
+ ws_ex = TST_EXPECT (wcsncpy).ws;
+
+ for (err = 0, i = 0; i < WCSNUM_NCPY && i < WCSSIZE; i++)
+ {
+ if (debug_flg)
+ fprintf (stderr,
+ "wcsncpy: ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n",
+ i, (unsigned long int) ws1[i], i,
+ (unsigned long int) ws_ex[i]);
+
+ if (ws1[i] != ws_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSNCPY, CASE_4,
+ "copied string is different from an "
+ "expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSNCPY, CASE_4, MS_PASSED);
+ }
+
+ /* A null terminate character is not supposed to be copied
+ unless (num chars of ws2)<n. */
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcspbrk.c b/test/locale-mbwc/tst_wcspbrk.c
new file mode 100644
index 0000000..95c1c0f
--- /dev/null
+++ b/test/locale-mbwc/tst_wcspbrk.c
@@ -0,0 +1,80 @@
+/*
+ WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcspbrk
+
+#include "tsp_common.c"
+#include "dat_wcspbrk.c"
+
+int
+tst_wcspbrk (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ wchar_t *ws1, *ws2;
+ int err;
+ wchar_t wc_ex;
+
+ TST_DO_TEST (wcspbrk)
+ {
+ TST_HEAD_LOCALE (wcspbrk, S_WCSPBRK);
+ TST_DO_REC (wcspbrk)
+ {
+ TST_GET_ERRET (wcspbrk);
+ ws1 = TST_INPUT (wcspbrk).ws1;
+ ws2 = TST_INPUT (wcspbrk).ws2;
+
+ ret = wcspbrk (ws1, ws2);
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "wcspbrk() [ %s : %d ] ret = %s\n", locale,
+ rec + 1, (ret == NULL) ? "null" : "not null");
+ if (ret)
+ fprintf (stderr,
+ " ret[0] = 0x%lx : 0x%lx = ws2[0]\n",
+ (unsigned long int) ret[0], (unsigned long int) ws2[0]);
+ }
+
+ TST_IF_RETURN (S_WCSPBRK)
+ {
+ if (ws2[0] == 0)
+ {
+ if (ret == ws1)
+ {
+ Result (C_SUCCESS, S_WCSPBRK, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSPBRK, CASE_3,
+ "return address is not same address as ws1");
+ }
+
+ continue;
+ }
+
+ wc_ex = TST_EXPECT (wcspbrk).wc;
+
+ if (debug_flg)
+ fprintf (stdout,
+ " *ret = 0x%lx <-> 0x%lx = wc_ex\n",
+ (unsigned long int) *ret, (unsigned long int) wc_ex);
+
+ if (*ret != wc_ex)
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSPBRK, CASE_4, "the pointed wc is "
+ "different from an expected wc");
+ }
+ else
+ {
+ Result (C_SUCCESS, S_WCSPBRK, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcsrtombs.c b/test/locale-mbwc/tst_wcsrtombs.c
new file mode 100644
index 0000000..3a8edcc
--- /dev/null
+++ b/test/locale-mbwc/tst_wcsrtombs.c
@@ -0,0 +1,127 @@
+/*
+ WCSRTOMBS: size_t wcsrtombs (char *s, const wchar_t **ws, size_t n,
+ mbstate_t *ps)
+*/
+
+#define TST_FUNCTION wcsrtombs
+
+#include "tsp_common.c"
+#include "dat_wcsrtombs.c"
+
+#define MARK_VAL 0x01
+
+int
+tst_wcsrtombs (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ char s_flg, n;
+ const wchar_t *ws, *wp;
+ char s[MBSSIZE], *s_in;
+ char t_flg, t_ini;
+ static mbstate_t t = { 0 };
+ mbstate_t *pt;
+ int err, i;
+ char *s_ex;
+
+ TST_DO_TEST (wcsrtombs)
+ {
+ TST_HEAD_LOCALE (wcsrtombs, S_WCSRTOMBS);
+ TST_DO_REC (wcsrtombs)
+ {
+ TST_GET_ERRET (wcsrtombs);
+ memset (s, MARK_VAL, MBSSIZE);
+
+ s_flg = TST_INPUT (wcsrtombs).s_flg;
+ s_in = (s_flg == 1) ? s : (char *) NULL;
+ wp = ws = TST_INPUT (wcsrtombs).ws;
+ n = TST_INPUT (wcsrtombs).n;
+ t_flg = TST_INPUT (wcsrtombs).t_flg;
+ t_ini = TST_INPUT (wcsrtombs).t_init;
+ pt = (t_flg == 0) ? NULL : &t;
+
+ if (t_ini != 0)
+ {
+ memset (&t, 0, sizeof (t));
+ }
+
+ TST_CLEAR_ERRNO;
+ ret = wcsrtombs (s_in, &wp, n, pt);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "wcsrtombs: ret = %zu\n", ret);
+ }
+
+ TST_IF_RETURN (S_WCSRTOMBS)
+ {
+ };
+
+ if (s_in != NULL && ret != (size_t) - 1)
+ {
+ /* No definition for s, when error occurs. */
+ s_ex = TST_EXPECT (wcsrtombs).s;
+
+ for (err = 0, i = 0; i <= ret && i < MBSSIZE; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr,
+ " : s[%d] = 0x%hx <-> 0x%hx = s_ex[%d]\n", i,
+ s[i], s_ex[i], i);
+ }
+
+ if (i == ret && ret == n) /* no null termination */
+ {
+ if (s[i] == MARK_VAL)
+ {
+ Result (C_SUCCESS, S_WCSRTOMBS, CASE_4, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSRTOMBS, CASE_4,
+ "should not be null terminated "
+ "(it may be a null char), but it is");
+ }
+
+ break;
+ }
+
+ if (i == ret && ret < n) /* null termination */
+ {
+ if (s[i] == 0)
+ {
+ Result (C_SUCCESS, S_WCSRTOMBS, CASE_5, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSRTOMBS, CASE_5,
+ "should be null terminated, but it is not");
+ }
+
+ break;
+ }
+
+ if (s[i] != s_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSRTOMBS, CASE_6,
+ "converted string is different from an"
+ " expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSRTOMBS, CASE_6, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcsspn.c b/test/locale-mbwc/tst_wcsspn.c
new file mode 100644
index 0000000..02157ee
--- /dev/null
+++ b/test/locale-mbwc/tst_wcsspn.c
@@ -0,0 +1,38 @@
+/*
+ WCSSPN: size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcsspn
+
+#include "tsp_common.c"
+#include "dat_wcsspn.c"
+
+int
+tst_wcsspn (FILE *fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ wchar_t *ws1, *ws2;
+
+ TST_DO_TEST (wcsspn)
+ {
+ TST_HEAD_LOCALE (wcsspn, S_WCSSPN);
+ TST_DO_REC (wcsspn)
+ {
+ TST_GET_ERRET (wcsspn);
+ ws1 = TST_INPUT (wcsspn).ws1;
+ ws2 = TST_INPUT (wcsspn).ws2; /* external value: size WCSSIZE */
+ ret = wcsspn (ws1, ws2);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "wcsspn: ret = %zu\n", ret);
+ }
+
+ TST_IF_RETURN (S_WCSSPN)
+ {
+ };
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcsstr.c b/test/locale-mbwc/tst_wcsstr.c
new file mode 100644
index 0000000..f8b00c4
--- /dev/null
+++ b/test/locale-mbwc/tst_wcsstr.c
@@ -0,0 +1,86 @@
+/*
+ WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcsstr
+
+#include "tsp_common.c"
+#include "dat_wcsstr.c"
+
+int
+tst_wcsstr (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ wchar_t *ws1, *ws2;
+ int err, i;
+
+ TST_DO_TEST (wcsstr)
+ {
+ TST_HEAD_LOCALE (wcsstr, S_WCSSTR);
+ TST_DO_REC (wcsstr)
+ {
+ TST_GET_ERRET (wcsstr);
+ ws1 = TST_INPUT (wcsstr).ws1;
+ ws2 = TST_INPUT (wcsstr).ws2; /* external value: size WCSSIZE */
+ ret = wcsstr (ws1, ws2);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "wcsstr: %d : ret = %s\n", rec + 1,
+ (ret == NULL) ? "null" : "not null");
+ if (ret)
+ {
+ fprintf (stderr,
+ " ret[ 0 ] = 0x%lx <-> 0x%lx = ws2[ 0 ]\n",
+ (unsigned long int) ret[0], (unsigned long int) ws2[0]);
+ }
+ }
+
+ TST_IF_RETURN (S_WCSSTR)
+ {
+ if (ws2[0] == 0)
+ {
+ if (ret == ws1)
+ {
+ Result (C_SUCCESS, S_WCSSTR, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSSTR, CASE_3,
+ "return address is not same address as ws1");
+ }
+
+ continue;
+ }
+
+ for (i = 0, err = 0; *(ws2 + i) != 0 && i < WCSSIZE; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stderr,
+ " : ret[ %d ] = 0x%lx <-> 0x%lx = ws2[ %d ]\n",
+ i, (unsigned long int) ret[i],
+ (unsigned long int) ws2[i], i);
+ }
+
+ if (ret[i] != ws2[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSSTR, CASE_4, "pointed sub-string is "
+ "different from an expected sub-string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSSTR, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcstod.c b/test/locale-mbwc/tst_wcstod.c
new file mode 100644
index 0000000..1648d35
--- /dev/null
+++ b/test/locale-mbwc/tst_wcstod.c
@@ -0,0 +1,69 @@
+/*
+ WCSTOD: double wcstod (wchar_t *np, const wchar_t **endp);
+*/
+
+#define TST_FUNCTION wcstod
+
+#include "tsp_common.c"
+#include "dat_wcstod.c"
+
+int
+tst_wcstod (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (double);
+ wchar_t *np, *endp, fwc;
+ double val;
+
+ TST_DO_TEST (wcstod)
+ {
+ TST_HEAD_LOCALE (wcstod, S_WCSTOD);
+ TST_DO_REC (wcstod)
+ {
+ TST_GET_ERRET (wcstod);
+ np = TST_INPUT (wcstod).np;
+
+ TST_CLEAR_ERRNO;
+ ret = wcstod (np, &endp);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "wcstod() [ %s : %d ] ret = %f\n", locale,
+ rec + 1, ret);
+ fprintf (stdout, " *endp = 0x%lx\n",
+ (unsigned long int) *endp);
+ }
+
+ TST_IF_RETURN (S_WCSTOD)
+ {
+ if (ret != 0)
+ {
+ val = ret - TST_EXPECT (wcstod).val;
+ if (TST_ABS (val) < TST_DBL_EPS)
+ {
+ Result (C_SUCCESS, S_WCSTOD, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSTOD, CASE_3, "return value is wrong");
+ }
+ }
+ }
+
+ fwc = TST_EXPECT (wcstod).fwc;
+
+ if (fwc == *endp)
+ {
+ Result (C_SUCCESS, S_WCSTOD, CASE_4, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSTOD, CASE_4, "a final wc is wrong.");
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcstok.c b/test/locale-mbwc/tst_wcstok.c
new file mode 100644
index 0000000..1222b97
--- /dev/null
+++ b/test/locale-mbwc/tst_wcstok.c
@@ -0,0 +1,96 @@
+/*
+ WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm, wchar_t **pt);
+*/
+
+
+#define TST_FUNCTION wcstok
+
+#include "tsp_common.c"
+#include "dat_wcstok.c"
+
+int
+tst_wcstok (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wchar_t *);
+ char w_flg;
+ wchar_t *ws;
+ wchar_t *dt, *pt;
+ wchar_t *ws_ex;
+ int err, i;
+
+ TST_DO_TEST (wcstok)
+ {
+ TST_HEAD_LOCALE (wcstok, S_WCSTOK);
+ TST_DO_REC (wcstok)
+ {
+ TST_DO_SEQ (WCSTOK_SEQNUM)
+ {
+ TST_GET_ERRET_SEQ (wcstok);
+ w_flg = TST_INPUT_SEQ (wcstok).w_flg;
+ ws = (w_flg) ? TST_INPUT_SEQ (wcstok).ws : NULL;
+ dt = TST_INPUT_SEQ (wcstok).dt;
+
+ ret = wcstok (ws, dt, &pt);
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "wcstok() [ %s : %d : %d ] *ret = 0x%lx\n",
+ locale, rec + 1, seq_num + 1, (unsigned long int) *ret);
+ if (pt && *pt)
+ {
+ fprintf (stdout, " *pt = 0x%lx\n",
+ (unsigned long int) *pt);
+ }
+ }
+
+ TST_IF_RETURN (S_WCSTOK)
+ {
+ };
+
+ if (ret != NULL)
+ {
+ ws_ex = TST_EXPECT_SEQ (wcstok).ws;
+
+ /* XXX: REVISIT : insufficient conditions */
+ for (err = 0, i = 0; i < WCSSIZE; i++)
+ {
+ if (ret[i] == L'\0' && ws_ex[i] == L'\0')
+ {
+ break;
+ }
+
+ if (debug_flg)
+ {
+ fprintf (stderr,
+ " ret[%d] = 0x%lx <-> "
+ "0x%lx = ws_ex[%d]\n",
+ i, (unsigned long int) ret[i],
+ (unsigned long int) ws_ex[i], i);
+ }
+
+ if (ret[i] != ws_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSTOK, CASE_3,
+ "the token is different from an expected string");
+ break;
+ }
+
+ if (ret[i] == L'\0' || ws_ex[i] == L'\0')
+ {
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSTOK, CASE_3, MS_PASSED);
+ }
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcstombs.c b/test/locale-mbwc/tst_wcstombs.c
new file mode 100644
index 0000000..c0851a4
--- /dev/null
+++ b/test/locale-mbwc/tst_wcstombs.c
@@ -0,0 +1,115 @@
+/*
+ WCSTOMBS: size_t wcstombs (char *s, const wchar_t *ws, size_t n)
+*/
+
+#define TST_FUNCTION wcstombs
+
+#include "tsp_common.c"
+#include "dat_wcstombs.c"
+
+#define MARK_VAL 0x01
+
+int
+tst_wcstombs (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ char s_flg, n;
+ wchar_t *ws;
+ char s[MBSSIZE], *s_in;
+ int err, i;
+ char *s_ex;
+
+ TST_DO_TEST (wcstombs)
+ {
+ TST_HEAD_LOCALE (wcstombs, S_WCSTOMBS);
+ TST_DO_REC (wcstombs)
+ {
+ TST_GET_ERRET (wcstombs);
+ memset (s, MARK_VAL, MBSSIZE);
+
+ s_flg = TST_INPUT (wcstombs).s_flg;
+ s_in = (s_flg == 1) ? s : (char *) NULL;
+ ws = TST_INPUT (wcstombs).ws;
+ n = TST_INPUT (wcstombs).n;
+
+ TST_CLEAR_ERRNO;
+ ret = wcstombs (s_in, ws, n);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "wcstombs: ret = %zu\n", ret);
+ }
+
+ TST_IF_RETURN (S_WCSTOMBS)
+ {
+ };
+
+ if (s_in != NULL && ret != (size_t) - 1)
+ {
+ /* No definition for s, when error occurs. */
+ s_ex = TST_EXPECT (wcstombs).s;
+
+ for (err = 0, i = 0; i <= ret && i < MBSSIZE; i++)
+ {
+ if (debug_flg)
+ {
+ fprintf (stdout,
+ " : s[%d] = 0x%hx <-> 0x%hx = s_ex[%d]\n", i,
+ s[i], s_ex[i], i);
+ }
+
+ if (i == ret && ret == n) /* no null termination */
+ {
+ if (s[i] == MARK_VAL)
+ {
+ Result (C_SUCCESS, S_WCSTOMBS, CASE_4, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSTOMBS, CASE_4,
+ "should not be null terminated "
+ "(it may be a null char), but it is");
+ }
+
+ break;
+ }
+
+ if (i == ret && ret < n) /* null termination */
+ {
+ if (s[i] == 0)
+ {
+ Result (C_SUCCESS, S_WCSTOMBS, CASE_5, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSTOMBS, CASE_5,
+ "should be null terminated, but it is not");
+ }
+
+ break;
+ }
+
+ if (s[i] != s_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCSTOMBS, CASE_6,
+ "converted string is different from an "
+ "expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCSTOMBS, CASE_6, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcswidth.c b/test/locale-mbwc/tst_wcswidth.c
new file mode 100644
index 0000000..c836975
--- /dev/null
+++ b/test/locale-mbwc/tst_wcswidth.c
@@ -0,0 +1,39 @@
+/*
+ WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n);
+*/
+
+#define TST_FUNCTION wcswidth
+
+#include "tsp_common.c"
+#include "dat_wcswidth.c"
+
+int
+tst_wcswidth (FILE *fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t *ws;
+ int n;
+
+ TST_DO_TEST (wcswidth)
+ {
+ TST_HEAD_LOCALE (wcswidth, S_WCSWIDTH);
+ TST_DO_REC (wcswidth)
+ {
+ TST_GET_ERRET (wcswidth);
+ ws = TST_INPUT (wcswidth).ws;
+ n = TST_INPUT (wcswidth).n;
+ ret = wcswidth (ws, n);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "wcswidth: [ %d ] : ret = %d\n", rec + 1, ret);
+ }
+
+ TST_IF_RETURN (S_WCSWIDTH)
+ {
+ };
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcsxfrm.c b/test/locale-mbwc/tst_wcsxfrm.c
new file mode 100644
index 0000000..6fb8a1c
--- /dev/null
+++ b/test/locale-mbwc/tst_wcsxfrm.c
@@ -0,0 +1,122 @@
+/*
+ WCSXFRM: size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t n);
+*/
+
+#define TST_FUNCTION wcsxfrm
+
+#include "tsp_common.c"
+#include "dat_wcsxfrm.c"
+
+int
+tst_wcsxfrm (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (size_t);
+ wchar_t *org1, *org2;
+ wchar_t frm1[MBSSIZE], frm2[MBSSIZE];
+ size_t n1, n2;
+ int ret_coll, ret_cmp;
+
+ TST_DO_TEST (wcsxfrm)
+ {
+ TST_HEAD_LOCALE (wcsxfrm, S_WCSXFRM);
+ TST_DO_REC (wcsxfrm)
+ {
+ TST_GET_ERRET (wcsxfrm);
+ org1 = TST_INPUT (wcsxfrm).org1;
+ org2 = TST_INPUT (wcsxfrm).org2;
+ n1 = TST_INPUT (wcsxfrm).n1;
+ n2 = TST_INPUT (wcsxfrm).n2;
+ if (n1 < 0 || sizeof (frm1) < n1 || sizeof (frm2) < n2)
+ {
+ warn_count++;
+ Result (C_IGNORED, S_WCSXFRM, CASE_9,
+ "input data n1 or n2 is invalid");
+ continue;
+ }
+
+ /* an errno and a return value are checked
+ only for 2nd wcsxfrm() call.
+ A result of 1st call is used to compare
+ those 2 values by using wcscmp().
+ */
+
+ TST_CLEAR_ERRNO;
+ ret = wcsxfrm (frm1, org1, n1); /* First call */
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "tst_wcsxfrm() : REC = %d\n", rec + 1);
+ fprintf (stdout, "tst_wcsxfrm() : 1st ret = %zu\n", ret);
+ }
+
+ if (ret == -1 || ret >= n1 || errno_save != 0)
+ {
+ warn_count++;
+ Result (C_INVALID, S_WCSXFRM, CASE_8,
+ "got an error in fist wcsxfrm() call");
+ continue;
+ }
+
+ TST_CLEAR_ERRNO;
+ /* Second call */
+ ret = wcsxfrm (((n2 == 0) ? NULL : frm2), org2, n2);
+ TST_SAVE_ERRNO;
+
+ TST_IF_RETURN (S_WCSXFRM)
+ {
+ };
+
+ if (n2 == 0 || ret >= n2 || errno != 0)
+ {
+#if 0
+ warn_count++;
+ Result (C_IGNORED, S_WCSXFRM, CASE_7, "did not get a result");
+#endif
+ continue;
+ }
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "tst_wcsxfrm() : 2nd ret = %zu\n", ret);
+ }
+
+ /* wcscoll() */
+ TST_CLEAR_ERRNO;
+ /* depends on wcscoll() ... not good though ... */
+ ret_coll = wcscoll (org1, org2);
+ TST_SAVE_ERRNO;
+
+ if (errno != 0) /* bugs * bugs may got correct results ... */
+ {
+ warn_count++;
+ Result (C_INVALID, S_WCSXFRM, CASE_6,
+ "got an error in wcscoll() call");
+ continue;
+ }
+ /* wcscmp() */
+ ret_cmp = wcscmp (frm1, frm2);
+
+ if ((ret_coll == ret_cmp) || (ret_coll > 0 && ret_cmp > 0)
+ || (ret_coll < 0 && ret_cmp < 0))
+ {
+ Result (C_SUCCESS, S_WCSXFRM, CASE_3,
+ MS_PASSED " (depends on wcscoll & wcscmp)");
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCSXFRM, CASE_3,
+ "results from wcscoll & wcscmp() do not match");
+ }
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "tst_wcsxfrm() : coll = %d <-> %d = cmp\n",
+ ret_coll, ret_cmp);
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wctob.c b/test/locale-mbwc/tst_wctob.c
new file mode 100644
index 0000000..2377daf
--- /dev/null
+++ b/test/locale-mbwc/tst_wctob.c
@@ -0,0 +1,37 @@
+/*-------------------------------------------------------------------------------------*/
+/* WCTOB: int wctob( wint_t wc ) */
+/*-------------------------------------------------------------------------------------*/
+
+#define TST_FUNCTION wctob
+
+#include "tsp_common.c"
+#include "dat_wctob.c"
+
+int
+tst_wctob (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t wc;
+
+ TST_DO_TEST (wctob)
+ {
+ TST_HEAD_LOCALE (wctob, S_WCTOB);
+ TST_DO_REC (wctob)
+ {
+ TST_GET_ERRET (wctob);
+ wc = TST_INPUT (wctob).wc;
+ ret = wctob (wc);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "tst_wctob : [ %d ] ret = %d\n", rec + 1, ret);
+ }
+
+ TST_IF_RETURN (S_WCTOB)
+ {
+ };
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wctomb.c b/test/locale-mbwc/tst_wctomb.c
new file mode 100644
index 0000000..aea89fe
--- /dev/null
+++ b/test/locale-mbwc/tst_wctomb.c
@@ -0,0 +1,99 @@
+/*
+ WCTOMB: int wctomb (char *s, wchar_t wc)
+*/
+
+#define TST_FUNCTION wctomb
+
+#include "tsp_common.c"
+#include "dat_wctomb.c"
+
+int
+tst_wctomb (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t wc;
+ char s[MBSSIZE], *s_in, *s_ex;
+ int err, i;
+
+ TST_DO_TEST (wctomb)
+ {
+ TST_HEAD_LOCALE (wctomb, S_WCTOMB);
+ TST_DO_REC (wctomb)
+ {
+ TST_GET_ERRET (wctomb);
+ wc = TST_INPUT (wctomb).wc;
+ s_in = ((TST_INPUT (wctomb).s_flg) == 0) ? (char *) NULL : s;
+ ret = wctomb (s_in, wc);
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "wctomb() [ %s : %d ] ret = %d\n", locale,
+ rec + 1, ret);
+ }
+
+ TST_IF_RETURN (S_WCTOMB)
+ {
+ if (s_in == NULL) /* state dependency */
+ {
+ if (ret_exp == +1) /* state-dependent */
+ {
+ if (ret != 0)
+ {
+ /* Non-zero means state-dependent encoding. */
+ Result (C_SUCCESS, S_WCTOMB, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCTOMB, CASE_3,
+ "should be state-dependent encoding, "
+ "but a return value shows it is "
+ "state-independent");
+ }
+ }
+
+ if (ret_exp == 0) /* state-independent */
+ {
+ if (ret == 0)
+ {
+ /* Non-zero means state-dependent encoding. */
+ Result (C_SUCCESS, S_WCTOMB, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCTOMB, CASE_3,
+ "should be state-independent encoding, "
+ "but a return value shows it is state-dependent");
+ }
+ }
+ }
+ }
+
+ s_ex = TST_EXPECT (wctomb).s;
+
+ if (s_in)
+ {
+ for (i = 0, err = 0; *(s_ex + i) != 0 && i < MBSSIZE; i++)
+ {
+ if (s_in[i] != s_ex[i])
+ {
+ err++;
+ err_count++;
+ Result (C_FAILURE, S_WCTOMB, CASE_4,
+ "copied string is different from an"
+ " expected string");
+ break;
+ }
+ }
+
+ if (!err)
+ {
+ Result (C_SUCCESS, S_WCTOMB, CASE_4, MS_PASSED);
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wctrans.c b/test/locale-mbwc/tst_wctrans.c
new file mode 100644
index 0000000..b422d6f
--- /dev/null
+++ b/test/locale-mbwc/tst_wctrans.c
@@ -0,0 +1,52 @@
+/*
+ WCTRANS: wctrans_t wctrans (const char *charclass);
+*/
+
+#define TST_FUNCTION wctrans
+
+#include "tsp_common.c"
+#include "dat_wctrans.c"
+
+int
+tst_wctrans (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wctrans_t);
+ char *class;
+
+ TST_DO_TEST (wctrans)
+ {
+ TST_HEAD_LOCALE (wctrans, S_WCTRANS);
+ TST_DO_REC (wctrans)
+ {
+ TST_GET_ERRET (wctrans);
+ class = TST_INPUT (wctrans).class;
+
+ TST_CLEAR_ERRNO;
+ ret = wctrans (class);
+ TST_SAVE_ERRNO;
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "tst_wctrans : [ %d ] ret = %ld\n", rec + 1,
+ (long int) ret);
+ fprintf (stderr, " errno = %d\n", errno_save);
+ }
+
+ TST_IF_RETURN (S_WCTRANS)
+ {
+ if (ret != 0)
+ {
+ Result (C_SUCCESS, S_WCTYPE, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCTYPE, CASE_3,
+ "should return non-0, but returned 0");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wctype.c b/test/locale-mbwc/tst_wctype.c
new file mode 100644
index 0000000..a203e49
--- /dev/null
+++ b/test/locale-mbwc/tst_wctype.c
@@ -0,0 +1,48 @@
+/*
+ WCTYPE: wctype_t wctype (const char *class);
+*/
+
+
+#define TST_FUNCTION wctype
+
+#include "tsp_common.c"
+#include "dat_wctype.c"
+
+int
+tst_wctype (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (wctype_t);
+ char *class;
+
+ TST_DO_TEST (wctype)
+ {
+ TST_HEAD_LOCALE (wctype, S_WCTYPE);
+ TST_DO_REC (wctype)
+ {
+ TST_GET_ERRET (wctype);
+ class = TST_INPUT (wctype).class;
+ ret = wctype (class);
+
+ if (debug_flg)
+ {
+ fprintf (stderr, "tst_wctype : [ %d ] ret = %ld\n", rec + 1, ret);
+ }
+
+ TST_IF_RETURN (S_WCTYPE)
+ {
+ if (ret != 0)
+ {
+ Result (C_SUCCESS, S_WCTYPE, CASE_3, MS_PASSED);
+ }
+ else
+ {
+ err_count++;
+ Result (C_FAILURE, S_WCTYPE, CASE_3,
+ "should return non-0, but returned 0");
+ }
+ }
+ }
+ }
+
+ return err_count;
+}
diff --git a/test/locale-mbwc/tst_wcwidth.c b/test/locale-mbwc/tst_wcwidth.c
new file mode 100644
index 0000000..6a5af6f
--- /dev/null
+++ b/test/locale-mbwc/tst_wcwidth.c
@@ -0,0 +1,38 @@
+/*
+ WCWIDTH: int wcwidth (wchar_t wc);
+*/
+
+#define TST_FUNCTION wcwidth
+
+#include "tsp_common.c"
+#include "dat_wcwidth.c"
+
+int
+tst_wcwidth (FILE * fp, int debug_flg)
+{
+ TST_DECL_VARS (int);
+ wchar_t wc;
+
+ TST_DO_TEST (wcwidth)
+ {
+ TST_HEAD_LOCALE (wcwidth, S_WCWIDTH);
+ TST_DO_REC (wcwidth)
+ {
+ TST_GET_ERRET (wcwidth);
+ wc = TST_INPUT (wcwidth).wc;
+ ret = wcwidth (wc);
+
+ if (debug_flg)
+ {
+ fprintf (stdout, "wcwidth() [ %s : %d ] ret = %d\n", locale,
+ rec + 1, ret);
+ }
+
+ TST_IF_RETURN (S_WCWIDTH)
+ {
+ }
+ }
+ }
+
+ return err_count;
+}