diff options
Diffstat (limited to 'localedata/tests-mbwc')
-rw-r--r-- | localedata/tests-mbwc/dat_iswctype.c | 546 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_towlower.c | 43 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_towupper.c | 43 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_wcscat.c | 112 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_wcscmp.c | 133 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_wcsncat.c | 154 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_wcsncpy.c | 115 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_wcsxfrm.c | 95 | ||||
-rw-r--r-- | localedata/tests-mbwc/dat_wcwidth.c | 100 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_iswctype.c | 53 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_towlower.c | 11 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_towupper.c | 10 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_wcscat.c | 78 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_wcscmp.c | 39 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_wcsncat.c | 74 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_wcsncpy.c | 92 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_wcsxfrm.c | 122 | ||||
-rw-r--r-- | localedata/tests-mbwc/tst_wcwidth.c | 38 |
18 files changed, 1858 insertions, 0 deletions
diff --git a/localedata/tests-mbwc/dat_iswctype.c b/localedata/tests-mbwc/dat_iswctype.c new file mode 100644 index 0000000000..ebdaedce57 --- /dev/null +++ b/localedata/tests-mbwc/dat_iswctype.c @@ -0,0 +1,546 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_iswctype.c + * + * ISWCTYPE: int iswctype( wint_t wc, wctype_t charclass ); + */ + +#include <errno.h> +#include <stdlib.h> +#include <wctype.h> +#include "tst_types.h" +#include "tgn_locdef.h" + +/* + * NOTE: + * Set ret_flg = 1, when a return value is expected to be 0 (FALSE). + * Set ret_flg = 0, when a return value is expected to be non-zero (TRUE). + * + * Since the functions return *non*-zero value for TRUE, can't + * compare an actual return value with an expected return value. + * Set the ret_flg=0 for TRUE cases and the tst_isw*() will check + * the non-zero value. + * + * { { WEOF }, { 0,0,1,0 } }, + * | | + * | ret_val: an expected return value + * ret_flg: if 1, compare an actual return value with the + * ret_val; if 0, the test program checks + * the actual return value. + */ + +TST_ISWCTYPE tst_iswctype_loc [] = { + { + { Tiswctype, TST_LOC_de }, + { + { { 0x009F, "alnum" }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0, "alnum" }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1, "alnum" }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B1, "alnum" }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B3, "alnum" }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B4, "alnum" }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00BB, "alnum" }, { 0,0,1,0 } }, /* >> */ + { { 0x00BE, "alnum" }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF, "alnum" }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0, "alnum" }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6, "alnum" }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7, "alnum" }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8, "alnum" }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF, "alnum" }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0, "alnum" }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6, "alnum" }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7, "alnum" }, { 0,0,1,0 } }, /* division */ + { { 0x00F8, "alnum" }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF, "alnum" }, { 0,0,0,0 } }, /* y dia */ + { { 0x0080, "alpha" }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0, "alpha" }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1, "alpha" }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B1, "alpha" }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00B4, "alpha" }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8, "alpha" }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9, "alpha" }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BB, "alpha" }, { 0,0,1,0 } }, /* >> */ + { { 0x00BE, "alpha" }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF, "alpha" }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0, "alpha" }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6, "alpha" }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7, "alpha" }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8, "alpha" }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF, "alpha" }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0, "alpha" }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6, "alpha" }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7, "alpha" }, { 0,0,1,0 } }, /* division */ + { { 0x00F8, "alpha" }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF, "alpha" }, { 0,0,0,0 } }, /* y dia */ + { { 0x0080, "cntrl" }, { 0,0,0,0 } }, /* CTRL */ + { { 0x009F, "cntrl" }, { 0,0,0,0 } }, /* CTRL */ + { { 0x00A0, "cntrl" }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00F6, "cntrl" }, { 0,0,1,0 } }, /* o dia */ + { { 0x00FF, "cntrl" }, { 0,0,1,0 } }, /* y dia */ + { { 0x00B9, "digit" }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BE, "digit" }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x009F, "graph" }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0, "graph" }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1, "graph" }, { 0,0,0,0 } }, /* UD ! */ + { { 0x00B1, "graph" }, { 0,0,0,0 } }, /* +- sign */ + { { 0x00B3, "graph" }, { 0,0,0,0 } }, /* SUP 3 */ + { { 0x00B4, "graph" }, { 0,0,0,0 } }, /* ACUTE */ + { { 0x00BB, "graph" }, { 0,0,0,0 } }, /* >> */ + { { 0x00BE, "graph" }, { 0,0,0,0 } }, /* 3/4 */ + { { 0x00C0, "graph" }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6, "graph" }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7, "graph" }, { 0,0,0,0 } }, /* multipl. */ + { { 0x00D8, "graph" }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF, "graph" }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00F7, "graph" }, { 0,0,0,0 } }, /* division */ + { { 0x00F8, "graph" }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF, "graph" }, { 0,0,0,0 } }, /* y dia */ + { { 0x009F, "print" }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0, "print" }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1, "print" }, { 0,0,0,0 } }, /* UD ! */ + { { 0x00B1, "print" }, { 0,0,0,0 } }, /* +- sign */ + { { 0x00B4, "print" }, { 0,0,0,0 } }, /* ACUTE */ + { { 0x00B8, "print" }, { 0,0,0,0 } }, /* CEDILLA */ + { { 0x00B9, "print" }, { 0,0,0,0 } }, /* SUP 1 */ + { { 0x00BB, "print" }, { 0,0,0,0 } }, /* >> */ + { { 0x00BE, "print" }, { 0,0,0,0 } }, /* 3/4 */ + { { 0x00C0, "print" }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00DF, "print" }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00F6, "print" }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7, "print" }, { 0,0,0,0 } }, /* division */ + { { 0x00F8, "print" }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF, "print" }, { 0,0,0,0 } }, /* y dia */ + { { 0x009F, "punct" }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0, "punct" }, { 0,0,1,0 } }, /* NB SPACE */ + { { 0x00A1, "punct" }, { 0,0,0,0 } }, /* UD ! */ + { { 0x00B0, "punct" }, { 0,0,0,0 } }, /* Degree */ + { { 0x00B1, "punct" }, { 0,0,0,0 } }, /* +- sign */ + { { 0x00B2, "punct" }, { 0,0,0,0 } }, /* SUP 2 */ + { { 0x00B3, "punct" }, { 0,0,0,0 } }, /* SUP 3 */ + { { 0x00B4, "punct" }, { 0,0,0,0 } }, /* ACUTE */ + { { 0x00B8, "punct" }, { 0,0,0,0 } }, /* CEDILLA */ + { { 0x00B9, "punct" }, { 0,0,0,0 } }, /* SUP 1 */ + { { 0x00BB, "punct" }, { 0,0,0,0 } }, /* >> */ + { { 0x00BC, "punct" }, { 0,0,0,0 } }, /* 1/4 */ + { { 0x00BD, "punct" }, { 0,0,0,0 } }, /* 1/2 */ + { { 0x00BE, "punct" }, { 0,0,0,0 } }, /* 3/4 */ + { { 0x00BF, "punct" }, { 0,0,0,0 } }, /* UD ? */ + { { 0x00C0, "punct" }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D7, "punct" }, { 0,0,0,0 } }, /* multipl. */ + { { 0x00DF, "punct" }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00F6, "punct" }, { 0,0,1,0 } }, /* o dia */ + { { 0x00F7, "punct" }, { 0,0,0,0 } }, /* division */ + { { 0x00FF, "punct" }, { 0,0,1,0 } }, /* y dia */ + { { 0x009F, "space" }, { 0,0,1,0 } }, /* CTRL */ + { { 0x00A0, "space" }, { 0,0,0,0 } }, /* NB SPACE */ + { { 0x00A1, "space" }, { 0,0,1,0 } }, /* UD ! */ + { { 0x00B1, "space" }, { 0,0,1,0 } }, /* +- sign */ + { { 0x00F8, "space" }, { 0,0,1,0 } }, /* o stroke */ + { { 0x00B3, "lower" }, { 0,0,1,0 } }, /* SUP 3 */ + { { 0x00B8, "lower" }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00BE, "lower" }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00C0, "lower" }, { 0,0,1,0 } }, /* A Grave */ + { { 0x00D6, "lower" }, { 0,0,1,0 } }, /* O dia */ + { { 0x00D8, "lower" }, { 0,0,1,0 } }, /* O stroke */ + { { 0x00DF, "lower" }, { 0,0,0,0 } }, /* small Sh */ + { { 0x00E0, "lower" }, { 0,0,0,0 } }, /* a grave */ + { { 0x00F6, "lower" }, { 0,0,0,0 } }, /* o dia */ + { { 0x00F7, "lower" }, { 0,0,1,0 } }, /* division */ + { { 0x00F8, "lower" }, { 0,0,0,0 } }, /* o stroke */ + { { 0x00FF, "lower" }, { 0,0,0,0 } }, /* y dia */ + { { 0x00B4, "upper" }, { 0,0,1,0 } }, /* ACUTE */ + { { 0x00B8, "upper" }, { 0,0,1,0 } }, /* CEDILLA */ + { { 0x00B9, "upper" }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BE, "upper" }, { 0,0,1,0 } }, /* 3/4 */ + { { 0x00BF, "upper" }, { 0,0,1,0 } }, /* UD ? */ + { { 0x00C0, "upper" }, { 0,0,0,0 } }, /* A Grave */ + { { 0x00D6, "upper" }, { 0,0,0,0 } }, /* O dia */ + { { 0x00D7, "upper" }, { 0,0,1,0 } }, /* multipl. */ + { { 0x00D8, "upper" }, { 0,0,0,0 } }, /* O stroke */ + { { 0x00DF, "upper" }, { 0,0,1,0 } }, /* small Sh */ + { { 0x00FF, "upper" }, { 0,0,1,0 } }, /* y dia */ + { { 0x00B9, "xdigit" }, { 0,0,1,0 } }, /* SUP 1 */ + { { 0x00BC, "xdigit" }, { 0,0,1,0 } }, /* 1/4 */ + { is_last: 1 } + } + }, + { + { Tiswctype, TST_LOC_enUS }, + { + { { WEOF, "alnum" }, { 0,0,1,0 } }, + { { 0x0000, "alnum" }, { 0,0,1,0 } }, + { { 0x001F, "alnum" }, { 0,0,1,0 } }, + { { 0x0020, "alnum" }, { 0,0,1,0 } }, + { { 0x0021, "alnum" }, { 0,0,1,0 } }, + { { 0x002F, "alnum" }, { 0,0,1,0 } }, + { { 0x0030, "alnum" }, { 0,0,0,0 } }, + { { 0x0039, "alnum" }, { 0,0,0,0 } }, + { { 0x003A, "alnum" }, { 0,0,1,0 } }, + { { 0x0040, "alnum" }, { 0,0,1,0 } }, + { { 0x0041, "alnum" }, { 0,0,0,0 } }, + { { 0x005A, "alnum" }, { 0,0,0,0 } }, + { { 0x005B, "alnum" }, { 0,0,1,0 } }, + { { 0x0060, "alnum" }, { 0,0,1,0 } }, + { { 0x0061, "alnum" }, { 0,0,0,0 } }, + { { 0x007A, "alnum" }, { 0,0,0,0 } }, + { { 0x007B, "alnum" }, { 0,0,1,0 } }, + { { 0x007E, "alnum" }, { 0,0,1,0 } }, + { { 0x007F, "alnum" }, { 0,0,1,0 } }, + { { 0x0080, "alnum" }, { 0,0,1,0 } }, + { { 0x0000, "alpha" }, { 0,0,1,0 } }, + { { 0x001F, "alpha" }, { 0,0,1,0 } }, + { { 0x0020, "alpha" }, { 0,0,1,0 } }, + { { 0x0021, "alpha" }, { 0,0,1,0 } }, + { { 0x002F, "alpha" }, { 0,0,1,0 } }, + { { 0x0030, "alpha" }, { 0,0,1,0 } }, + { { 0x0039, "alpha" }, { 0,0,1,0 } }, + { { 0x003A, "alpha" }, { 0,0,1,0 } }, + { { 0x0040, "alpha" }, { 0,0,1,0 } }, + { { 0x0041, "alpha" }, { 0,0,0,0 } }, + { { 0x005A, "alpha" }, { 0,0,0,0 } }, + { { 0x005B, "alpha" }, { 0,0,1,0 } }, + { { 0x0060, "alpha" }, { 0,0,1,0 } }, + { { 0x0061, "alpha" }, { 0,0,0,0 } }, + { { 0x007A, "alpha" }, { 0,0,0,0 } }, + { { 0x007B, "alpha" }, { 0,0,1,0 } }, + { { 0x007E, "alpha" }, { 0,0,1,0 } }, + { { 0x007F, "alpha" }, { 0,0,1,0 } }, + { { 0x0080, "alpha" }, { 0,0,1,0 } }, + { { 0x0009, "blank" }, { 0,0,0,0 } }, + { { 0x000B, "blank" }, { 0,0,1,0 } }, + { { 0x0020, "blank" }, { 0,0,0,0 } }, + { { 0x0000, "cntrl" }, { 0,0,0,0 } }, + { { 0x001F, "cntrl" }, { 0,0,0,0 } }, + { { 0x0020, "cntrl" }, { 0,0,1,0 } }, + { { 0x0021, "cntrl" }, { 0,0,1,0 } }, + { { 0x002F, "cntrl" }, { 0,0,1,0 } }, + { { 0x0030, "cntrl" }, { 0,0,1,0 } }, + { { 0x0039, "cntrl" }, { 0,0,1,0 } }, + { { 0x003A, "cntrl" }, { 0,0,1,0 } }, + { { 0x0040, "cntrl" }, { 0,0,1,0 } }, + { { 0x0041, "cntrl" }, { 0,0,1,0 } }, + { { 0x005A, "cntrl" }, { 0,0,1,0 } }, + { { 0x005B, "cntrl" }, { 0,0,1,0 } }, + { { 0x0060, "cntrl" }, { 0,0,1,0 } }, + { { 0x0061, "cntrl" }, { 0,0,1,0 } }, + { { 0x007A, "cntrl" }, { 0,0,1,0 } }, + { { 0x007B, "cntrl" }, { 0,0,1,0 } }, + { { 0x007E, "cntrl" }, { 0,0,1,0 } }, + { { 0x007F, "cntrl" }, { 0,0,0,0 } }, + { { 0x0080, "cntrl" }, { 0,0,0,0 } }, + { { 0x0000, "digit" }, { 0,0,1,0 } }, + { { 0x001F, "digit" }, { 0,0,1,0 } }, + { { 0x0020, "digit" }, { 0,0,1,0 } }, + { { 0x0021, "digit" }, { 0,0,1,0 } }, + { { 0x002F, "digit" }, { 0,0,1,0 } }, + { { 0x0030, "digit" }, { 0,0,0,0 } }, + { { 0x0039, "digit" }, { 0,0,0,0 } }, + { { 0x003A, "digit" }, { 0,0,1,0 } }, + { { 0x0040, "digit" }, { 0,0,1,0 } }, + { { 0x0041, "digit" }, { 0,0,1,0 } }, + { { 0x005A, "digit" }, { 0,0,1,0 } }, + { { 0x005B, "digit" }, { 0,0,1,0 } }, + { { 0x0060, "digit" }, { 0,0,1,0 } }, + { { 0x0061, "digit" }, { 0,0,1,0 } }, + { { 0x007A, "digit" }, { 0,0,1,0 } }, + { { 0x007B, "digit" }, { 0,0,1,0 } }, + { { 0x007E, "digit" }, { 0,0,1,0 } }, + { { 0x007F, "digit" }, { 0,0,1,0 } }, + { { 0x0080, "digit" }, { 0,0,1,0 } }, + { { 0x0000, "graph" }, { 0,0,1,0 } }, + { { 0x001F, "graph" }, { 0,0,1,0 } }, + { { 0x0020, "graph" }, { 0,0,1,0 } }, + { { 0x0021, "graph" }, { 0,0,0,0 } }, + { { 0x002F, "graph" }, { 0,0,0,0 } }, + { { 0x0030, "graph" }, { 0,0,0,0 } }, + { { 0x0039, "graph" }, { 0,0,0,0 } }, + { { 0x003A, "graph" }, { 0,0,0,0 } }, + { { 0x0040, "graph" }, { 0,0,0,0 } }, + { { 0x0041, "graph" }, { 0,0,0,0 } }, + { { 0x005A, "graph" }, { 0,0,0,0 } }, + { { 0x005B, "graph" }, { 0,0,0,0 } }, + { { 0x0060, "graph" }, { 0,0,0,0 } }, + { { 0x0061, "graph" }, { 0,0,0,0 } }, + { { 0x007A, "graph" }, { 0,0,0,0 } }, + { { 0x007B, "graph" }, { 0,0,0,0 } }, + { { 0x007E, "graph" }, { 0,0,0,0 } }, + { { 0x007F, "graph" }, { 0,0,1,0 } }, + { { 0x0080, "graph" }, { 0,0,1,0 } }, + { { 0x0000, "print" }, { 0,0,1,0 } }, + { { 0x001F, "print" }, { 0,0,1,0 } }, + { { 0x0020, "print" }, { 0,0,0,0 } }, + { { 0x0021, "print" }, { 0,0,0,0 } }, + { { 0x002F, "print" }, { 0,0,0,0 } }, + { { 0x0030, "print" }, { 0,0,0,0 } }, + { { 0x0039, "print" }, { 0,0,0,0 } }, + { { 0x003A, "print" }, { 0,0,0,0 } }, + { { 0x0040, "print" }, { 0,0,0,0 } }, + { { 0x0041, "print" }, { 0,0,0,0 } }, + { { 0x005A, "print" }, { 0,0,0,0 } }, + { { 0x005B, "print" }, { 0,0,0,0 } }, + { { 0x0060, "print" }, { 0,0,0,0 } }, + { { 0x0061, "print" }, { 0,0,0,0 } }, + { { 0x007A, "print" }, { 0,0,0,0 } }, + { { 0x007B, "print" }, { 0,0,0,0 } }, + { { 0x007E, "print" }, { 0,0,0,0 } }, + { { 0x007F, "print" }, { 0,0,1,0 } }, + { { 0x0080, "print" }, { 0,0,1,0 } }, + { { 0x0000, "punct" }, { 0,0,1,0 } }, + { { 0x001F, "punct" }, { 0,0,1,0 } }, + { { 0x0020, "punct" }, { 0,0,1,0 } }, + { { 0x0021, "punct" }, { 0,0,0,0 } }, + { { 0x002F, "punct" }, { 0,0,0,0 } }, + { { 0x0030, "punct" }, { 0,0,1,0 } }, + { { 0x0039, "punct" }, { 0,0,1,0 } }, + { { 0x003A, "punct" }, { 0,0,0,0 } }, + { { 0x0040, "punct" }, { 0,0,0,0 } }, + { { 0x0041, "punct" }, { 0,0,1,0 } }, + { { 0x005A, "punct" }, { 0,0,1,0 } }, + { { 0x005B, "punct" }, { 0,0,0,0 } }, + { { 0x0060, "punct" }, { 0,0,0,0 } }, + { { 0x0061, "punct" }, { 0,0,1,0 } }, + { { 0x007A, "punct" }, { 0,0,1,0 } }, + { { 0x007B, "punct" }, { 0,0,0,0 } }, + { { 0x007E, "punct" }, { 0,0,0,0 } }, + { { 0x007F, "punct" }, { 0,0,1,0 } }, + { { 0x0080, "punct" }, { 0,0,1,0 } }, + { { 0x0000, "space" }, { 0,0,1,0 } }, + { { 0x001F, "space" }, { 0,0,1,0 } }, + { { 0x0020, "space" }, { 0,0,0,0 } }, + { { 0x0021, "space" }, { 0,0,1,0 } }, + { { 0x002F, "space" }, { 0,0,1,0 } }, + { { 0x007E, "space" }, { 0,0,1,0 } }, + { { 0x007F, "space" }, { 0,0,1,0 } }, + { { 0x0080, "space" }, { 0,0,1,0 } }, + { { 0x0000, "lower" }, { 0,0,1,0 } }, + { { 0x001F, "lower" }, { 0,0,1,0 } }, + { { 0x0020, "lower" }, { 0,0,1,0 } }, + { { 0x0021, "lower" }, { 0,0,1,0 } }, + { { 0x002F, "lower" }, { 0,0,1,0 } }, + { { 0x0030, "lower" }, { 0,0,1,0 } }, + { { 0x0039, "lower" }, { 0,0,1,0 } }, + { { 0x003A, "lower" }, { 0,0,1,0 } }, + { { 0x0040, "lower" }, { 0,0,1,0 } }, + { { 0x0041, "lower" }, { 0,0,1,0 } }, + { { 0x005A, "lower" }, { 0,0,1,0 } }, + { { 0x005B, "lower" }, { 0,0,1,0 } }, + { { 0x0060, "lower" }, { 0,0,1,0 } }, + { { 0x0061, "lower" }, { 0,0,0,0 } }, + { { 0x007A, "lower" }, { 0,0,0,0 } }, + { { 0x007B, "lower" }, { 0,0,1,0 } }, + { { 0x007E, "lower" }, { 0,0,1,0 } }, + { { 0x007F, "lower" }, { 0,0,1,0 } }, + { { 0x0080, "lower" }, { 0,0,1,0 } }, + { { 0x0000, "upper" }, { 0,0,1,0 } }, + { { 0x001F, "upper" }, { 0,0,1,0 } }, + { { 0x0020, "upper" }, { 0,0,1,0 } }, + { { 0x0021, "upper" }, { 0,0,1,0 } }, + { { 0x002F, "upper" }, { 0,0,1,0 } }, + { { 0x0030, "upper" }, { 0,0,1,0 } }, + { { 0x0039, "upper" }, { 0,0,1,0 } }, + { { 0x003A, "upper" }, { 0,0,1,0 } }, + { { 0x0040, "upper" }, { 0,0,1,0 } }, + { { 0x0041, "upper" }, { 0,0,0,0 } }, + { { 0x005A, "upper" }, { 0,0,0,0 } }, + { { 0x005B, "upper" }, { 0,0,1,0 } }, + { { 0x0060, "upper" }, { 0,0,1,0 } }, + { { 0x0061, "upper" }, { 0,0,1,0 } }, + { { 0x007A, "upper" }, { 0,0,1,0 } }, + { { 0x007B, "upper" }, { 0,0,1,0 } }, + { { 0x007E, "upper" }, { 0,0,1,0 } }, + { { 0x007F, "upper" }, { 0,0,1,0 } }, + { { 0x0080, "upper" }, { 0,0,1,0 } }, + { { 0x0000, "xdigit" }, { 0,0,1,0 } }, + { { 0x001F, "xdigit" }, { 0,0,1,0 } }, + { { 0x0020, "xdigit" }, { 0,0,1,0 } }, + { { 0x0021, "xdigit" }, { 0,0,1,0 } }, + { { 0x002F, "xdigit" }, { 0,0,1,0 } }, + { { 0x0030, "xdigit" }, { 0,0,0,0 } }, + { { 0x0039, "xdigit" }, { 0,0,0,0 } }, + { { 0x003A, "xdigit" }, { 0,0,1,0 } }, + { { 0x0040, "xdigit" }, { 0,0,1,0 } }, + { { 0x0041, "xdigit" }, { 0,0,0,0 } }, + { { 0x005A, "xdigit" }, { 0,0,1,0 } }, + { { 0x005B, "xdigit" }, { 0,0,1,0 } }, + { { 0x0060, "xdigit" }, { 0,0,1,0 } }, + { { 0x0061, "xdigit" }, { 0,0,0,0 } }, + { { 0x007A, "xdigit" }, { 0,0,1,0 } }, + { { 0x007B, "xdigit" }, { 0,0,1,0 } }, + { { 0x007E, "xdigit" }, { 0,0,1,0 } }, + { { 0x007F, "xdigit" }, { 0,0,1,0 } }, + { { 0x0080, "xdigit" }, { 0,0,1,0 } }, + { { 0x0061, "xxxxxx" }, { 0,0,1,0 } }, + { is_last: 1 } + } + }, + { + { Tiswctype, TST_LOC_eucJP }, + { + { { 0x3029, "alnum" }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0xFE4F, "alnum" }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF19, "alnum" }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0xFF20, "alnum" }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A, "alnum" }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40, "alnum" }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A, "alnum" }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF71, "alnum" }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0x3029, "alpha" }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0xFE4F, "alpha" }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF19, "alpha" }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20, "alpha" }, { 0,0,1,0 } }, /* FULL @ */ + { { 0xFF3A, "alpha" }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40, "alpha" }, { 0,0,1,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A, "alpha" }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF71, "alpha" }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0x0080, "cntrl" }, { 0,0,0,0 } }, /* CNTRL */ + { { 0x3000, "cntrl" }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3029, "digit" }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x32CB, "digit" }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + /* 21: */ + { { 0x33FE, "digit" }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0xFF19, "digit" }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0x3000, "graph" }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020, "graph" }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029, "graph" }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F, "graph" }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037, "graph" }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x303F, "graph" }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + /* 29: */ + { { 0x3041, "graph" }, { 0,0,0,0 } }, /* HIRAGANA a */ + /* Non jis: */ + { { 0x3094, "graph" }, { 0,0,1,0 } }, /* HIRAGANA u" */ + /* Non jis: */ + { { 0x3099, "graph" }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E, "graph" }, { 0,0,0,0 } }, /* ITERATION MARK */ + /* 33: */ + { { 0x30A1, "graph" }, { 0,0,0,0 } }, /* KATAKANA a */ + /* Non jis: */ + { { 0x30FA, "graph" }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB, "graph" }, { 0,0,0,0 } }, /* KATAKANA MID.DOT */ + { { 0x30FE, "graph" }, { 0,0,0,0 } }, /* KATAKANA ITERATION */ + { { 0x3191, "graph" }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243, "graph" }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB, "graph" }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE, "graph" }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE, "graph" }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x4E00, "graph" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05, "graph" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06, "graph" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07, "graph" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF, "graph" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000, "graph" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006, "graph" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007, "graph" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4, "graph" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + /* 51 */ + { { 0x9FA5, "graph" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + /* Non jis: */ + { { 0xFE4F, "graph" }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F, "graph" }, { 0,0,0,0 } }, /* FULL SLASH */ + { { 0xFF19, "graph" }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0xFF20, "graph" }, { 0,0,0,0 } }, /* FULL @ */ + { { 0xFF3A, "graph" }, { 0,0,0,0 } }, /* FULL Z */ + { { 0xFF40, "graph" }, { 0,0,0,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A, "graph" }, { 0,0,0,0 } }, /* FULL z */ + { { 0xFF5E, "graph" }, { 0,0,0,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61, "graph" }, { 0,0,0,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65, "graph" }, { 0,0,0,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF66, "graph" }, { 0,0,0,0 } }, /* HALF KATA WO */ + { { 0xFF6F, "graph" }, { 0,0,0,0 } }, /* HALF KATA tu */ + { { 0xFF70, "graph" }, { 0,0,0,0 } }, /* HALF KATA PL - */ + { { 0xFF71, "graph" }, { 0,0,0,0 } }, /* HALF KATA A */ + { { 0xFF9E, "graph" }, { 0,0,0,0 } }, /* HALF KATA MI */ + { { 0x3000, "print" }, { 0,0,0,0 } }, /* IDEO. SPACE */ + { { 0x3020, "print" }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x3029, "print" }, { 0,0,1,0 } }, /* Hangzhou NUM9 */ + { { 0x302F, "print" }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037, "print" }, { 0,0,1,0 } }, /* Separator Symbol */ + { { 0x4E00, "print" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E05, "print" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4E06, "print" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07, "print" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x4FFF, "print" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9000, "print" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9006, "print" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { { 0x9007, "print" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4, "print" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + /* 81: */ + { { 0x9FA5, "print" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + /* Non jis: */ + { { 0xFE4F, "print" }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0x3000, "punct" }, { 0,0,1,0 } }, /* IDEO. SPACE */ + { { 0x3020, "punct" }, { 0,0,1,0 } }, /* POSTAL MARK FACE */ + { { 0x302F, "punct" }, { 0,0,1,0 } }, /* Diacritics(Hangul) */ + { { 0x3037, "punct" }, { 0,0,1,0 } }, /* FEED Separator */ + { { 0x303F, "punct" }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041, "punct" }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094, "punct" }, { 0,0,1,0 } }, /* HIRAGANA u" */ + /* 90: */ + { { 0x3099, "punct" }, { 0,0,1,0 } }, /* SOUND MARK */ + { { 0x309E, "punct" }, { 0,0,1,0 } }, /* ITERATION MARK */ + { { 0x30A1, "punct" }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA, "punct" }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0x30FB, "punct" }, { 0,0,0,0 } }, /* KATAKANA MID.DOT */ + /* 95: */ + { { 0x30FE, "punct" }, { 0,0,1,0 } }, /* KATAKANA ITERATION */ + { { 0x3191, "punct" }, { 0,0,1,0 } }, /* KANBUN REV.MARK */ + { { 0x3243, "punct" }, { 0,0,1,0 } }, /* IDEO. MARK (reach) */ + { { 0x32CB, "punct" }, { 0,0,1,0 } }, /* IDEO.TEL.SYM.DEC12 */ + { { 0x32FE, "punct" }, { 0,0,1,0 } }, /* MARU KATAKANA wo */ + { { 0x33FE, "punct" }, { 0,0,1,0 } }, /* CJK IDEO.TEL.31th */ + { { 0x9007, "punct" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA4, "punct" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x9FA5, "punct" }, { 0,0,1,0 } }, /* CJK UNI.IDEO. */ + { { 0xFF0F, "punct" }, { 0,0,0,0 } }, /* FULL SLASH */ + /* 105: */ + { { 0xFF19, "punct" }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0xFF20, "punct" }, { 0,0,0,0 } }, /* FULL @ */ + { { 0xFF3A, "punct" }, { 0,0,1,0 } }, /* FULL Z */ + { { 0xFF40, "punct" }, { 0,0,0,0 } }, /* FULL GRAVE ACC. */ + { { 0xFF5A, "punct" }, { 0,0,1,0 } }, /* FULL z */ + { { 0xFF5E, "punct" }, { 0,0,0,0 } }, /* FULL ~ (tilde) */ + { { 0xFF61, "punct" }, { 0,0,0,0 } }, /* HALF IDEO.STOP. . */ + { { 0xFF65, "punct" }, { 0,0,0,0 } }, /* HALF KATA MID.DOT */ + { { 0xFF70, "punct" }, { 0,0,1,0 } }, /* HALF KATA PL - */ + { { 0xFF9E, "punct" }, { 0,0,1,0 } }, /* HALF KATA MI */ + /* 115: */ + { { 0x3000, "space" }, { 0,0,0,0 } }, /* IDEO. SPACE */ + { { 0x303F, "space" }, { 0,0,1,0 } }, /* IDEO. HALF SPACE */ + { { 0x3041, "lower" }, { 0,0,1,0 } }, /* HIRAGANA a */ + { { 0x3094, "lower" }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x30A1, "lower" }, { 0,0,1,0 } }, /* KATAKANA a */ + { { 0x30FA, "lower" }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0xFF66, "lower" }, { 0,0,1,0 } }, /* HALF KATA WO */ + { { 0xFF6F, "lower" }, { 0,0,1,0 } }, /* HALF KATA tu */ + { { 0xFF70, "lower" }, { 0,0,1,0 } }, /* HALF KATA PL - */ + /* 124: */ + { { 0xFF71, "lower" }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF9E, "lower" }, { 0,0,1,0 } }, /* HALF KATA MI */ + { { 0xFF71, "upper" }, { 0,0,1,0 } }, /* HALF KATA A */ + { { 0xFF19, "xdigit" }, { 0,0,1,0 } }, /* FULL 9 */ + { { 0x3000, "jspace" }, { 0,0,0,0 } }, /* IDEO. SPACE */ + /* Non jis? */ + { { 0x303F, "jspace" }, { 0,0,1,0 } }, /* IDEO.HALF SPACE */ + { { 0xFF19, "jdigit" }, { 0,0,0,0 } }, /* FULL 9 */ + { { 0x3041, "jhira" }, { 0,0,0,0 } }, /* HIRAGANA a */ + { { 0x3094, "jhira" }, { 0,0,1,0 } }, /* HIRAGANA u" */ + { { 0x30A1, "jkata" }, { 0,0,0,0 } }, /* KATAKANA a */ + /* Non jis: */ + { { 0x30FA, "jkata" }, { 0,0,1,0 } }, /* KATAKANA wo" */ + { { 0xFF66, "jkata" }, { 0,0,0,0 } }, /* HALF KATA WO */ + { { 0xFF6F, "jkata" }, { 0,0,0,0 } }, /* HALF KATA tu */ + { { 0x4E05, "jkanji" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + /* <NO_WAIVER>: */ + { { 0x4E06, "jkanji" }, { 0,0,1,1 } }, /* CJK UNI.IDEO.NON-J */ + { { 0x4E07, "jkanji" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ + { is_last: 1 } + } + }, + { + { Tiswctype, TST_LOC_end } + } +}; + + +/* dat_isw-funcs.c */ diff --git a/localedata/tests-mbwc/dat_towlower.c b/localedata/tests-mbwc/dat_towlower.c new file mode 100644 index 0000000000..c5fae1b670 --- /dev/null +++ b/localedata/tests-mbwc/dat_towlower.c @@ -0,0 +1,43 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_towlower.c + * + * ISW*: int towlower (wint_t wc); + */ + + +#include "dat_tow-funcs.h" + + +TST_TOW_LOC (LOWER, lower) = { + + { TST_TOW_REC (de, lower) + { + { { WEOF }, { 0,0, 1, (wint_t)-1 } }, + { { 0x0080 }, { 0,0, 1, 0x0080 } }, + { { 0x00CC }, { 0,0, 1, 0x00EC } }, + { { 0x00EC }, { 0,0, 1, 0x00EC } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_TOW_REC (enUS, lower) + { + { { WEOF }, { 0,0, 1, (wint_t)-1 } }, + { { 0x007F }, { 0,0, 1, 0x007F } }, + { { 0x0041 }, { 0,0, 1, 0x0061 } }, + { { 0x0061 }, { 0,0, 1, 0x0061 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_TOW_REC (eucJP, lower) + { + { { 0x007F }, { 0,0, 1, 0x007F } }, + { { 0x0080 }, { 0,0, 1, 0x0080 } }, + { { 0xFF21 }, { 0,0, 1, 0xFF41 } }, + { { 0xFF41 }, { 0,0, 1, 0xFF41 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_TOW_REC (end, lower) } +}; diff --git a/localedata/tests-mbwc/dat_towupper.c b/localedata/tests-mbwc/dat_towupper.c new file mode 100644 index 0000000000..74e9dfbdb4 --- /dev/null +++ b/localedata/tests-mbwc/dat_towupper.c @@ -0,0 +1,43 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_towupper.c + * + * ISW*: int towupper (wint_t wc); + */ + + +#include "dat_tow-funcs.h" + + +TST_TOW_LOC (UPPER, upper) = { + + { TST_TOW_REC (de, upper) + { + { { WEOF }, { 0,0, 1, (wint_t)-1 } }, + { { 0x0080 }, { 0,0, 1, 0x0080 } }, + { { 0x00EC }, { 0,0, 1, 0x00CC } }, + { { 0x00CC }, { 0,0, 1, 0x00CC } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_TOW_REC (enUS, upper) + { + { { WEOF }, { 0,0, 1, (wint_t)-1 } }, + { { 0x0080 }, { 0,0, 1, 0x0080 } }, + { { 0x0041 }, { 0,0, 1, 0x0041 } }, + { { 0x0061 }, { 0,0, 1, 0x0041 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_TOW_REC (eucJP, upper) + { + { { WEOF }, { 0,0, 1, (wint_t)-1 } }, + { { 0x007F }, { 0,0, 1, 0x007F } }, + { { 0xFF41 }, { 0,0, 1, 0xFF21 } }, + { { 0xFF21 }, { 0,0, 1, 0xFF21 } }, + { is_last: 1 } /* Last element. */ + } + }, + { TST_TOW_REC (end, upper) } +}; diff --git a/localedata/tests-mbwc/dat_wcscat.c b/localedata/tests-mbwc/dat_wcscat.c new file mode 100644 index 0000000000..eaca19de18 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcscat.c @@ -0,0 +1,112 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_wcscat.c + * + * WCSCAT: wchar_t *wcscat (wchar_t *ws1, wchar_t *ws2) + */ + +/* NOTE: + Since this is not a locale sensitive function, + it doesn't make sense to test the function on some + locales. Better make different test cases for each locale ... + (Also some wc* functions are not locale sensitive.) +*/ + + +TST_WCSCAT tst_wcscat_loc [] = { + + { + {Twcscat, TST_LOC_de}, + { + /* 1 */ + {{{ 0x00C1,0x00C2,0x0000 }, + { 0x00C3,0x00C4,0x0000 }, }, + { 0, 0, 0, 0, + { 0x00C1,0x00C2,0x00C3,0x00C4,0x0000 } }, + }, + /* 2 */ + {{{ 0x0001,0x0002,0x0000 }, + { 0x0003,0x0004,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0001,0x0002,0x0003,0x0004,0x0000 } }, + }, + /* 3 */ + {{{ 0x0000 }, + { 0x00C3,0x00C4,0x0000 }, }, + { 0, 0, 0, 0, + { 0x00C3,0x00C4,0x0000 } }, + }, + /* 4 */ + {{{ 0x0001,0xFFFF,0x0000 }, + { 0x0080,0x0090,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0001,0xFFFF,0x0080,0x0090,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcscat, TST_LOC_enUS}, + { + /* 1 */ + {{{ 0x0041,0x0042,0x0000 }, + { 0x0043,0x0044,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0041,0x0042,0x0043,0x0044,0x0000 } }, + }, + /* 2 */ + {{{ 0x0001,0x0002,0x0000 }, + { 0x0003,0x0004,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0001,0x0002,0x0003,0x0004,0x0000 } }, + }, + /* 3 */ + {{{ 0x0000 }, + { 0x0043,0x0044,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0043,0x0044,0x0000 } }, + }, + /* 4 */ + {{{ 0x0001,0xFFFF,0x0000 }, + { 0x0080,0x0090,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0001,0xFFFF,0x0080,0x0090,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcscat, TST_LOC_eucJP}, + { + /* 1 */ + {{{ 0x30A2,0x74E0,0x0000 }, + { 0xFF71,0x0041,0x0000 }, }, + { 0, 0, 0, 0, + { 0x30A2,0x74E0,0xFF71,0x0041,0x0000 } }, + }, + /* 2 */ + {{{ 0x0001,0x0002,0x0000 }, + { 0x0003,0x0004,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0001,0x0002,0x0003,0x0004,0x0000 } }, + }, + /* 3 */ + {{{ 0x30A2,0xFF71,0x0000 }, + { 0x0000 }, }, + { 0, 0, 0, 0, + { 0x30A2,0xFF71,0x0000 } }, + }, + /* 4 */ + {{{ 0x0001,0xFFFF,0x0000 }, + { 0x0080,0x0090,0x0000 }, }, + { 0, 0, 0, 0, + { 0x0001,0xFFFF,0x0080,0x0090,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcscat, TST_LOC_end} + } +}; diff --git a/localedata/tests-mbwc/dat_wcscmp.c b/localedata/tests-mbwc/dat_wcscmp.c new file mode 100644 index 0000000000..72d1c6b641 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcscmp.c @@ -0,0 +1,133 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_wcscmp.c + * + * WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2); + */ + +/* NOTE: + This is not a locale sensitive function and + it may not make sence testing it for each locale ... +*/ + + +TST_WCSCMP tst_wcscmp_loc [] = { + { + { Twcscmp, TST_LOC_de }, + { + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x00D1,0x00D3,0x0000 }, + { 0x0000,0x00D2,0x00D3,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x00D1,0x00D1,0x00D3,0x0000 }, + { 0x0000,0x00D2,0x00D3,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,1,0x00D1, }, + }, + { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D1,0x00D3,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,1,-0x00D1, }, + }, + { /*input.*/ { { 0x00D1,0x00D5,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 }, + { 0x00D1,0x00D2,0x00D9,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,1,-6, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x0000 }, + { 0x00D1,0x00D2,0x00D9,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,1,-0x00D9, }, + }, + { /*input.*/ { { 0x00D1,0x00D2,0x00D9,0x0000 }, + { 0x00D1,0x00D2,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,1,0x00D9, }, + }, + { is_last: 1 } + } + }, + { + { Twcscmp, TST_LOC_enUS }, + { + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 }, + { 0x0000,0x0042,0x0043,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 }, + { 0x0000,0x0042,0x0043,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,1,0x0041, }, + }, + { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, + { 0x0041,0x0041,0x0043,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,1,-0x0041, }, + }, + { /*input.*/ { { 0x0041,0x0045,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0042,0x0049,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,1,-6, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0000 }, + { 0x0041,0x0042,0x0049,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,1,-0x0049, }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 }, + { 0x0041,0x0042,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,1,0x0049, }, + }, + { is_last: 1 } + } + }, + { + { Twcscmp, TST_LOC_eucJP}, + { + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #1 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 }, + { 0x0000,0x3042,0x3043,0x0000 }, }, /* #2 */ + /*expect*/ { 0,0,1,0, }, + }, + { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 }, + { 0x0000,0x3042,0x3043,0x0000 }, }, /* #3 */ + /*expect*/ { 0,0,1,0x3041, }, + }, + { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, + { 0x3041,0x3041,0x3043,0x0000 }, }, /* #4 */ + /*expect*/ { 0,0,1,-0x3041, }, + }, + { /*input.*/ { { 0x3041,0x3045,0x3043,0x0000 }, + { 0x3041,0x3042,0x3043,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,1,3, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, + { 0x3041,0x3042,0x3049,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,1,-6, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x0000 }, + { 0x3041,0x3042,0x3049,0x0000 }, }, /* #7 */ + /*expect*/ { 0,0,1,-0x3049, }, + }, + { /*input.*/ { { 0x3041,0x3042,0x3049,0x0000 }, + { 0x3041,0x3042,0x0000 }, }, /* #8 */ + /*expect*/ { 0,0,1,0x3049, }, + }, + { is_last: 1 } + } + }, + { + { Twcschr, TST_LOC_end} + } +}; diff --git a/localedata/tests-mbwc/dat_wcsncat.c b/localedata/tests-mbwc/dat_wcsncat.c new file mode 100644 index 0000000000..526d800dc0 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcsncat.c @@ -0,0 +1,154 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_wcsncat.c + * + * WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, wchar_t *ws2, size_t n); + */ + + +/* + * Note: + * A terminating null wide chararacter is always appended to + * the result: ws1. + * + */ + + +TST_WCSNCAT tst_wcsncat_loc [] = { + { + {Twcsncat, TST_LOC_de}, + { + /* 1 */ + { + /* Input: */ + {{ 0x00D1,0x00D2,0x0000 }, + { 0x00D3,0x00D4,0x0000 }, 3 }, + /* Expect: */ + { 0, 0, 0, 0, + { 0x00D1,0x00D2,0x00D3,0x00D4,0x0000 } }, + }, + /* 2 */ + {{{ 0x00D1,0x00D2,0x0000 }, + { 0x00D3,0x00D4,0x0000 }, 2 }, + { 0, 0, 0, 0, + { 0x00D1,0x00D2,0x00D3,0x00D4,0x0000 } }, + }, + /* 3 */ + {{{ 0x00E1,0x00E2,0x0000 }, + { 0x00E3,0x00E4,0x0000 }, 1 }, + { 0, 0, 0, 0, + { 0x00E1,0x00E2,0x00E3,0x0000 } }, + }, + /* 4 */ + {{{ 0x00E1,0x00E2,0x0000 }, + { 0x00E3,0x00E4,0x0000 }, 0 }, + { 0, 0, 0, 0, + { 0x00E1,0x00E2,0x0000 } }, + }, + /* 5 */ + {{{ 0x0000 }, + { 0x00D3,0x00D4,0x0000 }, 3 }, + { 0, 0, 0, 0, + { 0x00D3,0x00D4,0x0000 } }, + }, + /* 6 */ + {{{ 0x00E1,0x00E2,0x0000 }, + { 0x0000 }, 3 }, + { 0, 0, 0, 0, + { 0x00E1,0x00E2,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcsncat, TST_LOC_enUS}, + { + /* 1 */ + { + /* Input: */ + {{ 0x0041,0x0042,0x0000 }, + { 0x0043,0x0044,0x0000 }, 3 }, + /* Expect: */ + { 0, 0, 0, 0, + { 0x0041,0x0042,0x0043,0x0044,0x0000 } }, + }, + /* 2 */ + {{{ 0x0041,0x0042,0x0000 }, + { 0x0043,0x0044,0x0000 }, 2 }, + { 0, 0, 0, 0, + { 0x0041,0x0042,0x0043,0x0044,0x0000 } }, + }, + /* 3 */ + {{{ 0x0051,0x0052,0x0000 }, + { 0x0053,0x0054,0x0000 }, 1 }, + { 0, 0, 0, 0, + { 0x0051,0x0052,0x0053,0x0000 } }, + }, + /* 4 */ + {{{ 0x0051,0x0052,0x0000 }, + { 0x0053,0x0054,0x0000 }, 0 }, + { 0, 0, 0, 0, + { 0x0051,0x0052,0x0000 } }, + }, + /* 5 */ + {{{ 0x0000 }, + { 0x0043,0x0044,0x0000 }, 3 }, + { 0, 0, 0, 0, + { 0x0043,0x0044,0x0000 } }, + }, + /* 6 */ + {{{ 0x0051,0x0052,0x0000 }, + { 0x0000 }, 3 }, + { 0, 0, 0, 0, + { 0x0051,0x0052,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcsncat, TST_LOC_eucJP}, + { + /* 1 */ + {{{ 0x3041,0x3042,0x0000 }, + { 0x3043,0x3044,0x0000 }, 3 }, + { 0, 0, 0, 0, + { 0x3041,0x3042,0x3043,0x3044,0x0000 } }, + }, + /* 2 */ + {{{ 0x30A2,0x30A3,0x0000 }, + { 0xFF71,0xFF72,0x0000 }, 2 }, + { 0, 0, 0, 0, + { 0x30A2,0x30A3,0xFF71,0xFF72,0x0000 } }, + }, + /* 3 */ + {{{ 0x3051,0x3052,0x0000 }, + { 0x3053,0x3054,0x0000 }, 1 }, + { 0, 0, 0, 0, + { 0x3051,0x3052,0x3053,0x0000 } }, + }, + /* 4 */ + {{{ 0x3051,0x3052,0x0000 }, + { 0x3053,0x3054,0x0000 }, 0 }, + { 0, 0, 0, 0, + { 0x3051,0x3052,0x0000 } }, + }, + /* 5 */ + {{{ 0x0000 }, + { 0x3043,0x3044,0x0000 }, 3 }, + { 0, 0, 0, 0, + { 0x3043,0x3044,0x0000 } }, + }, + /* 6 */ + {{{ 0x3051,0x3052,0x0000 }, + { 0x0000 }, 3 }, + { 0, 0, 0, 0, + { 0x3051,0x3052,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcsncat, TST_LOC_end} + } +}; diff --git a/localedata/tests-mbwc/dat_wcsncpy.c b/localedata/tests-mbwc/dat_wcsncpy.c new file mode 100644 index 0000000000..6146b7e7f3 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcsncpy.c @@ -0,0 +1,115 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_wcsncpy.c + * + * WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2, + * size_t n); + */ + + +/* Note: + * + * An initial value of ws1 in the test program is defined as: + * + * #define WCSNUM_NCPY 7 + * wchar_t ws1 [WCSSIZE] = { 0x9999, 0x9999, 0x9999, 0x9999, + * 0x9999, 0x9999, 0x0000 }; + * */ + + +TST_WCSNCPY tst_wcsncpy_loc [] = { + { + {Twcsncpy, TST_LOC_de}, + { + /* 1 */ + {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 6 }, + { 0,0,0,0, { 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x0000,0x0000 } }, + }, + /* 2 */ + {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 5 }, + { 0,0,0,0, { 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x9999,0x0000 } }, + }, + /* 3 */ + {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 3 }, + { 0,0,0,0, { 0x00D1,0x00D2,0x00D3,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 4 */ + {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 2 }, + { 0,0,0,0, { 0x00D1,0x00D2,0x9999,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 5 */ + {{ { 0x00D1,0x00D2,0x00D3,0x0000 }, 0 }, + { 0,0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 6 */ + {{ { 0x0000,0x00D2,0x00D3,0x0000 }, 3 }, + { 0,0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcsncpy, TST_LOC_enUS}, + { + /* 1 */ + {{ { 0x0041,0x0042,0x0043,0x0000 }, 6 }, + { 0,0,0,0, { 0x0041,0x0042,0x0043,0x0000,0x0000,0x0000,0x0000 } }, + }, + /* 2 */ + {{ { 0x0041,0x0042,0x0043,0x0000 }, 5 }, + { 0,0,0,0, { 0x0041,0x0042,0x0043,0x0000,0x0000,0x9999,0x0000 } }, + }, + /* 3 */ + {{ { 0x0041,0x0042,0x0043,0x0000 }, 3 }, + { 0,0,0,0, { 0x0041,0x0042,0x0043,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 4 */ + {{ { 0x0041,0x0042,0x0043,0x0000 }, 2 }, + { 0,0,0,0, { 0x0041,0x0042,0x9999,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 5 */ + {{ { 0x0041,0x0042,0x0043,0x0000 }, 0 }, + { 0,0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 6 */ + {{ { 0x0000,0x0042,0x0043,0x0000 }, 3 }, + { 0,0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcsncpy, TST_LOC_eucJP}, + { + /* 1 */ + {{ { 0x3041,0x3042,0x3043,0x0000 }, 6 }, + { 0,0,0,0, { 0x3041,0x3042,0x3043,0x0000,0x0000,0x0000,0x0000 } }, + }, + /* 2 */ + {{ { 0x3041,0x3042,0x3043,0x0000 }, 5 }, + { 0,0,0,0, { 0x3041,0x3042,0x3043,0x0000,0x0000,0x9999,0x0000 } }, + }, + /* 3 */ + {{ { 0x3041,0x3042,0x3043,0x0000 }, 3 }, + { 0,0,0,0, { 0x3041,0x3042,0x3043,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 4 */ + {{ { 0x3041,0x3042,0x3043,0x0000 }, 2 }, + { 0,0,0,0, { 0x3041,0x3042,0x9999,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 5 */ + {{ { 0x3041,0x3042,0x3043,0x0000 }, 0 }, + { 0,0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 } }, + }, + /* 6 */ + {{ { 0x0000,0x3042,0x3043,0x0000 }, 3 }, + { 0,0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 } }, + }, + {is_last: 1} + } + }, + { + {Twcsncpy, TST_LOC_end} + } +}; diff --git a/localedata/tests-mbwc/dat_wcsxfrm.c b/localedata/tests-mbwc/dat_wcsxfrm.c new file mode 100644 index 0000000000..8d52efcf90 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcsxfrm.c @@ -0,0 +1,95 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY + * + * FILE: dat_wcsxfrm.c + * + * WCSXFRM: size_t wcsxfrm (char *s1, const char s2, size_t n); + */ + +/* + * NOTE: + * + * Return value and errno value are checked only for 2nd string: + * org2[]; n1 and n2 don't mean bytes to be translated. + * It means a buffer size including a null character. + * Results of this test depens on results of wcscoll(). + * If you got errors, check both test results. + */ + + +TST_WCSXFRM tst_wcsxfrm_loc [] = { + + { + { Twcsxfrm, TST_LOC_de }, + { + { /*inp*/ { { 0x00C1,0x0000 }, { 0x00C1,0x0000 }, 7, 7 }, /* #01 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x00E4,0x0000 }, { 0x00DC,0x0000 }, 7, 7 }, /* #04 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x00DC,0x0000 }, { 0x00E4,0x0000 }, 7, 7 }, /* #05 */ + /*exp*/ { 1,0, 0,0, }, + }, + { is_last: 1 } + } + }, + { + { Twcsxfrm, TST_LOC_enUS }, + { + { /*inp*/ { { 0x0041,0x0000 }, { 0x0041,0x0000 }, 7, 7 }, /* #01 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x0000,0x0000 }, { 0x0000,0x0000 }, 7, 7 }, /* #04 */ + /*exp*/ { 1,0, 0,0, }, + }, + + { /* <WAIVER> x 2 */ + /*inp*/ { { 0x3061,0x0000 }, { 0xFF42,0x0000 }, 7, 7 }, /* #05 */ + /* <WAIVER> */ + /*exp*/ { 1,EINVAL, 1,(size_t)-1, }, + }, + { is_last: 1 } + } + }, + { + { Twcsxfrm, TST_LOC_eucJP }, /* need more test data ! */ + { + { /*inp*/ { { 0x3041,0x0000 }, { 0x3041,0x0000 }, 7, 7 }, /* #01 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0x30A2,0x0000 }, { 0xFF71,0x0000 }, 7, 7 }, /* #04 */ + /*exp*/ { 1,0, 0,0, }, + }, + { /*inp*/ { { 0xFF71,0x0000 }, { 0x30A2,0x0000 }, 7, 7 }, /* #05 */ + /*exp*/ { 1,0, 0,0, }, + }, + /* <WAIVER> x 2 */ + { /*inp*/ { { 0x008E,0x0000 }, { 0x008F,0x0000 }, 7, 7 }, /* #06 */ + /*exp*/ { 1,EINVAL, 1,(size_t)-1, }, + }, + { is_last: 1 } + } + }, + { + { Twcsxfrm, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wcwidth.c b/localedata/tests-mbwc/dat_wcwidth.c new file mode 100644 index 0000000000..d57a3d4247 --- /dev/null +++ b/localedata/tests-mbwc/dat_wcwidth.c @@ -0,0 +1,100 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_wcwidth.c + * + * WCWIDTH: int wcwidth (wchar_t wc); + */ + +TST_WCWIDTH tst_wcwidth_loc [] = { + { + { Twcwidth, TST_LOC_de }, + { + { /*inp*/ { 0x0000 }, /* #01 */ + /*exp*/ { 0,0, 1,0, }, + }, + { /*inp*/ { 0x0020 }, /* #02 */ + /*exp*/ { 0,0, 1,1, }, + }, + { /*inp*/ { 0x007F }, /* #03 */ + /*exp*/ { 0,0, 1,-1, }, + }, + { /*inp*/ { 0x0080 }, /* #04 */ + /*exp*/ { 0,0, 1,-1, }, + }, + { /*inp*/ { 0x00A1 }, /* #05 */ + /*exp*/ { 0,0, 1,1, }, + }, + { /*inp*/ { 0x00C1 }, /* #06 */ + /*exp*/ { 0,0, 1,1, }, + }, + /* <WAIVER> */ /* CHECK : wint_t */ + { /*inp*/ { 0x3041 }, /* #07 */ + /*exp*/ { 0,0, 1,0, }, + }, + { is_last: 1 } + } + }, + { + { Twcwidth, TST_LOC_enUS }, + { + { /*inp*/ { 0x0000 }, /* #01 */ + /*exp*/ { 0,0, 1,0, }, + }, + { /*inp*/ { 0x0020 }, /* #02 */ + /*exp*/ { 0,0, 1,1, }, + }, + { /*inp*/ { 0x007F }, /* #03 */ + /*exp*/ { 0,0, 1,-1, }, + }, + { /*inp*/ { 0x0080 }, /* #04 */ + /*exp*/ { 0,0, 1,-1, }, + }, + /* <WAIVER> */ /* assume ascii */ + { /*inp*/ { 0x00A1 }, /* #05 */ + /*exp*/ { 0,0, 1,-1, }, + }, + /* <WAIVER> */ /* assume ascii */ + { /*inp*/ { 0x00C1 }, /* #06 */ + /*exp*/ { 0,0, 1,-1, }, + }, + /* <WAIVER> */ /* CHECK : wint_t */ + { /*inp*/ { 0x3041 }, /* #07 */ + /*exp*/ { 0,0, 1,-1, }, + }, + { is_last: 1 } + } + }, + { + { Twcwidth, TST_LOC_eucJP }, + { + { /*inp*/ { 0x0000 }, /* #01 */ + /*exp*/ { 0,0, 1,0, }, + }, + { /*inp*/ { 0x0020 }, /* #02 */ + /*exp*/ { 0,0, 1,1, }, + }, + { /*inp*/ { 0x007F }, /* #03 */ + /*exp*/ { 0,0, 1,-1, }, + }, + { /*inp*/ { 0x0080 }, /* #04 */ + /*exp*/ { 0,0, 1,-1, }, + }, + /* <NO_WAIVER> */ + { /*inp*/ { 0x00A1 }, /* #05 */ + /*exp*/ { 0,0, 1,0, }, + }, + /* jisx0212 */ + { /*inp*/ { 0x00C1 }, /* #06 */ + /*exp*/ { 0,0, 1,2, }, + }, + { /*inp*/ { 0x3041 }, /* #07 */ + /*exp*/ { 0,0, 1,2, }, + }, + { is_last: 1 } + } + }, + { + { Twcwidth, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/tst_iswctype.c b/localedata/tests-mbwc/tst_iswctype.c new file mode 100644 index 0000000000..3e79e092df --- /dev/null +++ b/localedata/tests-mbwc/tst_iswctype.c @@ -0,0 +1,53 @@ +/* + ISWCTYPE: int iswctype (wint_t wc, wctype_t desc); +*/ + +#define TST_FUNCTION iswctype + +#include "tsp_common.c" +#include "dat_iswctype.c" + + +int +tst_iswctype (FILE *fp, int debug_flg) +{ + TST_DECL_VARS (int); + wint_t wc; + const char *ts; + + TST_DO_TEST (iswctype) + { + TST_HEAD_LOCALE (iswctype, S_ISWCTYPE); + TST_DO_REC (iswctype) + { + TST_GET_ERRET (iswctype); + wc = TST_INPUT (iswctype).wc; + ts = TST_INPUT (iswctype).ts; + ret = iswctype (wc, wctype (ts)); + TST_SAVE_ERRNO; + if (debug_flg) + { + fprintf (stdout, "iswctype() [ %s : %d ] ret = %d\n", + locale, rec+1, ret); + } + + TST_IF_RETURN (S_ISWCTYPE) + { + if (ret != 0) + { + result (fp, C_SUCCESS, S_ISWCTYPE, locale, rec+1, + seq_num+1, 3, MS_PASSED); + } + else + { + err_count++; + result (fp, C_FAILURE, S_ISWCTYPE, locale, rec+1, + seq_num+1, 3, + "the function returned 0, but should be non-zero"); + } + } + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_towlower.c b/localedata/tests-mbwc/tst_towlower.c new file mode 100644 index 0000000000..7719b0daea --- /dev/null +++ b/localedata/tests-mbwc/tst_towlower.c @@ -0,0 +1,11 @@ +/* + TOWLOWER: int towlower (wint_t wc); +*/ + +#define TST_FUNCTION towlower + +#include "tsp_common.c" +#include "dat_towlower.c" + + +TST_FUNC_TOW (LOWER, lower); diff --git a/localedata/tests-mbwc/tst_towupper.c b/localedata/tests-mbwc/tst_towupper.c new file mode 100644 index 0000000000..a077d27d9e --- /dev/null +++ b/localedata/tests-mbwc/tst_towupper.c @@ -0,0 +1,10 @@ +/* + TOWUPPER: int towupper (wint_t wc); +*/ + +#define TST_FUNCTION towupper + +#include "tsp_common.c" +#include "dat_towupper.c" + +TST_FUNC_TOW (UPPER, upper); diff --git a/localedata/tests-mbwc/tst_wcscat.c b/localedata/tests-mbwc/tst_wcscat.c new file mode 100644 index 0000000000..a2c4c5708b --- /dev/null +++ b/localedata/tests-mbwc/tst_wcscat.c @@ -0,0 +1,78 @@ +/* + WCSCAT: wchar_t *wcscat (wchar_t *ws1, const wchar_t *ws2); +*/ + +#define TST_FUNCTION wcscat + +#include "tsp_common.c" +#include "dat_wcscat.c" + +int +tst_wcscat (FILE * fp, int debug_flg) +{ + TST_DECL_VARS (wchar_t *); + wchar_t *ws1, *ws2, *ws_ex; + int i, err; + + TST_DO_TEST (wcscat) + { + TST_HEAD_LOCALE (wcscat, S_WCSCAT); + TST_DO_REC (wcscat) + { + TST_GET_ERRET (wcscat); + ws1 = TST_INPUT (wcscat).ws1; /* external value: size WCSSIZE */ + ws2 = TST_INPUT (wcscat).ws2; + + TST_CLEAR_ERRNO; + ret = wcscat (ws1, ws2); + TST_SAVE_ERRNO; + + TST_IF_RETURN (S_WCSCAT) + { + if (ret == ws1) + { + Result (C_SUCCESS, S_WCSCAT, CASE_3, MS_PASSED); + } + else + { + err_count++; + Result (C_FAILURE, S_WCSCAT, CASE_3, + "the return address may not be correct"); + } + } + + /* function specific test cases here */ + + if (ret == ws1) + { + ws_ex = TST_EXPECT (wcscat).ws; + for (err = 0, i = 0; + (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++) + { + if (debug_flg) + { + fprintf (stdout, "tst_wcscat() : ws1[%d] = 0x%x\n", i, + ws1[i]); + } + + if (ws1[i] != ws_ex[i]) + { + err++; + err_count++; + Result (C_FAILURE, S_WCSCAT, CASE_4, + "concatinated string is different from an " + "expected string"); + break; + } + } + + if (!err) + { + Result (C_SUCCESS, S_WCSCAT, CASE_4, MS_PASSED); + } + } + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcscmp.c b/localedata/tests-mbwc/tst_wcscmp.c new file mode 100644 index 0000000000..ecd825c228 --- /dev/null +++ b/localedata/tests-mbwc/tst_wcscmp.c @@ -0,0 +1,39 @@ +/* + WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2); +*/ + +#define TST_FUNCTION wcscmp + +#include "tsp_common.c" +#include "dat_wcscmp.c" + + +int +tst_wcscmp (FILE * fp, int debug_flg) +{ + TST_DECL_VARS (int); + wchar_t *ws1, *ws2; + + TST_DO_TEST (wcscmp) + { + TST_HEAD_LOCALE (wcscmp, S_WCSCMP); + TST_DO_REC (wcscmp) + { + TST_GET_ERRET (wcscmp); + ws1 = TST_INPUT (wcscmp).ws1; + ws2 = TST_INPUT (wcscmp).ws2; + ret = wcscmp (ws1, ws2); + + if (debug_flg) + { + fprintf (stderr, "tst_wcscmp: ret = %d\n", ret); + } + + TST_IF_RETURN (S_WCSCMP) + { + }; + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcsncat.c b/localedata/tests-mbwc/tst_wcsncat.c new file mode 100644 index 0000000000..9342eb09ac --- /dev/null +++ b/localedata/tests-mbwc/tst_wcsncat.c @@ -0,0 +1,74 @@ +/* + WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, size_t n); +*/ + +#define TST_FUNCTION wcsncat + +#include "tsp_common.c" +#include "dat_wcsncat.c" + +int +tst_wcsncat (FILE * fp, int debug_flg) +{ + TST_DECL_VARS (wchar_t *); + wchar_t *ws1, *ws2, *ws_ex; + int n, i, err; + + TST_DO_TEST (wcsncat) + { + TST_HEAD_LOCALE (wcsncat, S_WCSNCAT); + TST_DO_REC (wcsncat) + { + TST_GET_ERRET (wcsncat); + ws1 = TST_INPUT (wcsncat).ws1; /* external value: size WCSSIZE */ + ws2 = TST_INPUT (wcsncat).ws2; + n = TST_INPUT (wcsncat).n; + ret = wcsncat (ws1, ws2, n); + + TST_IF_RETURN (S_WCSNCAT) + { + if (ret == ws1) + { + Result (C_SUCCESS, S_WCSNCAT, CASE_3, MS_PASSED); + } + else + { + err_count++; + Result (C_FAILURE, S_WCSNCAT, CASE_3, + "the return address may not be correct"); + } + } + + if (ret == ws1) + { + ws_ex = TST_EXPECT (wcsncat).ws; + + for (err = 0, i = 0; + (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++) + { + if (debug_flg) + { + fprintf (stderr, "ws1[%d] = 0x%x\n", i, ws1[i]); + } + + if (ws1[i] != ws_ex[i]) + { + err++; + err_count++; + Result (C_FAILURE, S_WCSNCAT, CASE_4, + "the concatinated string has " + "different value from an expected string"); + break; + } + } + + if (!err) + { + Result (C_SUCCESS, S_WCSNCAT, CASE_4, MS_PASSED); + } + } + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcsncpy.c b/localedata/tests-mbwc/tst_wcsncpy.c new file mode 100644 index 0000000000..cf27271ebd --- /dev/null +++ b/localedata/tests-mbwc/tst_wcsncpy.c @@ -0,0 +1,92 @@ +/* + WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2, size_t n); +*/ + +#define TST_FUNCTION wcsncpy + +#include "tsp_common.c" +#include "dat_wcsncpy.c" + +#define WCSNUM_NCPY 7 + +int +tst_wcsncpy (FILE *fp, int debug_flg) +{ + TST_DECL_VARS (wchar_t *); + wchar_t ws1[WCSSIZE] = + { 0x9999, 0x9999, 0x9999, 0x9999, 0x9999, 0x9999, 0x0000 }; + wchar_t *ws2, *ws_ex; + int err, i; + size_t n; + + TST_DO_TEST (wcsncpy) + { + TST_HEAD_LOCALE (wcsncpy, S_WCSNCPY); + TST_DO_REC (wcsncpy) + { + TST_GET_ERRET (wcsncpy); + + for (n = 0; n < WCSNUM_NCPY - 1; ++n) + { + ws1[n] = 0x9999; + } + + ws1[n] = 0; + ws2 = TST_INPUT (wcsncpy).ws; /* external value: size WCSSIZE */ + n = TST_INPUT (wcsncpy).n; + ret = wcsncpy (ws1, ws2, n); + + TST_IF_RETURN (S_WCSNCPY) + { + if (ret == ws1) + { + Result (C_SUCCESS, S_WCSNCPY, CASE_3, MS_PASSED); + } + else + { + err_count++; + Result (C_FAILURE, S_WCSNCPY, CASE_3, + "the return address may not be correct"); + } + } + + if (ret == ws1) + { + if (debug_flg) + { + fprintf (stderr, "\nwcsncpy: n = %d\n\n", n); + } + + ws_ex = TST_EXPECT (wcsncpy).ws; + + for (err = 0, i = 0; i < WCSNUM_NCPY && i < WCSSIZE; i++) + { + if (debug_flg) + fprintf (stderr, + "wcsncpy: ws1[ %d ] = 0x%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_WCSNCPY, CASE_4, + "copied string is different from an " + "expected string"); + break; + } + } + + if (!err) + { + Result (C_SUCCESS, S_WCSNCPY, CASE_4, MS_PASSED); + } + + /* A null terminate character is not supposed to be copied + unless (num chars of ws2)<n. */ + } + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcsxfrm.c b/localedata/tests-mbwc/tst_wcsxfrm.c new file mode 100644 index 0000000000..38d541fffa --- /dev/null +++ b/localedata/tests-mbwc/tst_wcsxfrm.c @@ -0,0 +1,122 @@ +/* + WCSXFRM: size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t n); +*/ + +#define TST_FUNCTION wcsxfrm + +#include "tsp_common.c" +#include "dat_wcsxfrm.c" + +int +tst_wcsxfrm (FILE * fp, int debug_flg) +{ + TST_DECL_VARS (size_t); + wchar_t *org1, *org2; + wchar_t frm1[MBSSIZE], frm2[MBSSIZE]; + size_t n1, n2; + int ret_coll, ret_cmp; + + TST_DO_TEST (wcsxfrm) + { + TST_HEAD_LOCALE (wcsxfrm, S_WCSXFRM); + TST_DO_REC (wcsxfrm) + { + TST_GET_ERRET (wcsxfrm); + org1 = TST_INPUT (wcsxfrm).org1; + org2 = TST_INPUT (wcsxfrm).org2; + n1 = TST_INPUT (wcsxfrm).n1; + n2 = TST_INPUT (wcsxfrm).n2; + if (n1 < 0 || sizeof (frm1) < n1 || sizeof (frm2) < n2) + { + warn_count++; + Result (C_IGNORED, S_WCSXFRM, CASE_9, + "input data n1 or n2 is invalid"); + continue; + } + + /* an errno and a return value are checked + only for 2nd wcsxfrm() call. + A result of 1st call is used to compare + those 2 values by using wcscmp(). + */ + + TST_CLEAR_ERRNO; + ret = wcsxfrm (frm1, org1, n1); /* First call */ + TST_SAVE_ERRNO; + + if (debug_flg) + { + fprintf (stdout, "tst_wcsxfrm() : REC = %d\n", rec + 1); + fprintf (stdout, "tst_wcsxfrm() : 1st ret = %d\n", ret); + } + + if (ret == -1 || ret >= n1 || errno_save != 0) + { + warn_count++; + Result (C_INVALID, S_WCSXFRM, CASE_8, + "got an error in fist wcsxfrm() call"); + continue; + } + + TST_CLEAR_ERRNO; + /* Second call */ + ret = wcsxfrm (((n2 == 0) ? NULL : frm2), org2, n2); + TST_SAVE_ERRNO; + + TST_IF_RETURN (S_WCSXFRM) + { + }; + + if (n2 == 0 || ret >= n2 || errno != 0) + { +#if 0 + warn_count++; + Result (C_IGNORED, S_WCSXFRM, CASE_7, "did not get a result"); +#endif + continue; + } + + if (debug_flg) + { + fprintf (stdout, "tst_wcsxfrm() : 2nd ret = %d\n", ret); + } + + /* wcscoll() */ + TST_CLEAR_ERRNO; + /* depends on wcscoll() ... not good though ... */ + ret_coll = wcscoll (org1, org2); + TST_SAVE_ERRNO; + + if (errno != 0) /* bugs * bugs may got correct results ... */ + { + warn_count++; + Result (C_INVALID, S_WCSXFRM, CASE_6, + "got an error in wcscoll() call"); + continue; + } + /* wcscmp() */ + ret_cmp = wcscmp (frm1, frm2); + + if ((ret_coll == ret_cmp) || (ret_coll > 0 && ret_cmp > 0) + || (ret_coll < 0 && ret_cmp < 0)) + { + Result (C_SUCCESS, S_WCSXFRM, CASE_3, + MS_PASSED " (depends on wcscoll & wcscmp)"); + } + else + { + err_count++; + Result (C_FAILURE, S_WCSXFRM, CASE_3, + "results from wcscoll & wcscmp() do not match"); + } + + if (debug_flg) + { + fprintf (stdout, "tst_wcsxfrm() : coll = %d <-> %d = cmp\n", + ret_coll, ret_cmp); + } + } + } + + return err_count; +} diff --git a/localedata/tests-mbwc/tst_wcwidth.c b/localedata/tests-mbwc/tst_wcwidth.c new file mode 100644 index 0000000000..6a5af6fa39 --- /dev/null +++ b/localedata/tests-mbwc/tst_wcwidth.c @@ -0,0 +1,38 @@ +/* + WCWIDTH: int wcwidth (wchar_t wc); +*/ + +#define TST_FUNCTION wcwidth + +#include "tsp_common.c" +#include "dat_wcwidth.c" + +int +tst_wcwidth (FILE * fp, int debug_flg) +{ + TST_DECL_VARS (int); + wchar_t wc; + + TST_DO_TEST (wcwidth) + { + TST_HEAD_LOCALE (wcwidth, S_WCWIDTH); + TST_DO_REC (wcwidth) + { + TST_GET_ERRET (wcwidth); + wc = TST_INPUT (wcwidth).wc; + ret = wcwidth (wc); + + if (debug_flg) + { + fprintf (stdout, "wcwidth() [ %s : %d ] ret = %d\n", locale, + rec + 1, ret); + } + + TST_IF_RETURN (S_WCWIDTH) + { + } + } + } + + return err_count; +} |