summaryrefslogtreecommitdiff
path: root/unittest/strings
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-07-03 10:33:17 +0400
committerAlexander Barkov <bar@mariadb.org>2015-07-03 10:33:17 +0400
commit95d07ee408abd98769093759a076f4665a176d77 (patch)
tree24b4b0c016574b97b0fae5067f009119aa744f3c /unittest/strings
parent302bf7c4664b904482ecc133476e822d497b114d (diff)
downloadmariadb-git-95d07ee408abd98769093759a076f4665a176d77.tar.gz
MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
Diffstat (limited to 'unittest/strings')
-rw-r--r--unittest/strings/strings-t.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c
index c7824d07047..0f5f8c48cec 100644
--- a/unittest/strings/strings-t.c
+++ b/unittest/strings/strings-t.c
@@ -333,6 +333,20 @@ STRNNCOLL_PARAM strcoll_8181_A1_E0E0[]=
};
+/*
+ A shared test for eucjpms and ujis.
+*/
+STRNNCOLL_PARAM strcoll_ujis[]=
+{
+ {CSTR("\x8E\xA1"), CSTR("\x8E"), -1}, /* Good MB2 vs incomplete MB2 */
+ {CSTR("\x8E\xA1"), CSTR("\x8F\xA1"), -1}, /* Good MB2 vs incomplete MB3 */
+ {CSTR("\x8E\xA1"), CSTR("\x8F\xA1\xA1"), -1}, /* Good MB2 vs good MB3 */
+ {CSTR("\xA1\xA1"), CSTR("\x8F\xA1\xA1"), 1}, /* Good MB2 vs good MB3 */
+ {CSTR("\x8E"), CSTR("\x8F\xA1"), -1}, /* Incomplete MB2 vs incomplete MB3 */
+ {NULL, 0, NULL, 0, 0}
+};
+
+
static void
str2hex(char *dst, size_t dstlen, const char *src, size_t srclen)
{
@@ -415,6 +429,14 @@ test_strcollsp()
failed+= strcollsp(&my_charset_cp932_japanese_ci, strcoll_8181_A1_E0E0);
failed+= strcollsp(&my_charset_cp932_bin, strcoll_8181_A1_E0E0);
#endif
+#ifdef HAVE_CHARSET_eucjpms
+ failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_ujis);
+ failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_ujis);
+#endif
#ifdef HAVE_CHARSET_euckr
failed+= strcollsp(&my_charset_euckr_korean_ci, strcoll_mb2_common);
failed+= strcollsp(&my_charset_euckr_korean_ci, strcoll_mb2_A1A1_mb2_F9FE);
@@ -441,6 +463,14 @@ test_strcollsp()
failed+= strcollsp(&my_charset_sjis_japanese_ci, strcoll_8181_A1_E0E0);
failed+= strcollsp(&my_charset_sjis_bin, strcoll_8181_A1_E0E0);
#endif
+#ifdef HAVE_CHARSET_ujis
+ failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_ujis_bin, strcoll_mb2_common);
+ failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_ujis_bin, strcoll_mb2_A1A1_mb2_F9FE);
+ failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_ujis);
+ failed+= strcollsp(&my_charset_ujis_bin, strcoll_ujis);
+#endif
return failed;
}