diff options
author | Andreas Jaeger <aj@suse.de> | 2000-06-27 12:14:09 +0000 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2000-06-27 12:14:09 +0000 |
commit | 5b905722f66719de502ecd6129ef9a1bda4f9f47 (patch) | |
tree | e74e131343a6427f807f151abcabcce2c62f94ee | |
parent | 756bb30555774e22121790fd6eb3dcf2ca4ed29e (diff) | |
download | glibc-5b905722f66719de502ecd6129ef9a1bda4f9f47.tar.gz glibc-5b905722f66719de502ecd6129ef9a1bda4f9f47.tar.xz glibc-5b905722f66719de502ecd6129ef9a1bda4f9f47.zip |
* Makefile (tests): Add tests from tests-mbwc subdirectory,
comment them out for now. (subdir-dirs): New for tests-mbwc, add also vpaths. * Makefile (tests): Add tests from tests-mbwc subdirectory, comment them out for now. (subdir-dirs): New for tests-mbwc, add also vpaths.
61 files changed, 5607 insertions, 0 deletions
diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 8e333dc10e..2f78a45a74 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,5 +1,9 @@ 2000-06-27 Andreas Jaeger <aj@suse.de> + * Makefile (tests): Add tests from tests-mbwc subdirectory, + comment them out for now. + (subdir-dirs): New for tests-mbwc, add also vpaths. + * locales/ja_JP: Add missing / in LC_CTYPE. 2000-06-26 Ulrich Drepper <drepper@redhat.com> diff --git a/localedata/Makefile b/localedata/Makefile index f713ab616e..bf17ed7a1f 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -35,6 +35,19 @@ locales := $(filter-out $(addprefix locales/, CVS RCS SCCS %~), \ repertoiremaps := $(filter-out $(addprefix repertoiremaps/, CVS RCS SCCS %~), \ $(wildcard repertoiremaps/*)) +# Disable the tests for now - first the locales have to be generated +#tests := tst_iswalnum tst_iswprint tst_towctrans tst_wcsncmp tst_wctrans \ +# tst_iswalpha tst_iswpunct tst_wcschr tst_wcspbrk tst_wctype \ +# tst_iswcntrl tst_iswspace tst_wcscoll tst_wcsspn tst_iswdigit \ +# tst_iswupper tst_wcscpy tst_wcsstr tst_iswgraph tst_iswxdigit \ +# tst_wcscspn tst_wcswidth tst_iswlower tst_swscanf tst_wcslen \ +# tst_wctob + +subdir-dirs = tests-mbwc +vpath %.c tests-mbwc +vpath %.h tests-mbwc + + test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \ tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \ tst-ctype @@ -122,3 +135,20 @@ install-locales: -u repertoiremaps/mnemonic.ds \ $(inst_localedir)/$$locale; \ done < SUPPORTED + +tst_iswcntrl-ENV=LOCPATH=$(common-objpfx)/localedata +tst_iswspace-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wcscoll-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wcsspn-ENV=LOCPATH=$(common-objpfx)/localedata +tst_iswdigit-ENV=LOCPATH=$(common-objpfx)/localedata +tst_iswupper-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wcscpy-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wcsstr-ENV=LOCPATH=$(common-objpfx)/localedata +tst_iswgraph-ENV=LOCPATH=$(common-objpfx)/localedata +tst_iswxdigit-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wcscspn-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wcswidth-ENV=LOCPATH=$(common-objpfx)/localedata +tst_iswlower-ENV=LOCPATH=$(common-objpfx)/localedata +tst_swscanf-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wcslen-ENV=LOCPATH=$(common-objpfx)/localedata +tst_wctob-ENV=LOCPATH=$(common-objpfx)/localedata diff --git a/localedata/tests-mbwc/dat_isw-funcs.h b/localedata/tests-mbwc/dat_isw-funcs.h new file mode 100644 index 0000000000..2c86556ddb --- /dev/null +++ b/localedata/tests-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,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/localedata/tests-mbwc/dat_iswalnum.c b/localedata/tests-mbwc/dat_iswalnum.c new file mode 100644 index 0000000000..f3bcd3361b --- /dev/null +++ b/localedata/tests-mbwc/dat_iswalnum.c @@ -0,0 +1,121 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,0,0 } }, /* y dia */ + { is_last: 1 } /* last element */ + } + }, + { TST_ISW_REC (enUS, alnum) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,0,0 } }, + { { 0x0039 }, { 0,0,0,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,0,0 } }, + { { 0x005A }, { 0,0,0,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,0,0 } }, + { { 0x007A }, { 0,0,0,0 } }, + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, + { is_last: 1 } /* last element */ + } + }, + { TST_ISW_REC (eucJP, alnum) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB }, { 0,0,1,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F }, { 0,0,1,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,1,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,1,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,1,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* last element */ + } + }, + { TST_ISW_REC (end, alnum) } +}; diff --git a/localedata/tests-mbwc/dat_iswalpha.c b/localedata/tests-mbwc/dat_iswalpha.c new file mode 100644 index 0000000000..d219111561 --- /dev/null +++ b/localedata/tests-mbwc/dat_iswalpha.c @@ -0,0 +1,121 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,0,0 } }, /* y dia */ + { is_last: 1 } /* last element */ + } + }, + { TST_ISW_REC (enUS, alpha) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,1,0 } }, + { { 0x0039 }, { 0,0,1,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,0,0 } }, + { { 0x005A }, { 0,0,0,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,0,0 } }, + { { 0x007A }, { 0,0,0,0 } }, + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, /* 20 */ + { is_last: 1 } /* last element */ + } + }, + { TST_ISW_REC (eucJP, alpha) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB }, { 0,0,1,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F }, { 0,0,1,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,1,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,1,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,1,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* last element */ + } + }, + { TST_ISW_REC (end, alpha) } +}; diff --git a/localedata/tests-mbwc/dat_iswcntrl.c b/localedata/tests-mbwc/dat_iswcntrl.c new file mode 100644 index 0000000000..89d5021916 --- /dev/null +++ b/localedata/tests-mbwc/dat_iswcntrl.c @@ -0,0 +1,121 @@ +/* + * 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,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,0,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,1,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,1,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,1,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,1,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,1,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,1,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (enUS, cntrl) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,0,0 } }, + { { 0x001F }, { 0,0,0,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,1,0 } }, + { { 0x0039 }, { 0,0,1,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,1,0 } }, + { { 0x005A }, { 0,0,1,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,1,0 } }, + { { 0x007A }, { 0,0,1,0 } }, + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,0,0 } }, + { { 0x0080 }, { 0,0,0,0 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (eucJP, cntrl) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB }, { 0,0,1,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F }, { 0,0,1,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,1,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,1,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,1,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,1,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,1,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC(end, cntrl) } +}; diff --git a/localedata/tests-mbwc/dat_iswdigit.c b/localedata/tests-mbwc/dat_iswdigit.c new file mode 100644 index 0000000000..3edf47957c --- /dev/null +++ b/localedata/tests-mbwc/dat_iswdigit.c @@ -0,0 +1,121 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,1,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,1,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,1,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,1,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,1,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,1,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (enUS, digit) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,0,0 } }, + { { 0x0039 }, { 0,0,0,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,1,0 } }, + { { 0x005A }, { 0,0,1,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,1,0 } }, + { { 0x007A }, { 0,0,1,0 } }, + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (eucJP, digit) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB }, { 0,0,1,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F }, { 0,0,1,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,1,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,1,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,1,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,1,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,1,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (end, digit) } +}; diff --git a/localedata/tests-mbwc/dat_iswgraph.c b/localedata/tests-mbwc/dat_iswgraph.c new file mode 100644 index 0000000000..f573088393 --- /dev/null +++ b/localedata/tests-mbwc/dat_iswgraph.c @@ -0,0 +1,121 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,0,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,0,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,0,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,0,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,0,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,0,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,0,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,0,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,0,0 } }, /* >> */ + { { 0x00BC }, { 0,0,0,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,0,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,0,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,0,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,0,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,0,0 } }, /* division */ + { { 0x00F8 }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,0,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (enUS, graph) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,0,0 } }, + { { 0x002F }, { 0,0,0,0 } }, + { { 0x0030 }, { 0,0,0,0 } }, + { { 0x0039 }, { 0,0,0,0 } }, + { { 0x003A }, { 0,0,0,0 } }, + { { 0x0040 }, { 0,0,0,0 } }, + { { 0x0041 }, { 0,0,0,0 } }, + { { 0x005A }, { 0,0,0,0 } }, + { { 0x005B }, { 0,0,0,0 } }, + { { 0x0060 }, { 0,0,0,0 } }, + { { 0x0061 }, { 0,0,0,0 } }, + { { 0x007A }, { 0,0,0,0 } }, + { { 0x007B }, { 0,0,0,0 } }, + { { 0x007E }, { 0,0,0,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, /* 20 */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC( eucJP, graph ) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,0,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ /* non jis */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,0,0 } }, /* ITERATION MARK */ /* 10 */ + { { 0x30A1 }, { 0,0,0,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ /* non jis */ + { { 0x30FB }, { 0,0,0,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,0,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ /* 20 */ + { { 0x4E05 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK Wave Low Line */ /* 30 */ + { { 0xFF0F }, { 0,0,0,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,0,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,0,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,0,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,0,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,0,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,0,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,0,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,0,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,0,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,0,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (end, graph) } +}; diff --git a/localedata/tests-mbwc/dat_iswlower.c b/localedata/tests-mbwc/dat_iswlower.c new file mode 100644 index 0000000000..8cd401d28e --- /dev/null +++ b/localedata/tests-mbwc/dat_iswlower.c @@ -0,0 +1,92 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,1,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,1,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,0,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (enUS, lower) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,1,0 } }, + { { 0x0039 }, { 0,0,1,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,1,0 } }, + { { 0x005A }, { 0,0,1,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,0,0 } }, + { { 0x007A }, { 0,0,0,0 } }, + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (eucJP, lower) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0xFF3A }, { 0,0,1,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (end, lower) } + +}; diff --git a/localedata/tests-mbwc/dat_iswprint.c b/localedata/tests-mbwc/dat_iswprint.c new file mode 100644 index 0000000000..47fa4167da --- /dev/null +++ b/localedata/tests-mbwc/dat_iswprint.c @@ -0,0 +1,123 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,0,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,0,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,0,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,0,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,0,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,0,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,0,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,0,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,0,0 } }, /* >> */ + { { 0x00BC }, { 0,0,0,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,0,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,0,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,0,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,0,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,0,0 } }, /* division */ + { { 0x00F8 }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,0,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (enUS, print) + { + { { WEOF }, { 0,0,1,0 } }, /* 01 */ + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,0,0 } }, + { { 0x0021 }, { 0,0,0,0 } }, + { { 0x002F }, { 0,0,0,0 } }, + { { 0x0030 }, { 0,0,0,0 } }, + { { 0x0039 }, { 0,0,0,0 } }, + { { 0x003A }, { 0,0,0,0 } }, + { { 0x0040 }, { 0,0,0,0 } }, + { { 0x0041 }, { 0,0,0,0 } }, + { { 0x005A }, { 0,0,0,0 } }, + { { 0x005B }, { 0,0,0,0 } }, + { { 0x0060 }, { 0,0,0,0 } }, + { { 0x0061 }, { 0,0,0,0 } }, + { { 0x007A }, { 0,0,0,0 } }, + { { 0x007B }, { 0,0,0,0 } }, + { { 0x007E }, { 0,0,0,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, /* 20 */ + { { 0x3042 }, { 0,0,1,0 } }, /* <WAIVER> */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (eucJP, print) + { + { { 0x3000 }, { 0,0,0,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,0,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ /* non jis */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,0,0 } }, /* ITERATION MARK */ /* 10 */ + { { 0x30A1 }, { 0,0,0,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ /* non jis */ + { { 0x30FB }, { 0,0,0,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,0,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ /* 20 */ + { { 0x4E05 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* WAVE LOW LINE */ /* 30 */ + { { 0xFF0F }, { 0,0,0,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,0,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,0,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,0,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,0,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,0,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,0,0 } }, /* HALF KATA WO */ /* 40 */ + { { 0xFF6F }, { 0,0,0,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,0,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,0,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,0,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (end, print) } +}; + diff --git a/localedata/tests-mbwc/dat_iswpunct.c b/localedata/tests-mbwc/dat_iswpunct.c new file mode 100644 index 0000000000..0b37a4b10a --- /dev/null +++ b/localedata/tests-mbwc/dat_iswpunct.c @@ -0,0 +1,121 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,0,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,0,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,0,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,0,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,0,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,0,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,0,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,0,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,0,0 } }, /* >> */ + { { 0x00BC }, { 0,0,0,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,0,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,0,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,0,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,1,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,0,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,1,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,1,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,1,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,0,0 } }, /* division */ + { { 0x00F8 }, { 0,0,1,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,1,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (enUS, punct) + { + { { WEOF }, { 0,0,1,0 } }, /* 01 */ + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,0,0 } }, + { { 0x002F }, { 0,0,0,0 } }, + { { 0x0030 }, { 0,0,1,0 } }, + { { 0x0039 }, { 0,0,1,0 } }, + { { 0x003A }, { 0,0,0,0 } }, + { { 0x0040 }, { 0,0,0,0 } }, + { { 0x0041 }, { 0,0,1,0 } }, + { { 0x005A }, { 0,0,1,0 } }, + { { 0x005B }, { 0,0,0,0 } }, + { { 0x0060 }, { 0,0,0,0 } }, + { { 0x0061 }, { 0,0,1,0 } }, + { { 0x007A }, { 0,0,1,0 } }, + { { 0x007B }, { 0,0,0,0 } }, + { { 0x007E }, { 0,0,0,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, /* 20 */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (eucJP, punct) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ /* 10 */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB }, { 0,0,0,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ /* 20 */ + { { 0x4E05 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ /* 30 */ + { { 0xFF0F }, { 0,0,0,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,0,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,1,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,0,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,1,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,0,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,0,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,0,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ /* 40 */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (end, punct) } +}; diff --git a/localedata/tests-mbwc/dat_iswspace.c b/localedata/tests-mbwc/dat_iswspace.c new file mode 100644 index 0000000000..3e5a992b4f --- /dev/null +++ b/localedata/tests-mbwc/dat_iswspace.c @@ -0,0 +1,125 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,0,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,1,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,1,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,1,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,1,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,1,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,1,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (enUS, space) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x0008 }, { 0,0,1,0 } }, + { { 0x0009 }, { 0,0,0,0 } }, + { { 0x000D }, { 0,0,0,0 } }, + { { 0x000E }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,0,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,1,0 } }, + { { 0x0039 }, { 0,0,1,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,1,0 } }, + { { 0x005A }, { 0,0,1,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,1,0 } }, + { { 0x007A }, { 0,0,1,0 } }, /* 20 */ + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (eucJP, space) + { + { { 0x3000 }, { 0,0,0,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ /* No JIS */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB }, { 0,0,1,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F }, { 0,0,1,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,1,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,1,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,1,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,1,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,1,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (end, space) } +}; diff --git a/localedata/tests-mbwc/dat_iswupper.c b/localedata/tests-mbwc/dat_iswupper.c new file mode 100644 index 0000000000..d83e7bc0df --- /dev/null +++ b/localedata/tests-mbwc/dat_iswupper.c @@ -0,0 +1,90 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,1,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,1,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,1,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,1,0 } }, /* y dia */ + { is_last: 1 } /* Last entry. */ + } + }, + { TST_ISW_REC (enUS, upper) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,1,0 } }, + { { 0x0039 }, { 0,0,1,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,0,0 } }, + { { 0x005A }, { 0,0,0,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,1,0 } }, + { { 0x007A }, { 0,0,1,0 } }, + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, + { is_last: 1 } /* Last entry. */ + } + }, + { TST_ISW_REC (eucJP, upper) + { + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0xFF19 }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,1,0 } }, /* FULL z */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last entry. */ + } + }, + { TST_ISW_REC (end, upper) } +}; diff --git a/localedata/tests-mbwc/dat_iswxdigit.c b/localedata/tests-mbwc/dat_iswxdigit.c new file mode 100644 index 0000000000..787bfb7829 --- /dev/null +++ b/localedata/tests-mbwc/dat_iswxdigit.c @@ -0,0 +1,121 @@ +/* + * 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,0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,1,0 } }, /* O dia */ + { { 0x00D7 }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,1,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,1,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,1,0 } }, /* o dia */ + { { 0x00F7 }, { 0,0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,1,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,1,0 } }, /* y dia */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC( enUS, xdigit ) + { + { { WEOF }, { 0,0,1,0 } }, + { { 0x0000 }, { 0,0,1,0 } }, + { { 0x001F }, { 0,0,1,0 } }, + { { 0x0020 }, { 0,0,1,0 } }, + { { 0x0021 }, { 0,0,1,0 } }, + { { 0x002F }, { 0,0,1,0 } }, + { { 0x0030 }, { 0,0,0,0 } }, + { { 0x0039 }, { 0,0,0,0 } }, + { { 0x003A }, { 0,0,1,0 } }, + { { 0x0040 }, { 0,0,1,0 } }, + { { 0x0041 }, { 0,0,0,0 } }, + { { 0x005A }, { 0,0,1,0 } }, + { { 0x005B }, { 0,0,1,0 } }, + { { 0x0060 }, { 0,0,1,0 } }, + { { 0x0061 }, { 0,0,0,0 } }, + { { 0x007A }, { 0,0,1,0 } }, + { { 0x007B }, { 0,0,1,0 } }, + { { 0x007E }, { 0,0,1,0 } }, + { { 0x007F }, { 0,0,1,0 } }, + { { 0x0080 }, { 0,0,1,0 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC( eucJP, xdigit ) + { + { { 0x3000 }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020 }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029 }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037 }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041 }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094 }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x3099 }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1 }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB }, { 0,0,1,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191 }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243 }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4 }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5 }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFE4F }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F }, { 0,0,1,0 } }, /* FULL SLASH */ + { { 0xFF19 }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20 }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A }, { 0,0,1,0 } }, /* FULL Z */ + { { 0xFF40 }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A }, { 0,0,1,0 } }, /* FULL z */ + { { 0xFF5E }, { 0,0,1,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61 }, { 0,0,1,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65 }, { 0,0,1,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66 }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70 }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF71 }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E }, { 0,0,1,0 } }, /* HALF KATA MI */ + { is_last: 1 } /* Last element. */ + } + }, + { TST_ISW_REC (end, xdigit) } +}; diff --git a/localedata/tests-mbwc/dat_swscanf.c b/localedata/tests-mbwc/dat_swscanf.c new file mode 100644 index 0000000000..24274401ba --- /dev/null +++ b/localedata/tests-mbwc/dat_swscanf.c @@ -0,0 +1,171 @@ +/* + * 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 + }, + { 1,0,1,5, + -1, 2, 3.3, 'ä', "ÄÜ", { 0x0000, }, + }, + }, + /*------------------------ 02 -----------------------*/ + /* <NO_WAIVER> x 2 */ + { { { + 0x00E4, 0x00C4, 0x0000 /* "äÄ" */ + }, + L"%lc", 'C' + }, + { 1,0,1,1, + 0,0,0,0,"", { 0x00E4, 0x0000 }, + }, + }, + /*------------------------ 03 -----------------------*/ + { { { + 0x00E4, 0x00C4, 0x0000 /* "äÄ" */ + }, + L"%ls", 'S' + }, + { 1,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 + }, + { 1,EINVAL,1,EOF, + 0,0,0,0,"", { 0x0000 }, + }, + }, + /*---------------------------------------------------*/ + { 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 + }, + { 1,0,1,5, + -1, 2, 5.43, 'A', "ab", { 0x0000 }, + }, + }, + /*------------------------ 02 -----------------------*/ + /* <NO_WAIVER> x 2 */ + { { { + 0x0063, 0x0064, 0x0000 + }, + L"%C", 'C' + }, + { 1,0,1,1, + 0,0,0,0,"", { 0x0063, 0x0000 }, + }, + }, + /*------------------------ 03 -----------------------*/ + { { { + 0x0063, 0x0064, 0x0000 + }, + L"%S", 'S' + }, + { 1,0,1,1, + 0,0,0,0,"", { 0x0063, 0x0064, 0x0000 }, + }, + }, + /*---------------------------------------------------*/ + { is_last: 1} /* Last element. */ + } + }, + { + { Tswscanf, TST_LOC_eucJP }, + { + /*------------------------ 01 -----------------------*/ + { { { 0x002D, 0x0031, 0x003A, + 0x0032, 0x003A, + 0x0033, 0x002E, 0x0033, 0x003A, + 0x0062, 0x003A, + 0x0061, 0x0062, 0x0000, 0x0000, + }, + L"%d:%u:%f:%c:%s", 0 + }, + { 1,0,1,5, + -1, 2, 3.3, 'b', "ab", { 0x0000 } + }, + }, + /*------------------------ 02 -----------------------*/ + { { { + 0x30A2, 0x30A4, 0x0000 + }, + L"%ls", 'S' + }, + { 1,0,1,1, + 0,0,0,0,"", { 0x30A2, 0x30A4, 0x0000 } + }, + }, + /*------------------------ 03 -----------------------*/ + /* <NO_WAIVER> */ + { { { + 0x0031, 0x003A, + 0x0030, 0x003A, + 0x0033, 0x002E, 0x0039, 0x003A, + 0x0061, 0x003A, + 0x0063, 0x0064, 0x0000, 0x0000, + }, + L"%2$d:%1$u:%f:%c:%s", 0 + }, + { 1,0,1,5, + 0, 1, 3.9, 'a', "cd", { 0x0000 } + }, + }, + /*------------------------ 04 -----------------------*/ + /* <NO_WAIVER> x 2 */ + { { { + 0x30A2, 0x30A4, 0x0001, 0x0000 + }, + { 0x0001,0x0002,0x0025,0x0053,0x0000 }, 'S' + }, + { 1,EILSEQ,1,EOF, + 0,0,0,0,"", { 0x0000 } + }, + }, + /*---------------------------------------------------*/ + { is_last: 1} /* Last element. */ + } + }, + { + { Tswscanf, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_tow-funcs.h b/localedata/tests-mbwc/dat_tow-funcs.h new file mode 100644 index 0000000000..44564374ce --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/dat_towctrans.c b/localedata/tests-mbwc/dat_towctrans.c new file mode 100644 index 0000000000..0baeb9bb09 --- /dev/null +++ b/localedata/tests-mbwc/dat_towctrans.c @@ -0,0 +1,71 @@ +/* + * 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_de }, + { + { { 0x0010, "tojkata" }, { 1,EINVAL,1,0x0010 } }, + { { 0x0080, "tolower" }, { 1,0, 1,0x0080 } }, + { { 0x00EC, "toupper" }, { 1,0, 1,0x00CC } }, + { { 0x00CC, "tolower" }, { 1,0, 1,0x00EC } }, + { is_last: 1 } + } + }, + { + { Ttowctrans, TST_LOC_enUS }, + { + { { 0x0010, "xxxxxxx" }, { 1,EINVAL,1,0x0010 } }, + { { 0x007F, "tolower" }, { 1,0, 1,0x007F } }, + { { 0x0061, "toupper" }, { 1,0, 1,0x0041 } }, + { { 0x0041, "tolower" }, { 1,0, 1,0x0061 } }, + { is_last: 1 } + } + }, + { + { Ttowctrans, TST_LOC_eucJP }, + { + { { 0xFF21, "tolower" }, { 1,0, 1,0xFF41 } }, + { { 0xFF41, "toupper" }, { 1,0, 1,0xFF21 } }, + { { 0x30A1, "tojhira" }, { 1,0, 1,0x3041 } }, + { { 0x3041, "tojkata" }, { 1,0, 1,0x30A1 } }, + { is_last: 1 } + } + }, + { + { Ttowctrans, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wcschr.c b/localedata/tests-mbwc/dat_wcschr.c new file mode 100644 index 0000000000..c8d616ae21 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcschr.c @@ -0,0 +1,90 @@ +/* + * 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,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C1 }, /* #2 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C2 }, /* #3 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C3 }, /* #4 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x0000 }, /* #5 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0000,0x00C2,0x00C3,0x0000 }, 0x00C1 }, /* #6 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0000,0x00C2,0x00C3,0x0000 }, 0x0000 }, /* #7 */ + /*expect*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { { Twcschr, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0040 }, /* #1 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0041 }, /* #2 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0042 }, /* #3 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0043 }, /* #4 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0000 }, /* #5 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, 0x0041 }, /* #6 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, 0x0000 }, /* #7 */ + /*expect*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { { Twcschr, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3040 }, /* #1 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3041 }, /* #2 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3042 }, /* #3 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3043 }, /* #4 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x0000 }, /* #5 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, 0x3041 }, /* #6 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, 0x0000 }, /* #7 */ + /*expect*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { { Twcschr, TST_LOC_end } } +}; diff --git a/localedata/tests-mbwc/dat_wcscoll.c b/localedata/tests-mbwc/dat_wcscoll.c new file mode 100644 index 0000000000..d087fc6344 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcscoll.c @@ -0,0 +1,182 @@ +/* + * 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_flg=1. + * 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_flg err_val ret_flg ret_val cmp_flg + * ---------------------------------------------------- + * a) 0 0 1 0 0 + * b) 0 0 0 0 +1 + * c) 0 0 0 0 -1 + * d) 1 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,0,1,0, 0, }, + }, + { /*input.*/ { { 0x0000,0x00E1,0x00E3,0x0000 }, + { 0x0000,0x00E2,0x00E3,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,0, 0, }, + }, + { /*input.*/ { { 0x00E1,0x00E1,0x00E3,0x0000 }, + { 0x0000,0x00E2,0x00E3,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x0000,0x00E2,0x00E3,0x0000 }, + { 0x00E1,0x00E1,0x00E3,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x00E1,0x0042,0x00E3,0x0000 }, + { 0x00E1,0x0061,0x00E3,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x00E1,0x0061,0x00E3,0x0000 }, + { 0x00E1,0x0042,0x00E3,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x00E1,0x00E2,0x0000 }, + { 0x00E1,0x00E2,0x00E9,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x00E1,0x00E2,0x00E9,0x0000 }, + { 0x00E1,0x00E2,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x00E1,0x0092,0x00E9,0x0000 }, + { 0x00E1,0x008E,0x00E9,0x0000 }, }, /* #9 */ + /*expect*/ { 1,0,0,0, +1, }, + }, + { /*input.*/ { { 0x00E1,0x008E,0x00E9,0x0000 }, + { 0x00E1,0x0092,0x00E9,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { is_last: 1 } + } + }, + { { Twcscoll, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,0, 0, }, + }, + { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 }, + { 0x0000,0x0042,0x0043,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,0, 0, }, + }, + { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 }, + { 0x0000,0x0042,0x0043,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0041,0x0041,0x0043,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + /* <WAIVER> */ /* assume ascii */ + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0061,0x0043,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + /* <WAIVER> */ /* assume ascii */ + { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0000 }, + { 0x0041,0x0042,0x0049,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 }, + { 0x0041,0x0042,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 }, + { 0x0041,0x008E,0x0049,0x0000 }, }, /* #9 */ + /*expect*/ { 1,0,0,0, +1, }, + }, + { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 }, + { 0x0041,0x0092,0x0049,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { is_last: 1 } + } + }, + { { Twcscoll, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,0, 0, }, + }, + { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 }, + { 0x0000,0x3042,0x3043,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,0, 0, }, + }, + { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 }, + { 0x0000,0x3042,0x3043,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x3041,0x3041,0x3043,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x3041,0x0042,0x3043,0x0000 }, + { 0x3041,0x0061,0x3043,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x3041,0x0061,0x3043,0x0000 }, + { 0x3041,0x0042,0x3043,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x3041,0x3042,0xFF71,0x0000 }, + { 0x3041,0x3042,0x30A2,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x30A2,0x0000 }, + { 0x3041,0x3042,0xFF71,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x30FF,0x3092,0x3049,0x0000 }, + { 0x3041,0x308E,0x3049,0x0000 }, }, /* #9 */ + /*expect*/ { 0,0,0,0, -1, }, + }, + { /*input.*/ { { 0x3041,0x308E,0x3049,0x0000 }, + { 0x30FF,0x3092,0x3049,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { is_last: 1 } + } + }, + { { Twcscoll, TST_LOC_end } } +}; diff --git a/localedata/tests-mbwc/dat_wcscpy.c b/localedata/tests-mbwc/dat_wcscpy.c new file mode 100644 index 0000000000..94e41754ca --- /dev/null +++ b/localedata/tests-mbwc/dat_wcscpy.c @@ -0,0 +1,40 @@ +/* + * 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,0, { 0x00F1,0x00F2,0x00F3,0x0000, } }, }, + { { { 0x0000,0x00F2,0x00F3,0x0000 }, }, /* 2 */ + { 0,0,0,0, { 0x0000, } }, }, + { is_last: 1 } + } + }, + { { Twcscpy, TST_LOC_enUS }, + { + { { { 0x0041,0x0082,0x0043,0x0000 }, }, /* 1 */ + { 0,0,0,0, { 0x0041,0x0082,0x0043,0x0000, } }, }, + { { { 0x0000,0x0082,0x0043,0x0000 }, }, /* 2 */ + { 0,0,0,0, { 0x0000, } }, }, + { is_last: 1 } + } + }, + { { Twcscpy, TST_LOC_eucJP }, + { + { { { 0x3041,0x0092,0x3043,0x0000 }, }, /* 1 */ + { 0,0,0,0, { 0x3041,0x0092,0x3043,0x0000, } }, }, + { { { 0x0000,0x0092,0x3043,0x0000 }, }, /* 2 */ + { 0,0,0,0, { 0x0000, } }, }, + { is_last: 1 } + } + }, + { { Twcscpy, TST_LOC_end }} + +}; diff --git a/localedata/tests-mbwc/dat_wcscspn.c b/localedata/tests-mbwc/dat_wcscspn.c new file mode 100644 index 0000000000..0b2e1e75e7 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcscspn.c @@ -0,0 +1,160 @@ +/* + * 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,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D3,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x00D3,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x00D3,0x00D4,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D3,0x00D4,0x00D5,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x000 }, }, /* #8 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x0000,0x00D2,0x00D3,0x0000 }, }, /* #9 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x0000 }, + { 0x00D1,0x00D3,0x00D4,0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twcscspn, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0043,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0043,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0043,0x0044,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0043,0x0044,0x0045,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0042,0x000 }, }, /* #8 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0000,0x0042,0x0043,0x0000 }, }, /* #9 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0000 }, + { 0x0041,0x0043,0x0044,0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twcscspn, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x0043,0x0000 }, + { 0x3041,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x0043,0x0000 }, + { 0x3042,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3043,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3043,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3043,0x3044,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3043,0x3044,0x3045,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x3042,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x0000,0x3042,0x3043,0x0000 }, }, /* #9 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x0000 }, + { 0x3041,0x3043,0x3044,0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twcscspn, TST_LOC_end }} +}; diff --git a/localedata/tests-mbwc/dat_wcslen.c b/localedata/tests-mbwc/dat_wcslen.c new file mode 100644 index 0000000000..8f3f2d056c --- /dev/null +++ b/localedata/tests-mbwc/dat_wcslen.c @@ -0,0 +1,59 @@ +/* + * 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_flg; ... set err_flg=1 to check errno + * 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,0,1,3, }, + }, + { /*input.*/ { { 0x0000 } }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twcslen, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 } }, /* #01 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x0000 } }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twcslen, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 } }, /* #01 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x0000 } }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twcslen, TST_LOC_end }} +}; diff --git a/localedata/tests-mbwc/dat_wcsncmp.c b/localedata/tests-mbwc/dat_wcsncmp.c new file mode 100644 index 0000000000..4e0b0c2ac1 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcsncmp.c @@ -0,0 +1,140 @@ +/* + * 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,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, 3 }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D1,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, 2 }, /* #03 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D0,0x00D2,0x00D3,0x0000 }, 0 }, /* #04 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x0000,0x00D2,0x00D1,0x0000 }, 3 }, /* #05 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x0000,0x00D2,0x00D3,0x0000 }, 3 }, /* #06 */ + /*expect*/ { 0,0,1,0x00D1, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D9,0x0000 }, 2 }, /* #07 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D9,0x0000 }, 3 }, /* #08 */ + /*expect*/ { 0,0,1,-0x0006, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x0000 }, 4 }, /* #09 */ + /*expect*/ { 0,0,1,0x00D3, }, + }, + { is_last: 1 } + } + }, + { + { Twcsncmp, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* #01 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, 3 }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0041,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, 2 }, /* #03 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0040,0x0042,0x0043,0x0000 }, 0 }, /* #04 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0000,0x0042,0x0041,0x0000 }, 3 }, /* #05 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0000,0x0042,0x0043,0x0000 }, 3 }, /* #06 */ + /*expect*/ { 0,0,1,0x0041, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0049,0x0000 }, 2 }, /* #07 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0049,0x0000 }, 3 }, /* #08 */ + /*expect*/ { 0,0,1,-0x0006, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0000 }, 4 }, /* #09 */ + /*expect*/ { 0,0,1,0x0043, }, + }, + { is_last: 1 } + } + }, + { + { Twcsncmp, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* #01 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3041,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* #03 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3040,0x3042,0x3043,0x0000 }, 0 }, /* #04 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x0000,0x3042,0x3041,0x0000 }, 3 }, /* #05 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x0000,0x3042,0x3043,0x0000 }, 3 }, /* #06 */ + /*expect*/ { 0,0,1,0x3041, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3049,0x0000 }, 2 }, /* #07 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3049,0x0000 }, 3 }, /* #08 */ + /*expect*/ { 0,0,1,-0x0006, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x0000 }, 4 }, /* #09 */ + /*expect*/ { 0,0,1,0x3043, }, + }, + { is_last: 1 } + } + }, + { + { Twcsncmp, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wcspbrk.c b/localedata/tests-mbwc/dat_wcspbrk.c new file mode 100644 index 0000000000..f6b6ec6ce6 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcspbrk.c @@ -0,0 +1,172 @@ +/* + * 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,0, 0x00D1 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,0,0, 0x00D2 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D3,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,0,0, 0x00D3 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,0,0, 0x00D1 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x00D3,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,0,0, 0x00D2 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,0,0, 0x00D1 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D0,0x00D4,0x00D5,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D5,0x00D0,0x00D4,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x0000 }, }, /* #11 */ + /*expect*/ { 0,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,0, 0x0041 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,0,0, 0x0042 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0043,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,0,0, 0x0043 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,0,0, 0x0041 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0043,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,0,0, 0x0042 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,0,0, 0x0041 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0040,0x0044,0x0045,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0045,0x0040,0x0044,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0041,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { is_last: 1 } + } + }, + { + { Twcspbrk, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x0000 }, }, /* #01 */ + /*expect*/ { 0,0,0,0, 0x3041 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,0,0, 0x3042 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3043,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,0,0, 0x3043 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,0,0, 0x3041 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3043,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,0,0, 0x3042 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,0,0, 0x3041 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3043,0x3044,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,0,0, 0x3042 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3040,0x3041,0x3042,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,0,0, 0x3041 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x3041,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, 0x0000 }, + }, + { is_last: 1 } + } + }, + { + { Twcspbrk, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wcsspn.c b/localedata/tests-mbwc/dat_wcsspn.c new file mode 100644 index 0000000000..8daff4b88f --- /dev/null +++ b/localedata/tests-mbwc/dat_wcsspn.c @@ -0,0 +1,175 @@ +/* + * 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,0,1,1, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D3,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D4,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x00D3,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D3,0x00D4,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x0000,0x00D2,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x0000,0x00D2,0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x00D1,0x0000 }, }, /* #12 */ + /*expect*/ { 0,0,1,2, }, + }, + { is_last: 1 } + } + }, + { + { Twcsspn, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0000 }, }, /* #01 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0043,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0044,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0043,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0043,0x0044,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0042,0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0000,0x0042,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0000,0x0042,0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0041,0x0000 }, }, /* #12 */ + /*expect*/ { 0,0,1,2, }, + }, + { is_last: 1 } + } + }, + { + { Twcsspn, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,1, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3043,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3044,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3043,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3043,0x3044,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,1,2, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x3042,0x0000 }, }, /* #9 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x0000,0x3042,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x0000,0x3042,0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3041,0x0000 }, }, /* #12 */ + /*expect*/ { 0,0,1,2, }, + }, + { is_last: 1 } + } + }, + { + { Twcsspn, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wcsstr.c b/localedata/tests-mbwc/dat_wcsstr.c new file mode 100644 index 0000000000..e214182c79 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcsstr.c @@ -0,0 +1,171 @@ +/* + * 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,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D3,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x00D3,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D2,0x00D3,0x00D4,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D0,0x00D1,0x00D2,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { + { Twcsstr, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0000 }, }, /* #01 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0043,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0043,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0042,0x0043,0x0044,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0040,0x0041,0x0042,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0041,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { + { Twcsstr, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x0000 }, }, /* #01 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x0000 }, }, /* #02 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3043,0x0000 }, }, /* #03 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x0000 }, }, /* #04 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3043,0x0000 }, }, /* #05 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #06 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3042,0x3043,0x3044,0x0000 }, }, /* #07 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3040,0x3041,0x3042,0x0000 }, }, /* #08 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x0000 }, }, /* #09 */ + /*expect*/ { 0,0,0,0, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x3041,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,1,(wchar_t *)NULL, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x0000 }, }, /* #11 */ + /*expect*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { + { Twcsstr, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wcswidth.c b/localedata/tests-mbwc/dat_wcswidth.c new file mode 100644 index 0000000000..f8d51341d7 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcswidth.c @@ -0,0 +1,214 @@ +/* + * 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,0,1,0 }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 1 }, /* 02 */ + /*expect*/ { 0,0,1,1 }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 2 }, /* 03 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 3 }, /* 04 */ + /*expect*/ { 0,0,1,3 }, + }, + { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 4 }, /* 05 */ + /*expect*/ { 0,0,1,3 }, + }, + { /*input.*/ { { 0x0000 }, 1 }, /* 06 */ + /*expect*/ { 0,0,1,0 }, + }, + { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 07 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 1 }, /* 08 */ + /*expect*/ { 0,0,1,1 }, + }, + { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 09 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x00C1,0x0092,0x0000 }, 2 }, /* 10 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x00C1,0x0020,0x0000 }, 2 }, /* 11 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x00C1,0x0021,0x0000 }, 2 }, /* 12 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x00C1,0x007E,0x0000 }, 2 }, /* 13 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x00C1,0x007F,0x0000 }, 2 }, /* 14 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x00C1,0x0080,0x0000 }, 2 }, /* 15 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x00C1,0x00A0,0x0000 }, 2 }, /* 16 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x00C1,0x00A1,0x0000 }, 2 }, /* 17 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x00C1,0x00FF,0x0000 }, 2 }, /* 18 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */ /* <WAIVER> */ /* returns 2 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */ /* <WAIVER> */ /* returns 2 */ + /*expect*/ { 0,0,1,-1 }, + }, + { is_last: 1 } + } + }, + { + { Twcswidth, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 0 }, /* 01 */ + /*expect*/ { 0,0,1,0 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 1 }, /* 02 */ + /*expect*/ { 0,0,1,1 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 2 }, /* 03 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */ + /*expect*/ { 0,0,1,3 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 4 }, /* 05 */ + /*expect*/ { 0,0,1,3 }, + }, + { /*input.*/ { { 0x0000 }, 1 }, /* 06 */ + /*expect*/ { 0,0,1,0 }, + }, + { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 07 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x0001,0x0000 }, 1 }, /* 08 */ + /*expect*/ { 0,0,1,1 }, + }, + { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 09 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x0092,0x0000 }, 2 }, /* 10 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 11 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x00FF,0x0000 }, 2 }, /* 18 */ + /*expect*/ { 0,0,1,2 }, + }, + /* <WAIVER> */ /* returns 2 */ + { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */ + /*expect*/ { 0,0,1,-1 }, + }, + /* <WAIVER> */ /* returns 2 */ + { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */ + /*expect*/ { 0,0,1,-1 }, + }, + { is_last: 1 } + } + }, + { + { Twcswidth, TST_LOC_eucJP }, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0 }, /* 01 */ + /*expect*/ { 0,0,1,0 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 1 }, /* 02 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* 03 */ + /*expect*/ { 0,0,1,4 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* 04 */ + /*expect*/ { 0,0,1,6 }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* 05 */ + /*expect*/ { 0,0,1,6 }, + }, + { /*input.*/ { { 0x0000 }, 1 }, /* 06 */ + /*expect*/ { 0,0,1,0 }, + }, + { /*input.*/ { { 0x008E,0x0001,0x0000 }, 2 }, /* 07 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x3041,0x008E,0x0000 }, 1 }, /* 08 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x3041,0x008E,0x0000 }, 2 }, /* 09 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x3041,0x0001,0x0000 }, 2 }, /* 10 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x3041,0x3000,0x0000 }, 2 }, /* 11 */ + /*expect*/ { 0,0,1,4 }, + }, + { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */ + /*expect*/ { 0,0,1,-1 }, + }, + /* <NO_WAIVER> */ /* returns 3 */ + { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0xFF71,0x0000 }, 2 }, /* 18 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */ + /*expect*/ { 0,0,1,3 }, + }, + { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */ + /*expect*/ { 0,0,1,3 }, + }, + { is_last: 1 } + } + }, + { + { Twcswidth, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wctob.c b/localedata/tests-mbwc/dat_wctob.c new file mode 100644 index 0000000000..9f30aff0ea --- /dev/null +++ b/localedata/tests-mbwc/dat_wctob.c @@ -0,0 +1,46 @@ +/* + * 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,0, 1, EOF } }, + { { 0x0020 }, { 0,0, 1, 0x20 } }, + { { 0x0061 }, { 0,0, 1, 0x61 } }, + { { 0x0080 }, { 0,0, 1, 0x80 } }, + { { 0x00C4 }, { 0,0, 1, 0xC4 } }, + { { 0x30C4 }, { 0,0, 1, EOF } }, + { is_last: 1 } /* Last element. */ + } + }, + { { Twctob, TST_LOC_enUS }, + { + { { WEOF }, { 0,0, 1, EOF } }, + { { 0x0020 }, { 0,0, 1, 0x20 } }, + { { 0x0061 }, { 0,0, 1, 0x61 } }, + { { 0x0080 }, { 0,0, 1, 0x80 } }, + { { 0x00C4 }, { 0,0, 1, 0xC4 } }, + { { 0x30C4 }, { 0,0, 1, EOF } }, + { is_last: 1 } /* Last element. */ + } + }, + { { Twctob, TST_LOC_eucJP }, + { + { { WEOF }, { 0,0, 1, EOF } }, + { { 0x0020 }, { 0,0, 1, 0x20 } }, + { { 0x0061 }, { 0,0, 1, 0x61 } }, + { { 0x0080 }, { 0,0, 1, 0x80 } }, /* <WAIVER> */ + { { 0x00C4 }, { 0,0, 1, EOF } }, + { { 0x30C4 }, { 0,0, 1, EOF } }, + { is_last: 1 } /* Last element. */ + } + }, + { { Twctob, TST_LOC_end } } +}; diff --git a/localedata/tests-mbwc/dat_wctrans.c b/localedata/tests-mbwc/dat_wctrans.c new file mode 100644 index 0000000000..b137f74b6a --- /dev/null +++ b/localedata/tests-mbwc/dat_wctrans.c @@ -0,0 +1,95 @@ +/* + * 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,0,1,0, }, + }, + { /*inp*/ { "upper" }, /* #2 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "lower" }, /* #3 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "toupper" }, /* #4 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "tolower" }, /* #5 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "xxxxx" }, /* #6 */ + /*exp*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twctrans, TST_LOC_enUS }, + { + { /*inp*/ { "" }, /* #1 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "upper" }, /* #2 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "lower" }, /* #3 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "toupper" }, /* #4 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "tolower" }, /* #5 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "xxxxx" }, /* #6 */ + /*exp*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twctrans, TST_LOC_eucJP }, + { + { /*inp*/ { "" }, /* #1 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "upper" }, /* #2 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "lower" }, /* #3 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "toupper" }, /* #4 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "tolower" }, /* #5 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "xxxxx" }, /* #6 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "tojhira" }, /* #7 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "tojkata" }, /* #8 */ + /*exp*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { { Twctrans, TST_LOC_end }} +}; diff --git a/localedata/tests-mbwc/dat_wctype.c b/localedata/tests-mbwc/dat_wctype.c new file mode 100644 index 0000000000..d3e2c9585b --- /dev/null +++ b/localedata/tests-mbwc/dat_wctype.c @@ -0,0 +1,185 @@ +/* + * 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,0, }, + }, + { /*inp*/ { "alpha" }, /* #02 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "cntrl" }, /* #03 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "digit" }, /* #04 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "graph" }, /* #05 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "lower" }, /* #06 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "print" }, /* #07 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "punct" }, /* #08 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "space" }, /* #09 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "upper" }, /* #10 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "xdigit" }, /* #11 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "" }, /* #12 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "ideograph" }, /* #13 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "english" }, /* #14 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "ascii" }, /* #15 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "special" }, /* #16 */ + /*exp*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twctype, TST_LOC_enUS }, + { + { /*inp*/ { "alnum" }, /* #01 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "alpha" }, /* #02 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "cntrl" }, /* #03 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "digit" }, /* #04 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "graph" }, /* #05 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "lower" }, /* #06 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "print" }, /* #07 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "punct" }, /* #08 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "space" }, /* #09 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "upper" }, /* #10 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "xdigit" }, /* #11 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "" }, /* #12 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "ideograph" }, /* #13 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "english" }, /* #14 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "ascii" }, /* #15 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "special" }, /* #16 */ + /*exp*/ { 0,0,1,0, }, + }, + { is_last: 1 } + } + }, + { { Twctype, TST_LOC_eucJP }, + { + { /*inp*/ { "alnum" }, /* #01 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "alpha" }, /* #02 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "cntrl" }, /* #03 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "digit" }, /* #04 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "graph" }, /* #05 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "lower" }, /* #06 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "print" }, /* #07 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "punct" }, /* #08 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "space" }, /* #09 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "upper" }, /* #10 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "xdigit" }, /* #11 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "ideogram" }, /* #12 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "phonogram" }, /* #13 */ + /*exp*/ { 0,0,1,0, }, + }, + { /*inp*/ { "jspace" }, /* #14 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "jhira" }, /* #15 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "jkata" }, /* #16 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "jkanji" }, /* #17 */ + /*exp*/ { 0,0,0,0, }, + }, + { /*inp*/ { "jdigit" }, /* #18 */ + /*exp*/ { 0,0,0,0, }, + }, + { is_last: 1 } + } + }, + { { Twctype, TST_LOC_end }} +}; diff --git a/localedata/tests-mbwc/tgn_funcdef.h b/localedata/tests-mbwc/tgn_funcdef.h new file mode 100644 index 0000000000..ec247926f1 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tgn_locdef.h b/localedata/tests-mbwc/tgn_locdef.h new file mode 100644 index 0000000000..dfe439001f --- /dev/null +++ b/localedata/tests-mbwc/tgn_locdef.h @@ -0,0 +1,16 @@ +#ifndef TGN_LOCDEF_H +#define TGN_LOCDEF_H + +/* Defines for all locales used in the suite. */ + +#define TST_LOC_de "de_DE.ISO-8859-1" + +/* For US we use ANSI_X3.4-1968 (ASCII). */ +#define TST_LOC_enUS "en_US.ANSI_X3.4-1968" + +#define TST_LOC_eucJP "ja_JP.EUC-JP" + +/* End marker - must appear in each table. */ +#define TST_LOC_end "lastEntry" + +#endif /* TGN_LOCDEF_H */ diff --git a/localedata/tests-mbwc/tsp_common.c b/localedata/tests-mbwc/tsp_common.c new file mode 100644 index 0000000000..cd88274c57 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_funcs.h b/localedata/tests-mbwc/tst_funcs.h new file mode 100644 index 0000000000..95d0787e5d --- /dev/null +++ b/localedata/tests-mbwc/tst_funcs.h @@ -0,0 +1,273 @@ +/* + * 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_flg; \ + 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 func_id, seq_num = 0; \ + const char *locale; \ + int err_flg, 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) + + +#define TST_HEAD_LOCALE(ofunc, s_func) \ + func_id = TST_HEAD (ofunc).func_id; \ + 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"); \ + continue; \ + } + +#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_flg = TST_EXPECT (_ofunc_).err_flg; \ + 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_flg = TST_EXPECT_SEQ (_ofunc_).err_flg; \ + 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 + +#define TST_IF_RETURN(_s_func_) \ + if (err_flg == 1) \ + { \ + 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/localedata/tests-mbwc/tst_iswalnum.c b/localedata/tests-mbwc/tst_iswalnum.c new file mode 100644 index 0000000000..95ba863f94 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswalpha.c b/localedata/tests-mbwc/tst_iswalpha.c new file mode 100644 index 0000000000..8eff2cc114 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswcntrl.c b/localedata/tests-mbwc/tst_iswcntrl.c new file mode 100644 index 0000000000..4e1baa8dc8 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswdigit.c b/localedata/tests-mbwc/tst_iswdigit.c new file mode 100644 index 0000000000..5429ed07d8 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswgraph.c b/localedata/tests-mbwc/tst_iswgraph.c new file mode 100644 index 0000000000..91a70e2d3b --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswlower.c b/localedata/tests-mbwc/tst_iswlower.c new file mode 100644 index 0000000000..e0911001d0 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswprint.c b/localedata/tests-mbwc/tst_iswprint.c new file mode 100644 index 0000000000..8d5bde51f2 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswpunct.c b/localedata/tests-mbwc/tst_iswpunct.c new file mode 100644 index 0000000000..4749d61e3c --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswspace.c b/localedata/tests-mbwc/tst_iswspace.c new file mode 100644 index 0000000000..6c26d5ff64 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswupper.c b/localedata/tests-mbwc/tst_iswupper.c new file mode 100644 index 0000000000..dfe5a5b35a --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_iswxdigit.c b/localedata/tests-mbwc/tst_iswxdigit.c new file mode 100644 index 0000000000..5f9c0c5d54 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_swscanf.c b/localedata/tests-mbwc/tst_swscanf.c new file mode 100644 index 0000000000..4f3286f5cf --- /dev/null +++ b/localedata/tests-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%x\n", + 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/localedata/tests-mbwc/tst_towctrans.c b/localedata/tests-mbwc/tst_towctrans.c new file mode 100644 index 0000000000..102b23628d --- /dev/null +++ b/localedata/tests-mbwc/tst_towctrans.c @@ -0,0 +1,76 @@ +/* + 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; + int dummy=0; + 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 ((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"); + } + } + + 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/localedata/tests-mbwc/tst_types.h b/localedata/tests-mbwc/tst_types.h new file mode 100644 index 0000000000..e0a8e7fcc3 --- /dev/null +++ b/localedata/tests-mbwc/tst_types.h @@ -0,0 +1,730 @@ +/* + * 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 NAMESIZE 64 +#define MBSSIZE 24 +#define WCSSIZE 12 +#define MONFMTSIZE 16 +#define MONSIZE 32 +#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[NAMESIZE]; +} +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 + { + char s_flg; + char s[MBSSIZE]; + size_t n; + char t_flg; + char 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 + { + char w_flg; + char s_flg; + char s[MBSSIZE]; + size_t n; + char t_flg; + char 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 + { + char w_flg; + char s[MBSSIZE]; + size_t n; + char t_flg; + char 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 + { + char w_flg; + char s_flg; + char s[MBSSIZE]; + 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]; + char wch; +} +TIN_SWSCANF_REC; + +typedef struct +{ + TMD_ERRET (int); + int val_int; /* %d */ + unsigned val_uns; /* %u */ + float val_flt; /* %f */ + char 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 +{ + char s_flg; + wchar_t wc; + char t_flg; + char 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); + char 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 +{ + char s_flg; + char w_flg; /* don't need this */ + wchar_t ws[WCSSIZE]; + size_t n; + char t_flg; + char 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 + { + char 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 +{ + char s_flg; + char 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 +{ + char 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/localedata/tests-mbwc/tst_wcschr.c b/localedata/tests-mbwc/tst_wcschr.c new file mode 100644 index 0000000000..3dcc1e893f --- /dev/null +++ b/localedata/tests-mbwc/tst_wcschr.c @@ -0,0 +1,69 @@ +/* + 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%x\n", *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/localedata/tests-mbwc/tst_wcscoll.c b/localedata/tests-mbwc/tst_wcscoll.c new file mode 100644 index 0000000000..d648fa3c60 --- /dev/null +++ b/localedata/tests-mbwc/tst_wcscoll.c @@ -0,0 +1,57 @@ +/* + 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++; + Result (C_FAILURE, S_WCSCOLL, CASE_3, + "the return value should be positive " + "/negative but it's negative/positive."); + } + } + } + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcscpy.c b/localedata/tests-mbwc/tst_wcscpy.c new file mode 100644 index 0000000000..2e9212e6ce --- /dev/null +++ b/localedata/tests-mbwc/tst_wcscpy.c @@ -0,0 +1,84 @@ +/*-------------------------------------------------------------------------------------*/ +/* 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%x <-> wx_ex[ %d ] = 0x%x\n", i, + ws1[i], i, 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/localedata/tests-mbwc/tst_wcscspn.c b/localedata/tests-mbwc/tst_wcscspn.c new file mode 100644 index 0000000000..5b55ac199f --- /dev/null +++ b/localedata/tests-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 = %d\n", ret); + } + + TST_IF_RETURN (S_WCSCSPN) + { + }; + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcslen.c b/localedata/tests-mbwc/tst_wcslen.c new file mode 100644 index 0000000000..d0ffa5a443 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_wcsncmp.c b/localedata/tests-mbwc/tst_wcsncmp.c new file mode 100644 index 0000000000..d046ecd133 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_wcspbrk.c b/localedata/tests-mbwc/tst_wcspbrk.c new file mode 100644 index 0000000000..1bb0f6dc44 --- /dev/null +++ b/localedata/tests-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%x : 0x%x = ws2[0]\n", + ret[0], 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%x <-> 0x%x = wc_ex\n", + *ret, 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/localedata/tests-mbwc/tst_wcsspn.c b/localedata/tests-mbwc/tst_wcsspn.c new file mode 100644 index 0000000000..c80b8e8c05 --- /dev/null +++ b/localedata/tests-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 = %d\n", ret); + } + + TST_IF_RETURN (S_WCSSPN) + { + }; + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcsstr.c b/localedata/tests-mbwc/tst_wcsstr.c new file mode 100644 index 0000000000..02f756c37c --- /dev/null +++ b/localedata/tests-mbwc/tst_wcsstr.c @@ -0,0 +1,85 @@ +/* + 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%x <-> 0x%x = ws2[ 0 ]\n", + ret[0], 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 < MBSSIZE; i++) + { + if (debug_flg) + { + fprintf (stderr, + " : ret[ %d ] = 0x%x <-> 0x%x = ws2[ %d ]\n", i, + ret[i], 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/localedata/tests-mbwc/tst_wcswidth.c b/localedata/tests-mbwc/tst_wcswidth.c new file mode 100644 index 0000000000..c8369753e3 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_wctob.c b/localedata/tests-mbwc/tst_wctob.c new file mode 100644 index 0000000000..2377daf594 --- /dev/null +++ b/localedata/tests-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/localedata/tests-mbwc/tst_wctrans.c b/localedata/tests-mbwc/tst_wctrans.c new file mode 100644 index 0000000000..129b797fb3 --- /dev/null +++ b/localedata/tests-mbwc/tst_wctrans.c @@ -0,0 +1,51 @@ +/* + 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 = %d\n", rec + 1, 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/localedata/tests-mbwc/tst_wctype.c b/localedata/tests-mbwc/tst_wctype.c new file mode 100644 index 0000000000..1ad30ce372 --- /dev/null +++ b/localedata/tests-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 = %d\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; +} |