diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-07-10 10:30:28 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-07-10 10:30:28 +0000 |
commit | bb9231c8402e9ae99f98a868429e73c6340da304 (patch) | |
tree | d7ed637099fba4ab6db1cc4c009cad8485dcdb66 /test | |
parent | a691312d8794d5516402bb6bb0d3e90c40ba188b (diff) |
Added missing tests for locale with multibyte encoding
Diffstat (limited to 'test')
110 files changed, 29302 insertions, 0 deletions
diff --git a/test/locale-mbwc/Makefile b/test/locale-mbwc/Makefile new file mode 100644 index 000000000..8f5a2dba8 --- /dev/null +++ b/test/locale-mbwc/Makefile @@ -0,0 +1,29 @@ +# uClibc locale tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \ + +TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl \ + tst_iswctype tst_iswdigit tst_iswgraph \ + tst_iswlower tst_iswprint tst_iswpunct \ + tst_iswspace tst_iswupper tst_iswxdigit \ + tst_mblen tst_mbrlen tst_mbrtowc tst_mbsrtowcs \ + tst_mbstowcs tst_mbtowc tst_strcoll tst_strxfrm \ + tst_swscanf tst_towctrans tst_towlower \ + tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \ + tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \ + tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \ + tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \ + tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \ + tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \ + tst_wctype tst_wcwidth tst_strfmon + + +# NOTE: For now disabled tst_strfmon to avoid build failure. +TESTS_DISABLED := tst_strfmon + +include ../Test.mak + +DODIFF_rint := 1 + +EXTRA_CFLAGS := -D__USE_GNU -fno-builtin + diff --git a/test/locale-mbwc/dat_isw-funcs.h b/test/locale-mbwc/dat_isw-funcs.h new file mode 100644 index 000000000..70aecb083 --- /dev/null +++ b/test/locale-mbwc/dat_isw-funcs.h @@ -0,0 +1,37 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_isw-funcs.h + * + * ISW*: int isw* (wint_t wc); + */ + +#include <errno.h> +#include <stdlib.h> +#include <wctype.h> +#include "tst_types.h" +#include "tgn_locdef.h" + +#define TST_ISW_LOC(FUNC, func) \ + TST_ISW## FUNC tst_isw## func ##_loc [] + +#define TST_ISW_REC(locale, func) \ + { Tisw## func, TST_LOC_## locale }, + +/* + * NOTE: + * Set ret_flg = 1, when a return value is expected to be 0 (FALSE). + * Set ret_flg = 0, when a return value is expected to be non-zero (TRUE). + * + * Since the functions return *non*-zero value for TRUE, can't + * compare an actual return value with an expected return value. + * Set the ret_flg=0 for TRUE cases and the tst_isw*() will check + * the non-zero value. + * + * { { WEOF }, { 0,1,0 } }, + * | | + * | ret_val: an expected return value + * ret_flg: if 1, compare an actual return value with the + * ret_val; if 0, the test program + * checks the actual return value. + */ diff --git a/test/locale-mbwc/dat_iswalnum.c b/test/locale-mbwc/dat_iswalnum.c new file mode 100644 index 000000000..509370359 --- /dev/null +++ b/test/locale-mbwc/dat_iswalnum.c @@ -0,0 +1,196 @@ +/* + * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY + * + * FILE: dat_iswalnum.c + * + * ISW*: int iswalnum (wint_t wc); + */ + + +#include "dat_isw-funcs.h" + + +TST_ISW_LOC (ALNUM, alnum) = { + + { TST_ISW_REC (de, alnum) + { + { { 0x0080 }, { 0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,0 } }, /* O dia */ + { { 0x00D7 }, { 0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,0 } }, /* o dia */ + { { 0x00F7 }, { 0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,0 } }, /* y dia */ + { .is_last = 1 } /* last element */ + } + }, + { TST_ISW_REC (de_UTF8, alnum) + { + { { 0x0080 }, { 0,1,0 } }, /* CTRL */ + { { 0x009F }, { 0,1,0 } }, /* CTRL */ + { { 0x00A0 }, { 0,1,0 } }, /* NB SPACE */ + { { 0x00A1 }, { 0,1,0 } }, /* UD ! */ + { { 0x00B0 }, { 0,1,0 } }, /* Degree */ + { { 0x00B1 }, { 0,1,0 } }, /* +- sign */ + { { 0x00B2 }, { 0,1,0 } }, /* SUP 2 */ + { { 0x00B3 }, { 0,1,0 } }, /* SUP 3 */ + { { 0x00B4 }, { 0,1,0 } }, /* ACUTE */ + { { 0x00B8 }, { 0,1,0 } }, /* CEDILLA */ + { { 0x00B9 }, { 0,1,0 } }, /* SUP 1 */ + { { 0x00BB }, { 0,1,0 } }, /* >> */ + { { 0x00BC }, { 0,1,0 } }, /* 1/4 */ + { { 0x00BD }, { 0,1,0 } }, /* 1/2 */ + { { 0x00BE }, { 0,1,0 } }, /* 3/4 */ + { { 0x00BF }, { 0,1,0 } }, /* UD ? */ + { { 0x00C0 }, { 0,0,0 } }, /* A Grave */ + { { 0x00D6 }, { 0,0,0 } }, /* O dia */ + { { 0x00D7 }, { 0,1,0 } }, /* multipl. */ + { { 0x00D8 }, { 0,0,0 } }, /* O stroke */ + { { 0x00DF }, { 0,0,0 } }, /* small Sh */ + { { 0x00E0 }, { 0,0,0 } }, /* a grave */ + { { 0x00F6 }, { 0,0,0 } }, /* o dia */ + { { 0x00F7 }, { 0,1,0 } }, /* division */ + { { 0x00F8 }, { 0,0,0 } }, /* o stroke */ + { { 0x00FF }, { 0,0,0 } }, /* y dia */ + { .is_last = 1 } /* last element */ + } + }, + { TST_ISW_REC (enUS, alnum) + { + { { WEOF }, { 0,1,0 } }, + { { 0x0000 }, { 0,1,0 } }, + { { 0x001F }, { 0,1,0 } }, + { { 0x0020 }, { 0,1,0 } }, + { { 0x0021 }, { 0,1,0 } }, + { { 0x002F }, { 0,1,0 } }, + { { 0x0030 }, { 0,0,0 } }, + { { 0x0039 }, { 0,0,0 } }, + { { 0x003A }, { 0,1,0 } }, + { { 0x0040 }, { 0,1,0 } }, + { { 0x0041 }, { 0,0,0 } }, + { { 0x005A }, { 0,0,0 } }, |