summaryrefslogtreecommitdiff
path: root/test/locale-mbwc
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2008-07-10 10:30:28 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2008-07-10 10:30:28 +0000
commitbb9231c8402e9ae99f98a868429e73c6340da304 (patch)
treed7ed637099fba4ab6db1cc4c009cad8485dcdb66 /test/locale-mbwc
parenta691312d8794d5516402bb6bb0d3e90c40ba188b (diff)
Added missing tests for locale with multibyte encoding
Diffstat (limited to 'test/locale-mbwc')
-rw-r--r--test/locale-mbwc/Makefile29
-rw-r--r--test/locale-mbwc/dat_isw-funcs.h37
-rw-r--r--test/locale-mbwc/dat_iswalnum.c196
-rw-r--r--test/locale-mbwc/dat_iswalpha.c169
-rw-r--r--test/locale-mbwc/dat_iswcntrl.c125
-rw-r--r--test/locale-mbwc/dat_iswctype.c667
-rw-r--r--test/locale-mbwc/dat_iswdigit.c125
-rw-r--r--test/locale-mbwc/dat_iswgraph.c167
-rw-r--r--test/locale-mbwc/dat_iswlower.c96
-rw-r--r--test/locale-mbwc/dat_iswprint.c170
-rw-r--r--test/locale-mbwc/dat_iswpunct.c155
-rw-r--r--test/locale-mbwc/dat_iswspace.c129
-rw-r--r--test/locale-mbwc/dat_iswupper.c94
-rw-r--r--test/locale-mbwc/dat_iswxdigit.c125
-rw-r--r--test/locale-mbwc/dat_mblen.c137
-rw-r--r--test/locale-mbwc/dat_mbrlen.c222
-rw-r--r--test/locale-mbwc/dat_mbrtowc.c140
-rw-r--r--test/locale-mbwc/dat_mbsrtowcs.c180
-rw-r--r--test/locale-mbwc/dat_mbstowcs.c190
-rw-r--r--test/locale-mbwc/dat_mbtowc.c444
-rw-r--r--test/locale-mbwc/dat_strcoll.c209
-rw-r--r--test/locale-mbwc/dat_strfmon.c268
-rw-r--r--test/locale-mbwc/dat_strxfrm.c147
-rw-r--r--test/locale-mbwc/dat_swscanf.c185
-rw-r--r--test/locale-mbwc/dat_tow-funcs.h24
-rw-r--r--test/locale-mbwc/dat_towctrans.c97
-rw-r--r--test/locale-mbwc/dat_towlower.c47
-rw-r--r--test/locale-mbwc/dat_towupper.c47
-rw-r--r--test/locale-mbwc/dat_wcrtomb.c122
-rw-r--r--test/locale-mbwc/dat_wcscat.c116
-rw-r--r--test/locale-mbwc/dat_wcschr.c94
-rw-r--r--test/locale-mbwc/dat_wcscmp.c137
-rw-r--r--test/locale-mbwc/dat_wcscoll.c210
-rw-r--r--test/locale-mbwc/dat_wcscpy.c44
-rw-r--r--test/locale-mbwc/dat_wcscspn.c164
-rw-r--r--test/locale-mbwc/dat_wcslen.c62
-rw-r--r--test/locale-mbwc/dat_wcsncat.c158
-rw-r--r--test/locale-mbwc/dat_wcsncmp.c144
-rw-r--r--test/locale-mbwc/dat_wcsncpy.c119
-rw-r--r--test/locale-mbwc/dat_wcspbrk.c176
-rw-r--r--test/locale-mbwc/dat_wcsrtombs.c272
-rw-r--r--test/locale-mbwc/dat_wcsspn.c179
-rw-r--r--test/locale-mbwc/dat_wcsstr.c175
-rw-r--r--test/locale-mbwc/dat_wcstod.c78
-rw-r--r--test/locale-mbwc/dat_wcstok.c138
-rw-r--r--test/locale-mbwc/dat_wcstombs.c271
-rw-r--r--test/locale-mbwc/dat_wcswidth.c263
-rw-r--r--test/locale-mbwc/dat_wcsxfrm.c102
-rw-r--r--test/locale-mbwc/dat_wctob.c61
-rw-r--r--test/locale-mbwc/dat_wctomb.c168
-rw-r--r--test/locale-mbwc/dat_wctrans.c99
-rw-r--r--test/locale-mbwc/dat_wctype.c189
-rw-r--r--test/locale-mbwc/dat_wcwidth.c149
-rw-r--r--test/locale-mbwc/tgn_funcdef.h160
-rw-r--r--test/locale-mbwc/tgn_locdef.h32
-rw-r--r--test/locale-mbwc/tsp_common.c64
-rw-r--r--test/locale-mbwc/tst_funcs.h272
-rw-r--r--test/locale-mbwc/tst_iswalnum.c10
-rw-r--r--test/locale-mbwc/tst_iswalpha.c10
-rw-r--r--test/locale-mbwc/tst_iswcntrl.c10
-rw-r--r--test/locale-mbwc/tst_iswctype.c53
-rw-r--r--test/locale-mbwc/tst_iswdigit.c11
-rw-r--r--test/locale-mbwc/tst_iswgraph.c10
-rw-r--r--test/locale-mbwc/tst_iswlower.c10
-rw-r--r--test/locale-mbwc/tst_iswprint.c10
-rw-r--r--test/locale-mbwc/tst_iswpunct.c10
-rw-r--r--test/locale-mbwc/tst_iswspace.c10
-rw-r--r--test/locale-mbwc/tst_iswupper.c10
-rw-r--r--test/locale-mbwc/tst_iswxdigit.c10
-rw-r--r--test/locale-mbwc/tst_mblen.c85
-rw-r--r--test/locale-mbwc/tst_mbrlen.c82
-rw-r--r--test/locale-mbwc/tst_mbrlen.i8009
-rw-r--r--test/locale-mbwc/tst_mbrlen.s8666
-rw-r--r--test/locale-mbwc/tst_mbrtowc.c103
-rw-r--r--test/locale-mbwc/tst_mbsrtowcs.c109
-rw-r--r--test/locale-mbwc/tst_mbstowcs.c98
-rw-r--r--test/locale-mbwc/tst_mbtowc.c130
-rw-r--r--test/locale-mbwc/tst_strcoll.c87
-rw-r--r--test/locale-mbwc/tst_strfmon.c74
-rw-r--r--test/locale-mbwc/tst_strxfrm.c136
-rw-r--r--test/locale-mbwc/tst_swscanf.c137
-rw-r--r--test/locale-mbwc/tst_towctrans.c82
-rw-r--r--test/locale-mbwc/tst_towlower.c11
-rw-r--r--test/locale-mbwc/tst_towupper.c10
-rw-r--r--test/locale-mbwc/tst_types.h729
-rw-r--r--test/locale-mbwc/tst_wcrtomb.c79
-rw-r--r--test/locale-mbwc/tst_wcscat.c78
-rw-r--r--test/locale-mbwc/tst_wcschr.c70
-rw-r--r--test/locale-mbwc/tst_wcscmp.c40
-rw-r--r--test/locale-mbwc/tst_wcscoll.c76
-rw-r--r--test/locale-mbwc/tst_wcscpy.c85
-rw-r--r--test/locale-mbwc/tst_wcscspn.c38
-rw-r--r--test/locale-mbwc/tst_wcslen.c31
-rw-r--r--test/locale-mbwc/tst_wcsncat.c75
-rw-r--r--test/locale-mbwc/tst_wcsncmp.c40
-rw-r--r--test/locale-mbwc/tst_wcsncpy.c93
-rw-r--r--test/locale-mbwc/tst_wcspbrk.c80
-rw-r--r--test/locale-mbwc/tst_wcsrtombs.c127
-rw-r--r--test/locale-mbwc/tst_wcsspn.c38
-rw-r--r--test/locale-mbwc/tst_wcsstr.c86
-rw-r--r--test/locale-mbwc/tst_wcstod.c69
-rw-r--r--test/locale-mbwc/tst_wcstok.c96
-rw-r--r--test/locale-mbwc/tst_wcstombs.c115
-rw-r--r--test/locale-mbwc/tst_wcswidth.c39
-rw-r--r--test/locale-mbwc/tst_wcsxfrm.c122
-rw-r--r--test/locale-mbwc/tst_wctob.c37
-rw-r--r--test/locale-mbwc/tst_wctomb.c99
-rw-r--r--test/locale-mbwc/tst_wctrans.c52
-rw-r--r--test/locale-mbwc/tst_wctype.c48
-rw-r--r--test/locale-mbwc/tst_wcwidth.c38
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 } },
+ { { 0x005B }, { 0,1,0 } },
+ { { 0x0060 }, { 0,1,0 } },
+ { { 0x0061 }, { 0,0,0 } },
+ { { 0x007A }, { 0,0,0 } },
+ { { 0x007B }, { 0,1,0 } },
+ { { 0x007E }, { 0,1,0 } },
+ { { 0x007F }, { 0,1,0 } },
+ { { 0x0080 }, { 0,1,0 } },
+ { .is_last = 1 } /* last element */
+ }
+ },
+#if 0
+ { TST_ISW_REC (eucJP, alnum)
+#else
+ { TST_ISW_REC (ja_UTF8, alnum)
+#endif
+ {
+ { { 0x3000 }, { 0,1,0 } }, /* IDEO. SPACE */
+ { { 0x3020 }, { 0,1,0 } }, /* POSTAL MARK FACE */
+#ifdef SHOJI_IS_RIGHT
+ { { 0x3029 }, { 0,1,0 } }, /* Hangzhou NUM9 */
+#else
+ { { 0x3029 }, { 0,0,0 } }, /* Hangzhou NUM9 */
+#endif
+ { { 0x302F }, { 0,1,0 } }, /* Diacritics(Hangul) */
+ { { 0x3037 }, { 0,1,0 } }, /* Separator Symbol */
+ { { 0x303F }, { 0,1,0 } }, /* IDEO. HALF SPACE */