summaryrefslogtreecommitdiff
path: root/unittest/strings
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-07-03 17:24:16 +0400
committerAlexander Barkov <bar@mariadb.org>2015-07-03 17:24:16 +0400
commit9ad8ff666c4876de270f80f180b42eceac76b6f0 (patch)
tree76dc817c9030ba0c61e6f8aaa828d668dd9defd3 /unittest/strings
parent95d07ee408abd98769093759a076f4665a176d77 (diff)
downloadmariadb-git-9ad8ff666c4876de270f80f180b42eceac76b6f0.tar.gz
MDEV-8415 utf8: compare broken bytes as "greater than any non-broken character"
Diffstat (limited to 'unittest/strings')
-rw-r--r--unittest/strings/strings-t.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c
index 0f5f8c48cec..6da7a0cc72f 100644
--- a/unittest/strings/strings-t.c
+++ b/unittest/strings/strings-t.c
@@ -347,6 +347,28 @@ STRNNCOLL_PARAM strcoll_ujis[]=
};
+STRNNCOLL_PARAM strcoll_utf8mb3_common[]=
+{
+ {CSTR("\xC0"), CSTR("\xC1"), -1}, /* Unused byte vs unused byte */
+ {CSTR("\xC0"), CSTR("\xFF"), -1}, /* Unused byte vs unused byte */
+ {CSTR("\xC2\xA1"), CSTR("\xC0"), -1}, /* MB2 vs unused byte */
+ {CSTR("\xC2\xA1"), CSTR("\xC2"), -1}, /* MB2 vs incomplete MB2 */
+ {CSTR("\xC2\xA1"), CSTR("\xC2\xA2"), -1}, /* MB2 vs MB2 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\x7F"),-1}, /* MB2 vs broken MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\x80"),-1}, /* MB2 vs MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\xBF"),-1}, /* MB2 vs MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\xC0"),-1}, /* MB2 vs broken MB3 */
+ {CSTR("\xC2\xA1"), CSTR("\xE0\xA0"), -1}, /* MB2 vs incomplete MB3 */
+ {CSTR("\xE0\xA0\x7E"), CSTR("\xE0\xA0\x7F"),-1},/* Broken MB3 vs broken MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0"), -1},/* MB3 vs incomplete MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\x7F"),-1},/* MB3 vs broken MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\xBF"),-1},/* MB3 vs MB3 */
+ {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\xC0"),-1},/* MB3 vs broken MB3 */
+ {CSTR("\xE0\xA0\xC0"), CSTR("\xE0\xA0\xC1"),-1},/* Broken MB3 vs broken MB3 */
+ {NULL, 0, NULL, 0, 0}
+};
+
+
static void
str2hex(char *dst, size_t dstlen, const char *src, size_t srclen)
{
@@ -471,6 +493,11 @@ test_strcollsp()
failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_ujis);
failed+= strcollsp(&my_charset_ujis_bin, strcoll_ujis);
#endif
+#ifdef HAVE_CHARSET_utf8
+ failed+= strcollsp(&my_charset_utf8_general_ci, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8_general_mysql500_ci, strcoll_utf8mb3_common);
+ failed+= strcollsp(&my_charset_utf8_bin, strcoll_utf8mb3_common);
+#endif
return failed;
}