diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-06-28 04:27:24 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-06-28 04:27:24 +0000 |
commit | 0e16ecfa1e7689c0b3be626f9a3441ebb5710c70 (patch) | |
tree | 12a793be9d9a1f7a4a911239194bae33470dcb23 /localedata/tests-mbwc | |
parent | 37696206076f6f075542adfdc4b1fe49100e9f32 (diff) | |
download | glibc-0e16ecfa1e7689c0b3be626f9a3441ebb5710c70.tar.gz glibc-0e16ecfa1e7689c0b3be626f9a3441ebb5710c70.tar.xz glibc-0e16ecfa1e7689c0b3be626f9a3441ebb5710c70.zip |
Update.
* locale/programs/ld-ctype.c (ctype_finish): Take all characters from the input charset into account when generating the hash table. (allocate_arrays): Correct setting default width. Not all empty slots in the table are filled, only those not covert explicitly by the locale description and in the charset. * stdio-common/vfscanf.c: Make sure to always return WEOF and EOF for wide character version. For %C handling, test correct pointer variable for NULL. * wcsmbs/wctob.c: Handle WEOF special. * wcsmbs/wcwidth.h: 0xff in width array means invalid character. * wctype/wctype.h: Protect gcc-isms with __extension__. Avoid always-true test to avoid warning.
Diffstat (limited to 'localedata/tests-mbwc')
22 files changed, 234 insertions, 106 deletions
diff --git a/localedata/tests-mbwc/dat_iswcntrl.c b/localedata/tests-mbwc/dat_iswcntrl.c index 89d5021916..4eac814ec0 100644 --- a/localedata/tests-mbwc/dat_iswcntrl.c +++ b/localedata/tests-mbwc/dat_iswcntrl.c @@ -46,7 +46,11 @@ TST_ISW_LOC (CNTRL, cntrl) = { { TST_ISW_REC (enUS, cntrl) { { { WEOF }, { 0,0,1,0 } }, +#ifdef SHOJI_IS_RIGHT { { 0x0000 }, { 0,0,0,0 } }, +#else + { { 0x0000 }, { 0,0,1,0 } }, +#endif { { 0x001F }, { 0,0,0,0 } }, { { 0x0020 }, { 0,0,1,0 } }, { { 0x0021 }, { 0,0,1,0 } }, diff --git a/localedata/tests-mbwc/dat_iswctype.c b/localedata/tests-mbwc/dat_iswctype.c index ebdaedce57..7e481ff72f 100644 --- a/localedata/tests-mbwc/dat_iswctype.c +++ b/localedata/tests-mbwc/dat_iswctype.c @@ -210,7 +210,12 @@ TST_ISWCTYPE tst_iswctype_loc [] = { { { 0x0009, "blank" }, { 0,0,0,0 } }, { { 0x000B, "blank" }, { 0,0,1,0 } }, { { 0x0020, "blank" }, { 0,0,0,0 } }, +#ifdef SHOJI_IS_RIGHT { { 0x0000, "cntrl" }, { 0,0,0,0 } }, +#else + /* XXX U0000 has no properties at all. */ + { { 0x0000, "cntrl" }, { 0,0,1,0 } }, +#endif { { 0x001F, "cntrl" }, { 0,0,0,0 } }, { { 0x0020, "cntrl" }, { 0,0,1,0 } }, { { 0x0021, "cntrl" }, { 0,0,1,0 } }, @@ -531,8 +536,13 @@ TST_ISWCTYPE tst_iswctype_loc [] = { { { 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. */ +#ifdef SHOJI_IS_RIGHT /* <NO_WAIVER>: */ { { 0x4E06, "jkanji" }, { 0,0,1,1 } }, /* CJK UNI.IDEO.NON-J */ +#else + /* XXX This character does not exist in EUC-JP. */ + { { 0x4E06, "jkanji" }, { 0,0,1,0 } }, /* CJK UNI.IDEO.NON-J */ +#endif { { 0x4E07, "jkanji" }, { 0,0,0,0 } }, /* CJK UNI.IDEO. */ { is_last: 1 } } diff --git a/localedata/tests-mbwc/dat_iswprint.c b/localedata/tests-mbwc/dat_iswprint.c index 47fa4167da..70abb6635e 100644 --- a/localedata/tests-mbwc/dat_iswprint.c +++ b/localedata/tests-mbwc/dat_iswprint.c @@ -65,7 +65,9 @@ TST_ISW_LOC (PRINT, print) = { { { 0x007E }, { 0,0,0,0 } }, { { 0x007F }, { 0,0,1,0 } }, { { 0x0080 }, { 0,0,1,0 } }, /* 20 */ +#ifdef NO_WAIVER { { 0x3042 }, { 0,0,1,0 } }, /* <WAIVER> */ +#endif { is_last: 1 } /* Last element. */ } }, @@ -120,4 +122,3 @@ TST_ISW_LOC (PRINT, print) = { }, { TST_ISW_REC (end, print) } }; - diff --git a/localedata/tests-mbwc/dat_swscanf.c b/localedata/tests-mbwc/dat_swscanf.c index 24274401ba..cce5b336e6 100644 --- a/localedata/tests-mbwc/dat_swscanf.c +++ b/localedata/tests-mbwc/dat_swscanf.c @@ -33,7 +33,6 @@ TST_SWSCANF tst_swscanf_loc [] = }, }, /*------------------------ 02 -----------------------*/ - /* <NO_WAIVER> x 2 */ { { { 0x00E4, 0x00C4, 0x0000 /* "äÄ" */ }, @@ -60,8 +59,13 @@ TST_SWSCANF tst_swscanf_loc [] = }, L"1%d:2%d:3%d:4%d:5%d:6%d:7%d:8%d:9%d", 0 }, - { 1,EINVAL,1,EOF, +#ifdef SHOJI_IS_RIGHT + { 1,EINVAL,1,WEOF, + 0,0,0,0,"", { 0x0000 }, +#else + { 0,0,1,0, 0,0,0,0,"", { 0x0000 }, +#endif }, }, /*---------------------------------------------------*/ @@ -136,7 +140,6 @@ TST_SWSCANF tst_swscanf_loc [] = }, }, /*------------------------ 03 -----------------------*/ - /* <NO_WAIVER> */ { { { 0x0031, 0x003A, 0x0030, 0x003A, @@ -144,12 +147,16 @@ TST_SWSCANF tst_swscanf_loc [] = 0x0061, 0x003A, 0x0063, 0x0064, 0x0000, 0x0000, }, - L"%2$d:%1$u:%f:%c:%s", 0 + L"%2$d:%1$u:%3$f:%4$c:%5$s", 0 }, { 1,0,1,5, 0, 1, 3.9, 'a', "cd", { 0x0000 } }, }, +#ifdef SHOJI_IS_RIGHT + /* XXX This test does not make sense. The format string is + L"\x1\x2\x25\x53" and it is supposed to match the words + 0x30A2, 0x30A4, 0x0001. */ /*------------------------ 04 -----------------------*/ /* <NO_WAIVER> x 2 */ { { { @@ -161,6 +168,7 @@ TST_SWSCANF tst_swscanf_loc [] = 0,0,0,0,"", { 0x0000 } }, }, +#endif /*---------------------------------------------------*/ { is_last: 1} /* Last element. */ } diff --git a/localedata/tests-mbwc/dat_towctrans.c b/localedata/tests-mbwc/dat_towctrans.c index 0baeb9bb09..53083e3bac 100644 --- a/localedata/tests-mbwc/dat_towctrans.c +++ b/localedata/tests-mbwc/dat_towctrans.c @@ -38,7 +38,11 @@ TST_TOWCTRANS tst_towctrans_loc [] = { { { Ttowctrans, TST_LOC_de }, { +#ifdef SHOJI_IS_RIGHT { { 0x0010, "tojkata" }, { 1,EINVAL,1,0x0010 } }, +#else + { { 0x0010, "tojkata" }, { 1,0, 1,0x0010 } }, +#endif { { 0x0080, "tolower" }, { 1,0, 1,0x0080 } }, { { 0x00EC, "toupper" }, { 1,0, 1,0x00CC } }, { { 0x00CC, "tolower" }, { 1,0, 1,0x00EC } }, @@ -48,7 +52,11 @@ TST_TOWCTRANS tst_towctrans_loc [] = { { { Ttowctrans, TST_LOC_enUS }, { +#ifdef SHOJI_IS_RIGHT { { 0x0010, "xxxxxxx" }, { 1,EINVAL,1,0x0010 } }, +#else + { { 0x0010, "xxxxxxx" }, { 1,0, 1,0x0010 } }, +#endif { { 0x007F, "tolower" }, { 1,0, 1,0x007F } }, { { 0x0061, "toupper" }, { 1,0, 1,0x0041 } }, { { 0x0041, "tolower" }, { 1,0, 1,0x0061 } }, diff --git a/localedata/tests-mbwc/dat_wcscoll.c b/localedata/tests-mbwc/dat_wcscoll.c index d087fc6344..ffedacab1e 100644 --- a/localedata/tests-mbwc/dat_wcscoll.c +++ b/localedata/tests-mbwc/dat_wcscoll.c @@ -104,6 +104,7 @@ TST_WCSCOLL tst_wcscoll_loc [] = { { 0x0041,0x0041,0x0043,0x0000 }, }, /* #4 */ /*expect*/ { 0,0,0,0, -1, }, }, +#ifdef SHOJI_IS_RIGHT /* <WAIVER> */ /* assume ascii */ { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, { 0x0041,0x0061,0x0043,0x0000 }, }, /* #5 */ @@ -114,6 +115,17 @@ TST_WCSCOLL tst_wcscoll_loc [] = { { 0x0041,0x0042,0x0043,0x0000 }, }, /* #6 */ /*expect*/ { 0,0,0,0, +1, }, }, +#else + /* XXX Correct order is lowercase before uppercase. */ + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, + { 0x0041,0x0061,0x0043,0x0000 }, }, /* #5 */ + /*expect*/ { 0,0,0,0, +1, }, + }, + { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 }, + { 0x0041,0x0042,0x0043,0x0000 }, }, /* #6 */ + /*expect*/ { 0,0,0,0, -1, }, + }, +#endif { /*input.*/ { { 0x0041,0x0042,0x0000 }, { 0x0041,0x0042,0x0049,0x0000 }, }, /* #7 */ /*expect*/ { 0,0,0,0, -1, }, @@ -122,6 +134,7 @@ TST_WCSCOLL tst_wcscoll_loc [] = { { 0x0041,0x0042,0x0000 }, }, /* #8 */ /*expect*/ { 0,0,0,0, +1, }, }, +#ifdef SHOJI_IS_RIGHT { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 }, { 0x0041,0x008E,0x0049,0x0000 }, }, /* #9 */ /*expect*/ { 1,0,0,0, +1, }, @@ -130,6 +143,17 @@ TST_WCSCOLL tst_wcscoll_loc [] = { { 0x0041,0x0092,0x0049,0x0000 }, }, /* #10 */ /*expect*/ { 0,0,0,0, -1, }, }, +#else + /* Do not assume position of character out of range. */ + { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 }, + { 0x0041,0x008E,0x0049,0x0000 }, }, /* #9 */ + /*expect*/ { 1,0,0,0, 0, }, + }, + { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 }, + { 0x0041,0x0092,0x0049,0x0000 }, }, /* #10 */ + /*expect*/ { 0,0,0,0, 0, }, + }, +#endif { is_last: 1 } } }, diff --git a/localedata/tests-mbwc/dat_wcswidth.c b/localedata/tests-mbwc/dat_wcswidth.c index f8d51341d7..a1c7076e60 100644 --- a/localedata/tests-mbwc/dat_wcswidth.c +++ b/localedata/tests-mbwc/dat_wcswidth.c @@ -64,10 +64,10 @@ TST_WCSWIDTH tst_wcswidth_loc [] = { { /*input.*/ { { 0x00C1,0x00FF,0x0000 }, 2 }, /* 18 */ /*expect*/ { 0,0,1,2 }, }, - { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */ /* <WAIVER> */ /* returns 2 */ + { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */ /*expect*/ { 0,0,1,-1 }, }, - { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */ /* <WAIVER> */ /* returns 2 */ + { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */ /*expect*/ { 0,0,1,-1 }, }, { is_last: 1 } @@ -85,12 +85,21 @@ TST_WCSWIDTH tst_wcswidth_loc [] = { { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 2 }, /* 03 */ /*expect*/ { 0,0,1,2 }, }, +#ifdef SHOJI_IS_RIGHT { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */ /*expect*/ { 0,0,1,3 }, }, { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 4 }, /* 05 */ /*expect*/ { 0,0,1,3 }, }, +#else + { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */ + /*expect*/ { 0,0,1,-1 }, + }, + { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* 05 */ + /*expect*/ { 0,0,1,3 }, + }, +#endif { /*input.*/ { { 0x0000 }, 1 }, /* 06 */ /*expect*/ { 0,0,1,0 }, }, @@ -124,17 +133,24 @@ TST_WCSWIDTH tst_wcswidth_loc [] = { { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */ /*expect*/ { 0,0,1,-1 }, }, +#ifdef SHOJI_IS_RIGHT { /*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 */ +#else + { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 17 */ + /*expect*/ { 0,0,1,2 }, + }, + { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 18 */ + /*expect*/ { 0,0,1,2 }, + }, +#endif { /*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 }, }, @@ -192,10 +208,17 @@ TST_WCSWIDTH tst_wcswidth_loc [] = { { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */ /*expect*/ { 0,0,1,-1 }, }, +#ifdef NO_WAIVER /* <NO_WAIVER> */ /* returns 3 */ { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ /*expect*/ { 0,0,1,-1 }, }, +#else + /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */ + { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */ + /*expect*/ { 0,0,1,3 }, + }, +#endif { /*input.*/ { { 0x0041,0xFF71,0x0000 }, 2 }, /* 18 */ /*expect*/ { 0,0,1,2 }, }, diff --git a/localedata/tests-mbwc/dat_wcsxfrm.c b/localedata/tests-mbwc/dat_wcsxfrm.c index 8d52efcf90..46f99035c5 100644 --- a/localedata/tests-mbwc/dat_wcsxfrm.c +++ b/localedata/tests-mbwc/dat_wcsxfrm.c @@ -55,12 +55,13 @@ TST_WCSXFRM tst_wcsxfrm_loc [] = { { /*inp*/ { { 0x0000,0x0000 }, { 0x0000,0x0000 }, 7, 7 }, /* #04 */ /*exp*/ { 1,0, 0,0, }, }, - +#ifdef NO_WAIVER { /* <WAIVER> x 2 */ /*inp*/ { { 0x3061,0x0000 }, { 0xFF42,0x0000 }, 7, 7 }, /* #05 */ /* <WAIVER> */ /*exp*/ { 1,EINVAL, 1,(size_t)-1, }, }, +#endif { is_last: 1 } } }, @@ -82,10 +83,12 @@ TST_WCSXFRM tst_wcsxfrm_loc [] = { { /*inp*/ { { 0xFF71,0x0000 }, { 0x30A2,0x0000 }, 7, 7 }, /* #05 */ /*exp*/ { 1,0, 0,0, }, }, +#ifdef NO_WAIVER /* <WAIVER> x 2 */ { /*inp*/ { { 0x008E,0x0000 }, { 0x008F,0x0000 }, 7, 7 }, /* #06 */ /*exp*/ { 1,EINVAL, 1,(size_t)-1, }, }, +#endif { is_last: 1 } } }, diff --git a/localedata/tests-mbwc/dat_wctob.c b/localedata/tests-mbwc/dat_wctob.c index 9f30aff0ea..d40b74a85a 100644 --- a/localedata/tests-mbwc/dat_wctob.c +++ b/localedata/tests-mbwc/dat_wctob.c @@ -25,8 +25,14 @@ TST_WCTOB tst_wctob_loc [] = { { { WEOF }, { 0,0, 1, EOF } }, { { 0x0020 }, { 0,0, 1, 0x20 } }, { { 0x0061 }, { 0,0, 1, 0x61 } }, +#ifdef SHOJI_IS_RIGHT { { 0x0080 }, { 0,0, 1, 0x80 } }, { { 0x00C4 }, { 0,0, 1, 0xC4 } }, +#else + /* XXX These are no valid characters. */ + { { 0x0080 }, { 0,0, 1, EOF } }, + { { 0x00C4 }, { 0,0, 1, EOF } }, +#endif { { 0x30C4 }, { 0,0, 1, EOF } }, { is_last: 1 } /* Last element. */ } @@ -36,7 +42,12 @@ TST_WCTOB tst_wctob_loc [] = { { { WEOF }, { 0,0, 1, EOF } }, { { 0x0020 }, { 0,0, 1, 0x20 } }, { { 0x0061 }, { 0,0, 1, 0x61 } }, +#ifdef SHOJI_IS_RIGHT { { 0x0080 }, { 0,0, 1, 0x80 } }, /* <WAIVER> */ +#else + /* XXX These are no valid characters. */ + { { 0x0080 }, { 0,0, 1, EOF } }, +#endif { { 0x00C4 }, { 0,0, 1, EOF } }, { { 0x30C4 }, { 0,0, 1, EOF } }, { is_last: 1 } /* Last element. */ diff --git a/localedata/tests-mbwc/dat_wcwidth.c b/localedata/tests-mbwc/dat_wcwidth.c index d57a3d4247..5472d1f559 100644 --- a/localedata/tests-mbwc/dat_wcwidth.c +++ b/localedata/tests-mbwc/dat_wcwidth.c @@ -28,10 +28,16 @@ TST_WCWIDTH tst_wcwidth_loc [] = { { /*inp*/ { 0x00C1 }, /* #06 */ /*exp*/ { 0,0, 1,1, }, }, +#ifdef SHOJI_IS_RIGHT /* <WAIVER> */ /* CHECK : wint_t */ { /*inp*/ { 0x3041 }, /* #07 */ /*exp*/ { 0,0, 1,0, }, }, +#else + { /*inp*/ { 0x3041 }, /* #07 */ + /*exp*/ { 0,0, 1,EOF, }, + }, +#endif { is_last: 1 } } }, @@ -50,15 +56,12 @@ TST_WCWIDTH tst_wcwidth_loc [] = { { /*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, }, }, @@ -80,10 +83,17 @@ TST_WCWIDTH tst_wcwidth_loc [] = { { /*inp*/ { 0x0080 }, /* #04 */ /*exp*/ { 0,0, 1,-1, }, }, +#ifdef SHOJI_IS_RIGHT /* <NO_WAIVER> */ { /*inp*/ { 0x00A1 }, /* #05 */ /*exp*/ { 0,0, 1,0, }, }, +#else + /* XXX U00A1 is a valid character in EUC-JP. */ + { /*inp*/ { 0x00A1 }, /* #05 */ + /*exp*/ { 0,0, 1,2, }, + }, +#endif /* jisx0212 */ { /*inp*/ { 0x00C1 }, /* #06 */ /*exp*/ { 0,0, 1,2, }, diff --git a/localedata/tests-mbwc/tst_funcs.h b/localedata/tests-mbwc/tst_funcs.h index 95d0787e5d..e72154fa74 100644 --- a/localedata/tests-mbwc/tst_funcs.h +++ b/localedata/tests-mbwc/tst_funcs.h @@ -96,15 +96,15 @@ extern int result (FILE * fp, char res, const char *func, const char *loc, 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_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) \ @@ -131,36 +131,36 @@ extern int result (FILE * fp, char res, const char *func, const char *loc, #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"); \ - } \ - } \ +#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_) \ @@ -188,45 +188,45 @@ extern int result (FILE * fp, char res, const char *func, const char *loc, 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; \ +#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; \ } diff --git a/localedata/tests-mbwc/tst_swscanf.c b/localedata/tests-mbwc/tst_swscanf.c index 4f3286f5cf..8819a0ef94 100644 --- a/localedata/tests-mbwc/tst_swscanf.c +++ b/localedata/tests-mbwc/tst_swscanf.c @@ -59,7 +59,7 @@ tst_swscanf (FILE * fp, int debug_flg) if (TST_INPUT (swscanf).wch) { - fprintf (stdout, " val_S[ 0 ] = 0x%x\n", + fprintf (stdout, " val_S[ 0 ] = 0x%lx\n", val_S[0]); } else diff --git a/localedata/tests-mbwc/tst_towctrans.c b/localedata/tests-mbwc/tst_towctrans.c index 102b23628d..1d874dc0f7 100644 --- a/localedata/tests-mbwc/tst_towctrans.c +++ b/localedata/tests-mbwc/tst_towctrans.c @@ -14,7 +14,9 @@ tst_towctrans (FILE *fp, int debug_flg) TST_DECL_VARS (wint_t); wint_t wc; const char *ts; +#if SHOJI_IS_RIGHT int dummy=0; +#endif wctrans_t wto; TST_DO_TEST (towctrans) @@ -26,6 +28,7 @@ tst_towctrans (FILE *fp, int debug_flg) wc = TST_INPUT (towctrans).wc; ts = TST_INPUT (towctrans).ts; +#if SHOJI_IS_RIGHT if ((wto = wctrans (ts)) == (wctrans_t) 0) { #if 0 @@ -41,6 +44,9 @@ tst_towctrans (FILE *fp, int debug_flg) fprintf (stdout, "towctrans() ------ wctrans() returnd 0.\n"); } } +#else + wto = wctrans (ts); +#endif TST_CLEAR_ERRNO; ret = towctrans (wc, wto); diff --git a/localedata/tests-mbwc/tst_wcschr.c b/localedata/tests-mbwc/tst_wcschr.c index 3dcc1e893f..118baba304 100644 --- a/localedata/tests-mbwc/tst_wcschr.c +++ b/localedata/tests-mbwc/tst_wcschr.c @@ -27,7 +27,7 @@ tst_wcschr (FILE * fp, int debug_flg) { if (ret) { - fprintf (stderr, "wcschr: ret = 0x%x\n", *ret); + fprintf (stderr, "wcschr: ret = 0x%lx\n", *ret); } else { diff --git a/localedata/tests-mbwc/tst_wcscoll.c b/localedata/tests-mbwc/tst_wcscoll.c index d648fa3c60..929f80d800 100644 --- a/localedata/tests-mbwc/tst_wcscoll.c +++ b/localedata/tests-mbwc/tst_wcscoll.c @@ -44,9 +44,28 @@ tst_wcscoll (FILE * fp, int debug_flg) else { err_count++; - Result (C_FAILURE, S_WCSCOLL, CASE_3, - "the return value should be positive " - "/negative but it's negative/positive."); + if (cmp == 1) + { + if (ret == 0) + Result (C_FAILURE, S_WCSCOLL, CASE_3, + "the return value should be positive" + " but it's zero."); + else + Result (C_FAILURE, S_WCSCOLL, CASE_3, + "the return value should be positive" + " but it's negative."); + } + else + { + if (ret == 0) + Result (C_FAILURE, S_WCSCOLL, CASE_3, + "the return value should be negative" + " but it's zero."); + else + Result (C_FAILURE, S_WCSCOLL, CASE_3, + "the return value should be negative" + " but it's positive."); + } } } } diff --git a/localedata/tests-mbwc/tst_wcscpy.c b/localedata/tests-mbwc/tst_wcscpy.c index 2e9212e6ce..3dc6406a38 100644 --- a/localedata/tests-mbwc/tst_wcscpy.c +++ b/localedata/tests-mbwc/tst_wcscpy.c @@ -46,7 +46,7 @@ tst_wcscpy (FILE * fp, int debug_flg) if (debug_flg) { fprintf (stderr, - "ws1[ %d ] = 0x%x <-> wx_ex[ %d ] = 0x%x\n", i, + "ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n", i, ws1[i], i, ws_ex[i]); } diff --git a/localedata/tests-mbwc/tst_wcsncat.c b/localedata/tests-mbwc/tst_wcsncat.c index 9342eb09ac..4665f72ced 100644 --- a/localedata/tests-mbwc/tst_wcsncat.c +++ b/localedata/tests-mbwc/tst_wcsncat.c @@ -48,7 +48,7 @@ tst_wcsncat (FILE * fp, int debug_flg) { if (debug_flg) { - fprintf (stderr, "ws1[%d] = 0x%x\n", i, ws1[i]); + fprintf (stderr, "ws1[%d] = 0x%lx\n", i, ws1[i]); } if (ws1[i] != ws_ex[i]) diff --git a/localedata/tests-mbwc/tst_wcsncpy.c b/localedata/tests-mbwc/tst_wcsncpy.c index cf27271ebd..f2127d4a7d 100644 --- a/localedata/tests-mbwc/tst_wcsncpy.c +++ b/localedata/tests-mbwc/tst_wcsncpy.c @@ -63,7 +63,7 @@ tst_wcsncpy (FILE *fp, int debug_flg) { if (debug_flg) fprintf (stderr, - "wcsncpy: ws1[ %d ] = 0x%x <-> wx_ex[ %d ] = 0x%x\n", + "wcsncpy: ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n", i, ws1[i], i, ws_ex[i]); if (ws1[i] != ws_ex[i]) diff --git a/localedata/tests-mbwc/tst_wcspbrk.c b/localedata/tests-mbwc/tst_wcspbrk.c index 1bb0f6dc44..405c12531e 100644 --- a/localedata/tests-mbwc/tst_wcspbrk.c +++ b/localedata/tests-mbwc/tst_wcspbrk.c @@ -32,7 +32,7 @@ tst_wcspbrk (FILE * fp, int debug_flg) rec + 1, (ret == NULL) ? "null" : "not null"); if (ret) fprintf (stderr, - " ret[0] = 0x%x : 0x%x = ws2[0]\n", + " ret[0] = 0x%lx : 0x%lx = ws2[0]\n", ret[0], ws2[0]); } @@ -58,7 +58,7 @@ tst_wcspbrk (FILE * fp, int debug_flg) if (debug_flg) fprintf (stdout, - " *ret = 0x%x <-> 0x%x = wc_ex\n", + " *ret = 0x%lx <-> 0x%lx = wc_ex\n", *ret, wc_ex); if (*ret != wc_ex) diff --git a/localedata/tests-mbwc/tst_wcsstr.c b/localedata/tests-mbwc/tst_wcsstr.c index 02f756c37c..15654df0a9 100644 --- a/localedata/tests-mbwc/tst_wcsstr.c +++ b/localedata/tests-mbwc/tst_wcsstr.c @@ -31,7 +31,7 @@ tst_wcsstr (FILE * fp, int debug_flg) if (ret) { fprintf (stderr, - " ret[ 0 ] = 0x%x <-> 0x%x = ws2[ 0 ]\n", + " ret[ 0 ] = 0x%lx <-> 0x%lx = ws2[ 0 ]\n", ret[0], ws2[0]); } } @@ -59,8 +59,8 @@ tst_wcsstr (FILE * fp, int debug_flg) if (debug_flg) { fprintf (stderr, - " : ret[ %d ] = 0x%x <-> 0x%x = ws2[ %d ]\n", i, - ret[i], ws2[i], i); + " : ret[ %d ] = 0x%lx <-> 0x%lx = ws2[ %d ]\n", + i, ret[i], ws2[i], i); } if (ret[i] != ws2[i]) diff --git a/localedata/tests-mbwc/tst_wctrans.c b/localedata/tests-mbwc/tst_wctrans.c index 129b797fb3..b422d6ff94 100644 --- a/localedata/tests-mbwc/tst_wctrans.c +++ b/localedata/tests-mbwc/tst_wctrans.c @@ -27,7 +27,8 @@ tst_wctrans (FILE * fp, int debug_flg) if (debug_flg) { - fprintf (stderr, "tst_wctrans : [ %d ] ret = %d\n", rec + 1, ret); + fprintf (stderr, "tst_wctrans : [ %d ] ret = %ld\n", rec + 1, + (long int) ret); fprintf (stderr, " errno = %d\n", errno_save); } diff --git a/localedata/tests-mbwc/tst_wctype.c b/localedata/tests-mbwc/tst_wctype.c index 1ad30ce372..a203e49087 100644 --- a/localedata/tests-mbwc/tst_wctype.c +++ b/localedata/tests-mbwc/tst_wctype.c @@ -25,7 +25,7 @@ tst_wctype (FILE * fp, int debug_flg) if (debug_flg) { - fprintf (stderr, "tst_wctype : [ %d ] ret = %d\n", rec + 1, ret); + fprintf (stderr, "tst_wctype : [ %d ] ret = %ld\n", rec + 1, ret); } TST_IF_RETURN (S_WCTYPE) |