diff options
| -rw-r--r-- | localedata/ChangeLog | 21 | ||||
| -rw-r--r-- | localedata/Makefile | 12 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_mbtowc.c | 327 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_strcoll.c | 144 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_strxfrm.c | 112 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_wctomb.c | 139 | ||||
| -rw-r--r-- | localedata/tests-mbwc/tst_mbtowc.c | 126 | ||||
| -rw-r--r-- | localedata/tests-mbwc/tst_strcoll.c | 87 | ||||
| -rw-r--r-- | localedata/tests-mbwc/tst_strxfrm.c | 136 | ||||
| -rw-r--r-- | localedata/tests-mbwc/tst_wctomb.c | 99 |
10 files changed, 1201 insertions, 2 deletions
diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 8f1976de26..e7bfaf4d24 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,24 @@ +2000-06-29 Andreas Jaeger <aj@suse.de> + + * Makefile (locale_test_suite): Add new test files. + (tst_mblen-ENV): New. + (tst_mbtowc-ENV): New. + (tst_strcoll-ENV): New. + (tst_strxfrm-ENV): New. + (tst_wctomb-ENV): New. + + * tests-mbwc/tst_wctomb.c: New test file from Shoji Kuwabara + <kuwahara@cthulhu.engr.sgi.com>. + * tests-mbwc/dat_wctomb.c: Likewise. + * tests-mbwc/tst_mbtowc.c: Likewise. + * tests-mbwc/dat_mbtowc.c: Likewise. + * tests-mbwc/tst_strxfrm.c: Likewise. + * tests-mbwc/dat_strxfrm.c: Likewise. + * tests-mbwc/dat_strcoll.c: Likewise. + * tests-mbwc/tst_strcoll.c: Likewise. + * tests-mbwc/tst_mblen.c: Likewise. + * tests-mbwc/dat_mblen.c: Likewise. + 2000-06-28 Ulrich Drepper <drepper@redhat.com> * locales/mk_MK: Updated (not to new format). diff --git a/localedata/Makefile b/localedata/Makefile index 2a4356dbb3..fe6ea109c7 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -76,7 +76,6 @@ include ../Makeconfig ifeq (no,$(cross-compiling)) ifeq (yes,$(build-shared)) -# Disable the tests for now - first the locales have to be generated locale_test_suite := tst_iswalnum tst_iswprint tst_towctrans tst_wcsncmp \ tst_wctrans tst_iswalpha tst_iswpunct tst_wcschr \ tst_wcspbrk tst_wctype tst_iswcntrl tst_iswspace \ @@ -85,7 +84,10 @@ locale_test_suite := tst_iswalnum tst_iswprint tst_towctrans tst_wcsncmp \ tst_wcscspn tst_wcswidth tst_iswlower tst_swscanf \ tst_wcslen tst_wctob tst_iswctype tst_towlower \ tst_wcscat tst_towupper tst_wcscmp tst_wcsncat \ - tst_wcsncpy tst_wcsxfrm tst_wcwidth tst_mbrlen + tst_wcsncpy tst_wcsxfrm tst_wcwidth tst_mbrlen \ + tst_mblen tst_strcoll tst_strxfrm tst_mbtowc \ + tst_wctomb + tests = $(locale_test_suite) endif endif @@ -149,6 +151,7 @@ install-locales: $(inst_localedir)/$$locale; \ done < SUPPORTED +# The mbwc-tests need some environment setup to find the locale data files TEST_MBWC_ENV:= LOCPATH=$(common-objpfx)localedata tst_iswalnum-ENV = $(TEST_MBWC_ENV) tst_iswalpha-ENV = $(TEST_MBWC_ENV) @@ -162,7 +165,11 @@ tst_iswpunct-ENV = $(TEST_MBWC_ENV) tst_iswspace-ENV = $(TEST_MBWC_ENV) tst_iswupper-ENV = $(TEST_MBWC_ENV) tst_iswxdigit-ENV = $(TEST_MBWC_ENV) +tst_mblen-ENV = $(TEST_MBWC_ENV) tst_mbrlen-ENV = $(TEST_MBWC_ENV) +tst_mbtowc-ENV = $(TEST_MBWC_ENV) +tst_strcoll-ENV = $(TEST_MBWC_ENV) +tst_strxfrm-ENV = $(TEST_MBWC_ENV) tst_swscanf-ENV = $(TEST_MBWC_ENV) tst_towctrans-ENV = $(TEST_MBWC_ENV) tst_towlower-ENV = $(TEST_MBWC_ENV) @@ -183,6 +190,7 @@ tst_wcsstr-ENV = $(TEST_MBWC_ENV) tst_wcswidth-ENV = $(TEST_MBWC_ENV) tst_wcsxfrm-ENV = $(TEST_MBWC_ENV) tst_wctob-ENV = $(TEST_MBWC_ENV) +tst_wctomb-ENV = $(TEST_MBWC_ENV) tst_wctrans-ENV = $(TEST_MBWC_ENV) tst_wctype-ENV = $(TEST_MBWC_ENV) tst_wcwidth-ENV = $(TEST_MBWC_ENV) diff --git a/localedata/tests-mbwc/dat_mbtowc.c b/localedata/tests-mbwc/dat_mbtowc.c new file mode 100644 index 0000000000..1e3359465c --- /dev/null +++ b/localedata/tests-mbwc/dat_mbtowc.c @@ -0,0 +1,327 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_mbtowc.c + * + * MBTOWC: int mbtowc (wchar_t *wp, char *s, size_t n); + */ + +/* NOTE: + * + * int mbtowc (wchar_t *wp, char *s, size_t n); + * + * where n: a maximum number of bytes + * return: the number of bytes + * + * + * o When you feed a null pointer for a string (s) to the function, + * set s_flg=0 instead of putting just a 'NULL' there. + * Even if you put a 'NULL', it means a null string as well as "". + * + * o When s is a null pointer, the function checks state dependency. + * + * state-dependent encoding - return NON-zero + * state-independent encoding - return 0 + * + * If state-dependent encoding is expected, set + * + * s_flg = 0, ret_flg = 0, ret_val = +1 + * + * If state-independent encoding is expected, set + * + * s_flg = 0, ret_flg = 0, ret_val = 0 + * + * + * When you set ret_flg=1, the test program simply compares + * an actual return value with an expected value. You can + * check state-independent case (return value is 0) in that + * way, but you can not check state-dependent case. So when + * you check state- dependency in this test function: + * tst_mbtowc(), set ret_flg=0 always. It's a special case + * and the test function takes care of it. + * + * w_flg + * | s: (a null string; can't be (char *)NULL) + * | | + * input. { 1, 0, (char)NULL, MB_LEN_MAX }, + * | + * s_flg=0: makes _s_ a null pointer. + * + * expect { 0,0,0,x, 0x0000 }, + * | | + * | ret_val: 0/+1 + * ret_flg=0 + * + * + * Test data for State dependent encodings: + * + * mbtowc( NULL, NULL, 0 ); ... first data + * mbtowc( &wc, s1, n1 ); ... second data + * mbtowc( &wc, s2, n2 ); ... third data + * */ + +#include <limits.h> + +TST_MBTOWC tst_mbtowc_loc [] = { + { + { Tmbtowc, TST_LOC_de }, + { + { /*----------------- #01 -----------------*/ + { + { + { 1, 1, "üäö", 1 }, + { 1, 1, "üäö", 2 }, + { 1, 1, "üäö", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x00FC }, + { 0, 0, 1, 1, 0x00FC }, + { 0, 0, 1, 1, 0x00FC }, + } + } + }, + { /*----------------- #02 -----------------*/ + { + { + { 1, 1, "\177", MB_LEN_MAX }, + { 1, 1, "\200", MB_LEN_MAX }, + { 1, 1, "\201", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x007F }, + { 1, 0, 1, 1, 0x0080 }, + { 1, 0, 1, 1, 0x0081 }, + } + } + }, + { /*----------------- #03 -----------------*/ + { + { + { 1, 1, "", MB_LEN_MAX }, + { 0, 1, "üäö", 1 }, + { 0, 1, "üäö", 2 }, + } + }, + { + { + { 0, 0, 1, 0, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + } + } + }, + { /*----------------- #04 -----------------*/ + { + { + { 0, 1, "üäö", MB_LEN_MAX }, + { 0, 1, "\177", MB_LEN_MAX }, + { 0, 1, "", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 0, 0x0000 }, + } + } + }, + { /*----------------- #05 -----------------*/ + { + { + { 0, 1, "üäö", MB_LEN_MAX }, + { 0, 1, "\177", MB_LEN_MAX }, + { 0, 0, (char)NULL, MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 0, 0, 0x0000 }, + } + } + }, + { is_last: 1 } + } + }, + { + { Tmbtowc, TST_LOC_enUS }, + { + { /*----------------- #01 -----------------*/ + { + { + { 1, 1, "ABC", 1 }, + { 1, 1, "ABC", 2 }, + { 1, 1, "ABC", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x0041 }, + { 0, 0, 1, 1, 0x0041 }, + { 0, 0, 1, 1, 0x0041 }, + } + } + }, + { /*----------------- #02 -----------------*/ + { + { + { 1, 1, "\177", MB_LEN_MAX }, + { 1, 1, "\200", MB_LEN_MAX }, + { 1, 1, "\201", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x007F }, + { 1, EILSEQ, 1, -1, 0x0000 }, + { 1, EILSEQ, 1, -1, 0x0000 }, + } + } + }, + { /*----------------- #03 -----------------*/ + { + { + { 1, 1, "", MB_LEN_MAX }, + { 0, 1, "ABC", 1 }, + { 0, 1, "ABC", 2 }, + } + }, + { + { + { 0, 0, 1, 0, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + } + } + }, + { /*----------------- #04 -----------------*/ + { + { + { 0, 1, "ABC", MB_LEN_MAX }, + { 0, 1, "\177", MB_LEN_MAX }, + { 0, 1, "", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 0, 0x0000 }, + } + } + }, + { /*----------------- #05 -----------------*/ + { + { + { 0, 1, "ABC", MB_LEN_MAX }, + { 0, 1, "\177", MB_LEN_MAX }, + { 0, 0, (char)NULL, MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 1, 1, 0x0000 }, + { 0, 0, 0, 0, 0x0000 }, + } + } + }, + { is_last: 1 } + } + }, + { + { Tmbtowc, TST_LOC_eucJP }, + { + { /*----------------- #01 -----------------*/ + { + { + { 1, 1, "\244\242A", 1 }, + { 1, 1, "\244\242A", 2 }, + { 1, 1, "\244\242A", MB_LEN_MAX }, + } + }, + { + { + { 1, EILSEQ, 1, -1, 0x0000 }, + { 0, 0, 1, 2, 0x3042 }, + { 0, 0, 1, 2, 0x3042 }, + } + } + }, + { /*----------------- #02 -----------------*/ + { + { + { 1, 1, "\177\244\242", MB_LEN_MAX }, + { 1, 1, "\200\244\242", MB_LEN_MAX }, + { 1, 1, "\201\244\242", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, +1, 0x007F }, + { 1, EILSEQ, 1, -1, 0x0000 }, + { 1, EILSEQ, 1, -1, 0x0000 }, + } + } + }, + { /*----------------- #03 -----------------*/ + { + { + { 1, 1, "", MB_LEN_MAX }, + { 0, 1, "\244\242A", 1 }, + { 0, 1, "\244\242A", 2 }, + } + }, + { + { + { 0, 0, 1, 0, 0x0000 }, + { 1, EILSEQ, 1, -1, 0x0000 }, + { 0, 0, 1, 2, 0x0000 }, + } + } + }, + { /*----------------- #04 -----------------*/ + { + { + { 0, 1, "\244\242A", MB_LEN_MAX }, + { 0, 1, "\177\244\242", MB_LEN_MAX }, + { 0, 1, "", MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 2, 0x0000 }, + { 0, 0, 1, +1, 0x0000 }, + { 0, 0, 1, 0, 0x0000 }, + } + } + }, + { /*----------------- #05 -----------------*/ + { + { + { 0, 1, "\244\242A", MB_LEN_MAX }, + { 0, 1, "\177\244\242", MB_LEN_MAX }, + { 0, 0, (char)NULL, MB_LEN_MAX }, + } + }, + { + { + { 0, 0, 1, 2, 0x0000 }, + { 0, 0, 1, +1, 0x0000 }, + { 0, 0, 0, 0, 0x0000 }, + } + } + }, + { is_last: 1 } + } + }, + { + { Tmbtowc, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_strcoll.c b/localedata/tests-mbwc/dat_strcoll.c new file mode 100644 index 0000000000..6d7e7e5ee2 --- /dev/null +++ b/localedata/tests-mbwc/dat_strcoll.c @@ -0,0 +1,144 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_strcoll.c + * + * STRCOLL: int strcoll (const char *s1, const char *s2); + */ + +/* + NOTE: + + If a return value is expected to be 0, set ret_flg=1 and the + expected value = 0. If a return value is expected to be a + positive/negative value, set ret_flg=0, and set the expected value + = +1/-1. + There is inconsistensy between tst_strcoll() and tst_wcscoll()(it + has cmp_flg) for input data. I'll fix it. + + Assuming en_US to be en_US.ascii. (maybe, should be iso8859-1). + + + + ASCII CODE : A,B,C, ... , a, b, c, ... B,a:-1 a,B:+1 + DICTIONARY : A,a,B,b,C,c,.... a,B:-1 B,a:+1 */ + +TST_STRCOLL tst_strcoll_loc [] = { + { + { Tstrcoll, TST_LOC_de }, + { + { /*input.*/ { "ÄBCDEFG", "ÄBCDEFG" }, /* #1 */ + /*expect*/ { 1,0,1,0, }, + }, + { /*input.*/ { "XX Ä XX", "XX B XX" }, /* #2 */ + /*expect*/ { 1,0,0,-1, }, + }, + { /*input.*/ { "XX B XX", "XX Ä XX" }, /* #3 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "B", "a" }, /* #4 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "a", "B" }, /* #5 */ + /*expect*/ { 1,0,0,-1, }, + }, + { /*input.*/ { "b", "A" }, /* #6 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "A", "b" }, /* #7 */ + /*expect*/ { 1,0,0,-1, }, + }, + { /*input.*/ { "ä", "B" }, /* #8 */ + /*expect*/ { 1,0,0,-1, }, + }, + { /*input.*/ { "B", "ä" }, /* #9 */ + /*expect*/ { 1,0,0,+1, }, + }, + { is_last: 1 } /* Last element. */ + } + }, + { + { Tstrcoll, TST_LOC_enUS }, + { + { /*input.*/ { "ABCDEFG", "ABCDEFG" }, /* #1 */ + /*expect*/ { 1,0,1,0, }, + }, + { /*input.*/ { "XX a XX", "XX B XX" }, /* #2 */ + /*expect*/ { 1,0,0,-1, }, + }, + { /*input.*/ { "XX B XX", "XX a XX" }, /* #3 */ + /*expect*/ { 1,0,0,+1, }, + }, + { + /* <WAIVER> */ + /*input.*/ { "B", "a" }, /* #4 */ + /*expect*/ { 1,0,0,-1, }, + }, + { + /* <WAIVER> */ + /*input.*/ { "a", "B" }, /* #5 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "b", "A" }, /* #6 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "A", "b" }, /* #7 */ + /*expect*/ { 1,0,0,-1, }, + }, + { + /* #8 */ /* <WAIVER> */ + /*input.*/ { "\244\242\244\244\244\246\244\250\244\252", "ABCDEFG" }, + /*expect*/ { 1,EINVAL,0,0, }, + }, + { + /* #9 */ /* <WAIVER> */ + /*input.*/ { "ABCZEFG", "\244\242\244\244\244\246\244\250\244\252" }, + /*expect*/ { 1,EINVAL,0,0, }, + }, + { is_last: 1 } /* Last element. */ + } + }, + { + { Tstrcoll, TST_LOC_eucJP }, + { + { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252", + "\244\242\244\244\244\246\244\250\244\252" }, /* #1 */ + /*expect*/ { 1,0,1,0, }, + }, + { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252", + "\244\242\244\244\244\363\244\250\244\252" }, /* #2 */ + /*expect*/ { 1,0,0,-1, }, + }, + { /*input.*/ { "\244\242\244\244\244\363\244\250\244\252", + "\244\242\244\244\244\246\244\250\244\252" }, /* #3 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "B", "a" }, /* #4 */ + /*expect*/ { 1,0,0,-1, }, + }, + { /*input.*/ { "a", "B" }, /* #5 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "b", "A" }, /* #6 */ + /*expect*/ { 1,0,0,+1, }, + }, + { /*input.*/ { "A", "b" }, /* #7 */ + /*expect*/ { 1,0,0,-1, }, + }, + { + /* <WAIVER> */ + /*input.*/ { "\200\216\217", "ABCDEFG" }, /* #8 */ + /*expect*/ { 1,EINVAL,0,0, }, + }, + { + /* <WAIVER> */ + /*input.*/ { "ABCZEFG", "\200\216\217" }, /* #9 */ + /*expect*/ { 1,EINVAL,0,0, }, + }, + { is_last: 1 } /* Last element. */ + } + }, + { + { Tstrcoll, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_strxfrm.c b/localedata/tests-mbwc/dat_strxfrm.c new file mode 100644 index 0000000000..2737f50383 --- /dev/null +++ b/localedata/tests-mbwc/dat_strxfrm.c @@ -0,0 +1,112 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY + * + * FILE: dat_strxfrm.c + * + * STRXFRM: size_t strxfrm (char *s1, const char s2, size_t n); + */ + + +/* + * NOTE: + * + * Return value and errno value are checked only for 2nd string: + * org2[]; n1 and n2 don't mean bytes to be translated. + * It means a buffer size including a null character. + * Results of this test depens on results of strcoll(). + * If you got errors, check both test results. + * + * The buffer size should be enough to contain a string including a + * null char. Returns the number of bytes of the string (NOT + * including a null char). + */ + + + +TST_STRXFRM tst_strxfrm_loc [] = { + { + { Tstrxfrm, TST_LOC_de }, + { + { /*inp*/ { "öÄäü", "öÄäü", 17, 17 }, /* #01 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */ + /*exp*/ { 1,0,0,0 , }, + }, + { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "abc", "", 13, 13 }, /* #04 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "a", "B", 7, 7 }, /* #05 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "B", "a", 7, 7 }, /* #06 */ + /*exp*/ { 1,0,0,0, }, + }, + { + /* hiragana == latin1 */ + /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */ + /*exp*/ { 1,0,0,0, }, + }, + { is_last: 1 } + } + }, + { + { Tstrxfrm, TST_LOC_enUS }, + { + { /*inp*/ { "abcd", "abcd", 17, 17 }, /* #01 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */ + /*exp*/ { 1,0,0,0 , }, + }, + { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "abc", "", 13, 13 }, /* #04 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "a", "B", 7, 7 }, /* #05 */ + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "B", "a", 7, 7 }, /* #06 */ + /*exp*/ { 1,0,0,0, }, + }, + { + /* <WAIVER> */ + /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */ + /*exp*/ { 1,EINVAL,0,0, }, + }, + { is_last: 1 } + } + }, + { + { Tstrxfrm, TST_LOC_eucJP }, /* ??? */ + { + { + /* #01 */ + /*inp*/ { "\244\242\244\241", "\244\241\244\242", 5, 5 }, + /*exp*/ { 1,0,0,0, }, + }, + { + /* #02 */ + /*inp*/ { "\244\241\244\242", "\244\242\244\241", 5, 5 }, + /*exp*/ { 1,0,0,0, }, + }, + { + /* #03 */ + /*inp*/ { "\244\242\216\261", "\216\261\244\242", 5, 5 }, + /*exp*/ { 1,0,0,0, }, + }, + { /*inp*/ { "AAA", "\216\217", 5, 5 }, /* #04 */ /* <WAIVER> */ + /*exp*/ { 1,EINVAL,0,0, }, + }, + { is_last: 1 } + } + }, + { + { Tstrxfrm, TST_LOC_end } + } +}; diff --git a/localedata/tests-mbwc/dat_wctomb.c b/localedata/tests-mbwc/dat_wctomb.c new file mode 100644 index 0000000000..07e1d48402 --- /dev/null +++ b/localedata/tests-mbwc/dat_wctomb.c @@ -0,0 +1,139 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_wctomb.c + * + * WCTOMB: int wctomb (char *s, wchar_t wc) + */ + + +/* + * FUNCTION: + * + * int wctomb (char *s, wchar_t wc); + * + * return: the number of bytes + * + * NOTE: + * + * o When you feed a null pointer for a string (s) to the function, + * set s_flg=0 instead of putting just a 'NULL' there. + * Even if you put a 'NULL', it means a null string as well as "". + * + * o When s is a null pointer, the function checks state dependency. + * + * state-dependent encoding - return NON-zero + * state-independent encoding - return 0 + * + * If state-dependent encoding is expected, set + * + * s_flg = 0, ret_flg = 0, ret_val = +1 + * + * If state-independent encoding is expected, set + * + * s_flg = 0, ret_flg = 0, ret_val = 0 + * + * + * When you set ret_flg=1, the test program simply compares an + * actual return value with an expected value. You can check + * state-independent case (return value is 0) in that way, but + * you can not check state-dependent case. So when you check + * state- dependency in this test function: tst_wctomb(), set + * ret_flg=0 always. It's a special case, and the test + * function takes care of it. + * + * Input Expect + * + * s_flg=0 ret_flg=0 + * | | + * { 0, 0 }, { 0, 0, 0, x, "" } + * | | + * not used ret_val: 0/+1 + * (expected val) + */ + + +TST_WCTOMB tst_wctomb_loc [] = { + { + { Twctomb, TST_LOC_de }, + { + /* #01 : normal case */ + { /*input.*/ { 1, 0x00C4 }, + /*expect*/ { 0,0,1,1, "Ä" }, + }, + /* #02 : normal case */ + { /*input.*/ { 1, 0x00DC }, + /*expect*/ { 0,0,1,1, "Ü" }, + }, + /* #03 : normal case */ + { /*input |
