From b915f79e4e004fde4f6ac8f341afee980e11792b Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 29 Sep 2021 15:13:57 +0400 Subject: MDEV-25904 New collation functions to compare InnoDB style trimmed NO PAD strings --- unittest/strings/strings-t.c | 508 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 505 insertions(+), 3 deletions(-) (limited to 'unittest') diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c index 00d49971595..97b9eb1a95e 100644 --- a/unittest/strings/strings-t.c +++ b/unittest/strings/strings-t.c @@ -18,6 +18,30 @@ #include +/* + U+00DF LATIN SMALL LETTER SHARP S = _utf8 x'C39F' = _latin1 x'DF' +*/ + +#define UTF8_sz "\xC3\x9F" +#define LATIN1_sz "\xDF" + +/* + U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE = _utf8 x'C385' +*/ + +#define UTF8_ARING "\xC3\x85" + +/* + U+00E4 LATIN SMALL LETTER A WITH DIAERESIS = _utf8 x'C3A4' +*/ +#define UTF8_auml "\xC3\xA4" +#define LATIN1_auml "\xE4" + +#define UCS2_a "\x00\x61" +#define UCS2_b "\x00\x62" +#define UCS2_sp "\x00\x20" + + /* Test that like_range() returns well-formed results. */ @@ -758,11 +782,483 @@ test_strcollsp() } -int main() +typedef struct +{ + LEX_CSTRING a; + LEX_CSTRING b; + size_t nchars; + int res; +} STRNNCOLLSP_CHAR_PARAM; + + +/* + Some lines in the below test data are marked as follows: + + IF - An ignorable failure. The scanner finds an ignorable character + followed by a normal character (or by a contraction), + but the "nchars" limit allows only one character to be scanned. + The whole sequence is ignored an is treated as end-of-line. + CF - A contraction failure. The scanner finds a contraction consisting + of two characters, but the "nchars" limit allows only one character + to be scanned. The whole contraction is ignored and is treated + as end-of-line. +*/ + + +/* + Tests for mbminlen1 character sets, + for both PAD SPACE and NOPAD collations +*/ +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_mbminlen1_xpad_common[]= +{ + {{CSTR("a")}, {CSTR("a")}, 0, 0}, + {{CSTR("a")}, {CSTR("a")}, 1, 0}, + {{CSTR("a")}, {CSTR("a")}, 2, 0}, + {{CSTR("a")}, {CSTR("a")}, 3, 0}, + {{CSTR("a")}, {CSTR("a")}, 100, 0}, + + {{CSTR("a")}, {CSTR("ab")}, 0, 0}, + {{CSTR("a")}, {CSTR("ab")}, 1, 0}, + {{CSTR("a")}, {CSTR("ab")}, 2, -1}, + {{CSTR("a")}, {CSTR("ab")}, 3, -1}, + {{CSTR("a")}, {CSTR("ab")}, 100, -1}, + + {{CSTR("a")}, {CSTR("a ")}, 0, 0}, + {{CSTR("a")}, {CSTR("a ")}, 1, 0}, + {{CSTR("a")}, {CSTR("a ")}, 2, 0}, + {{CSTR("a")}, {CSTR("a ")}, 3, 0}, + {{CSTR("a")}, {CSTR("a ")}, 100, 0}, + + {{CSTR("a")}, {CSTR("a ")}, 0, 0}, + {{CSTR("a")}, {CSTR("a ")}, 1, 0}, + {{CSTR("a")}, {CSTR("a ")}, 2, 0}, + {{CSTR("a")}, {CSTR("a ")}, 3, 0}, + {{CSTR("a")}, {CSTR("a ")}, 100, 0}, + + {{CSTR("ss")}, {CSTR("ss")}, 0, 0}, + {{CSTR("ss")}, {CSTR("ss")}, 1, 0}, + {{CSTR("ss")}, {CSTR("ss")}, 2, 0}, + {{CSTR("ss")}, {CSTR("ss")}, 3, 0}, + {{CSTR("ss")}, {CSTR("ss")}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +/* Tests for utf8, for both PAD SPACE and NOPAD collations */ +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_utf8mbx_xpad_common[]= +{ + {{CSTR(UTF8_sz)}, {CSTR(UTF8_sz)}, 0, 0}, + {{CSTR(UTF8_sz)}, {CSTR(UTF8_sz)}, 1, 0}, + {{CSTR(UTF8_sz)}, {CSTR(UTF8_sz)}, 2, 0}, + {{CSTR(UTF8_sz)}, {CSTR(UTF8_sz)}, 3, 0}, + {{CSTR(UTF8_sz)}, {CSTR(UTF8_sz)}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +/* Tests for latin1, for both PAD and NOPAD collations */ +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_latin1_xpad_common[]= +{ + {{CSTR(LATIN1_sz)}, {CSTR(LATIN1_sz)}, 0, 0}, + {{CSTR(LATIN1_sz)}, {CSTR(LATIN1_sz)}, 1, 0}, + {{CSTR(LATIN1_sz)}, {CSTR(LATIN1_sz)}, 2, 0}, + {{CSTR(LATIN1_sz)}, {CSTR(LATIN1_sz)}, 3, 0}, + {{CSTR(LATIN1_sz)}, {CSTR(LATIN1_sz)}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +/* Tests for utf8 collations that sort "A WITH DIAERESIS" equal to "A" */ +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_utf8mbx_xpad_a_eq_auml[]= +{ + {{CSTR(UTF8_auml "h")}, {CSTR("ah")}, 0, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah")}, 1, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah")}, 2, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah")}, 3, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah")}, 100, 0}, + + {{CSTR(UTF8_auml "h")}, {CSTR("ah ")}, 0, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah ")}, 1, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah ")}, 2, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah ")}, 3, 0}, + {{CSTR(UTF8_auml "h")}, {CSTR("ah ")}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_utf8mb3_unicode_ci[]= +{ + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 0, 0}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 1, 0}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}/*IF*/, 2, 1}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 3, 0}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 4, 0}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 100, 0}, + + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 0, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 1, -1}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 2, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 3, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 4, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_utf8mb3_unicode_nopad_ci[]= +{ + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 0, 0}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 1, 0}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}/*IF*/, 2, 1}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 3, 1}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 4, 1}, + {{CSTR("ss")}, {CSTR("s" "\x00" "s")}, 100, 1}, + + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 0, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 1, -1}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 2, -1}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 3, -1}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 4, -1}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 100, -1}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_utf8mb3_danish_ci[]= +{ + {{CSTR("aa")}, {CSTR("")}, 0, 0}, + {{CSTR("aa")}/*CF*/, {CSTR("")}, 1, 1}, + {{CSTR("aa")}, {CSTR("")}, 2, 1}, + {{CSTR("aa")}, {CSTR("")}, 3, 1}, + {{CSTR("aa")}, {CSTR("")}, 100, 1}, + + {{CSTR("aa")}, {CSTR("a")}, 0, 0}, + {{CSTR("aa")}/*CF*/, {CSTR("a")}, 1, 0}, + {{CSTR("aa")}, {CSTR("a")}, 2, 1}, + {{CSTR("aa")}, {CSTR("a")}, 3, 1}, + {{CSTR("aa")}, {CSTR("a")}, 100, 1}, + + {{CSTR("aa")}, {CSTR("aa")}, 0, 0}, + {{CSTR("aa")}/*CF*/, {CSTR("aa")}/*CF*/, 1, 0}, + {{CSTR("aa")}, {CSTR("aa")}, 2, 0}, + {{CSTR("aa")}, {CSTR("aa")}, 3, 0}, + {{CSTR("aa")}, {CSTR("aa")}, 100, 0}, + + {{CSTR("aa")}, {CSTR("\x00" "a")}, 0, 0}, + {{CSTR("aa")}/*CF*/, {CSTR("\x00" "a")}/*IF*/, 1, 1}, + {{CSTR("aa")}, {CSTR("\x00" "a")}, 2, 1}, + {{CSTR("aa")}, {CSTR("\x00" "a")}, 3, 1}, + {{CSTR("aa")}, {CSTR("\x00" "a")}, 100, 1}, + + {{CSTR("aa")}, {CSTR("\x00" "aa")}, 0, 0}, + {{CSTR("aa")}/*CF*/, {CSTR("\x00" "aa")}/*IF*/, 1, 1}, + {{CSTR("aa")}, {CSTR("\x00" "aa")}/*IF*/, 2, 1}, + {{CSTR("aa")}, {CSTR("\x00" "aa")}, 3, 0}, + {{CSTR("aa")}, {CSTR("\x00" "aa")}, 100, 0}, + + {{CSTR("aa")}, {CSTR("a" "\x00" "a")}, 0, 0}, + {{CSTR("aa")}/*CF*/, {CSTR("a" "\x00" "a")}, 1, 0}, + {{CSTR("aa")}, {CSTR("a" "\x00" "a")}/*IF*/, 2, 1}, + {{CSTR("aa")}, {CSTR("a" "\x00" "a")}, 3, 1}, + {{CSTR("aa")}, {CSTR("a" "\x00" "a")}, 100, 1}, + + {{CSTR("aa")}, {CSTR(UTF8_ARING)}, 0, 0}, + {{CSTR("aa")}/*CF*/, {CSTR(UTF8_ARING)}, 1, -1}, + {{CSTR("aa")}, {CSTR(UTF8_ARING)}, 2, 0}, + {{CSTR("aa")}, {CSTR(UTF8_ARING)}, 3, 0}, + {{CSTR("aa")}, {CSTR(UTF8_ARING)}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_latin1_german2_ci[]= +{ + {{CSTR("ss")}, {CSTR(LATIN1_sz)}, 0, 0}, + {{CSTR("ss")}, {CSTR(LATIN1_sz)}, 1, -1}, + {{CSTR("ss")}, {CSTR(LATIN1_sz)}, 2, 0}, + {{CSTR("ss")}, {CSTR(LATIN1_sz)}, 3, 0}, + {{CSTR("ss")}, {CSTR(LATIN1_sz)}, 100, 0}, + + {{CSTR("ae")}, {CSTR(LATIN1_auml)}, 0, 0}, + {{CSTR("ae")}, {CSTR(LATIN1_auml)}, 1, -1}, + {{CSTR("ae")}, {CSTR(LATIN1_auml)}, 2, 0}, + {{CSTR("ae")}, {CSTR(LATIN1_auml)}, 3, 0}, + {{CSTR("ae")}, {CSTR(LATIN1_auml)}, 100, 0}, + + {{CSTR("ae")}, {CSTR(LATIN1_auml " ")}, 0, 0}, + {{CSTR("ae")}, {CSTR(LATIN1_auml " ")}, 1, -1}, + {{CSTR("ae")}, {CSTR(LATIN1_auml " ")}, 2, 0}, + {{CSTR("ae")}, {CSTR(LATIN1_auml " ")}, 3, 0}, + {{CSTR("ae")}, {CSTR(LATIN1_auml " ")}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_utf8mbx_german2_ci[]= +{ + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 0, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 1, -1}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 2, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 3, 0}, + {{CSTR("ss")}, {CSTR(UTF8_sz)}, 100, 0}, + + {{CSTR("ae")}, {CSTR(UTF8_auml)}, 0, 0}, + {{CSTR("ae")}, {CSTR(UTF8_auml)}, 1, -1}, + {{CSTR("ae")}, {CSTR(UTF8_auml)}, 2, 0}, + {{CSTR("ae")}, {CSTR(UTF8_auml)}, 3, 0}, + {{CSTR("ae")}, {CSTR(UTF8_auml)}, 100, 0}, + + {{CSTR("ae")}, {CSTR(UTF8_auml " ")}, 0, 0}, + {{CSTR("ae")}, {CSTR(UTF8_auml " ")}, 1, -1}, + {{CSTR("ae")}, {CSTR(UTF8_auml " ")}, 2, 0}, + {{CSTR("ae")}, {CSTR(UTF8_auml " ")}, 3, 0}, + {{CSTR("ae")}, {CSTR(UTF8_auml " ")}, 100, 0}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_mbminlen1_xpad_czech[]= +{ + {{CSTR("c")}, {CSTR("ch")}, 0, 0}, + {{CSTR("c")}, {CSTR("ch")}, 1, 0}, + {{CSTR("c")}, {CSTR("ch")}, 2, -1}, + + {{CSTR("h")}, {CSTR("ch")}, 0, 0}, + {{CSTR("h")}, {CSTR("ch")}, 1, 1}, + {{CSTR("h")}, {CSTR("ch")}, 2, -1}, + + {{CSTR("i")}, {CSTR("ch")}, 0, 0}, + {{CSTR("i")}, {CSTR("ch")}, 1, 1}, + {{CSTR("i")}, {CSTR("ch")}, 2, 1}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static STRNNCOLLSP_CHAR_PARAM strnncollsp_char_mbminlen2_xpad_common[]= +{ + {{CSTR(UCS2_a)}, {CSTR(UCS2_a)}, 0, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a)}, 1, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a)}, 2, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a)}, 3, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a)}, 100, 0}, + + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp)}, 0, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp)}, 1, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp)}, 2, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp)}, 3, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp)}, 100, 0}, + + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp UCS2_sp)}, 0, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp UCS2_sp)}, 1, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp UCS2_sp)}, 2, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp UCS2_sp)}, 3, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_sp UCS2_sp)}, 100, 0}, + + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_b)}, 0, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_b)}, 1, 0}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_b)}, 2, -1}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_b)}, 3, -1}, + {{CSTR(UCS2_a)}, {CSTR(UCS2_a UCS2_b)}, 100, -1}, + + {{NULL, 0}, {NULL, 0}, 0, 0} +}; + + +static int +strnncollsp_char_one(CHARSET_INFO *cs, const STRNNCOLLSP_CHAR_PARAM *p) +{ + int failed= 0; + char ahex[64], bhex[64]; + int res= cs->coll->strnncollsp_nchars(cs, + (uchar *) p->a.str, p->a.length, + (uchar *) p->b.str, p->b.length, + p->nchars); + str2hex(ahex, sizeof(ahex), p->a.str, p->a.length); + str2hex(bhex, sizeof(bhex), p->b.str, p->b.length); + diag("%-25s %-12s %-12s %3d %7d %7d%s", + cs->name, ahex, bhex, (int) p->nchars, p->res, res, + eqres(res, p->res) ? "" : " FAILED"); + if (!eqres(res, p->res)) + { + failed++; + } + else + { + /* Test in reverse order */ + res= cs->coll->strnncollsp_nchars(cs, + (uchar *) p->b.str, p->b.length, + (uchar *) p->a.str, p->a.length, + p->nchars); + if (!eqres(res, -p->res)) + { + diag("Comparison in reverse order failed. Expected %d, got %d", + -p->res, res); + failed++; + } + } + return failed; +} + + +static int +strnncollsp_char(const char *collation, const STRNNCOLLSP_CHAR_PARAM *param) +{ + int failed= 0; + const STRNNCOLLSP_CHAR_PARAM *p; + CHARSET_INFO *cs= get_charset_by_name(collation, MYF(0)); + + if (!cs) + { + diag("get_charset_by_name() failed"); + return 1; + } + + diag("%-25s %-12s %-12s %-3s %7s %7s", + "Collation", "a", "b", "Nch", "ExpSign", "Actual"); + + for (p= param; p->a.str; p++) + { + failed+= strnncollsp_char_one(cs, p); + } + + return failed; +} + + +static int +strnncollsp_char_mbminlen1(const char *collation, + const STRNNCOLLSP_CHAR_PARAM *specific) +{ + int failed= 0; + failed+= strnncollsp_char(collation, strnncollsp_char_mbminlen1_xpad_common); + if (specific) + failed+= strnncollsp_char(collation, specific); + return failed; +} + + +static int +strnncollsp_char_mbminlen2(const char *collation, + const STRNNCOLLSP_CHAR_PARAM *specific) +{ + int failed= 0; + failed+= strnncollsp_char(collation, strnncollsp_char_mbminlen2_xpad_common); + if (specific) + failed+= strnncollsp_char(collation, specific); + return failed; +} + + +static int +strnncollsp_char_latin1(const char *collation, + const STRNNCOLLSP_CHAR_PARAM *specific) +{ + int failed= 0; + failed+= strnncollsp_char(collation, strnncollsp_char_mbminlen1_xpad_common); + failed+= strnncollsp_char(collation, strnncollsp_char_latin1_xpad_common); + if (specific) + failed+= strnncollsp_char(collation, specific); + return failed; +} + + +static int +strnncollsp_char_utf8mbx(const char *collation, + const STRNNCOLLSP_CHAR_PARAM *specific) +{ + int failed= 0; + failed+= strnncollsp_char(collation, strnncollsp_char_mbminlen1_xpad_common); + failed+= strnncollsp_char(collation, strnncollsp_char_utf8mbx_xpad_common); + + if (!strstr(collation, "_bin") && + !strstr(collation, "_german2") && + !strstr(collation, "_danish")) + failed+= strnncollsp_char(collation, + strnncollsp_char_utf8mbx_xpad_a_eq_auml); + if (specific) + failed+= strnncollsp_char(collation, specific); + return failed; +} + + +static int +test_strnncollsp_char() +{ + int failed= 0; + failed+= strnncollsp_char_latin1("latin1_swedish_ci", NULL); + failed+= strnncollsp_char_latin1("latin1_swedish_nopad_ci", NULL); + failed+= strnncollsp_char_latin1("latin1_bin", NULL); + failed+= strnncollsp_char_latin1("latin1_nopad_bin", NULL); + failed+= strnncollsp_char_latin1("latin1_german2_ci", + strnncollsp_char_latin1_german2_ci); + +#ifdef HAVE_CHARSET_cp1250 + failed+= strnncollsp_char_mbminlen1("cp1250_czech_cs", + strnncollsp_char_mbminlen1_xpad_czech); +#endif + +#ifdef HAVE_CHARSET_latin2 + failed+= strnncollsp_char_mbminlen1("latin2_czech_cs", + strnncollsp_char_mbminlen1_xpad_czech); +#endif + +#ifdef HAVE_CHARSET_tis620 + failed+= strnncollsp_char_mbminlen1("tis620_thai_ci", NULL); +#endif + +#ifdef HAVE_CHARSET_big5 + failed+= strnncollsp_char_mbminlen1("big5_chinese_ci", NULL); + failed+= strnncollsp_char_mbminlen1("big5_chinese_nopad_ci", NULL); + failed+= strnncollsp_char_mbminlen1("big5_bin", NULL); + failed+= strnncollsp_char_mbminlen1("big5_nopad_bin", NULL); +#endif + + failed+= strnncollsp_char_utf8mbx("utf8mb3_general_ci", NULL); + failed+= strnncollsp_char_utf8mbx("utf8mb3_general_nopad_ci", NULL); + failed+= strnncollsp_char_utf8mbx("utf8mb3_bin", NULL); + failed+= strnncollsp_char_utf8mbx("utf8mb3_nopad_bin", NULL); + + failed+= strnncollsp_char_utf8mbx("utf8mb3_unicode_ci", + strnncollsp_char_utf8mb3_unicode_ci); + failed+= strnncollsp_char_utf8mbx("utf8mb3_unicode_nopad_ci", + strnncollsp_char_utf8mb3_unicode_nopad_ci); + failed+= strnncollsp_char_utf8mbx("utf8mb3_danish_ci", + strnncollsp_char_utf8mb3_danish_ci); + failed+= strnncollsp_char_utf8mbx("utf8mb3_german2_ci", + strnncollsp_char_utf8mbx_german2_ci); + failed+= strnncollsp_char_utf8mbx("utf8mb3_czech_ci", + strnncollsp_char_mbminlen1_xpad_czech); + +#ifdef HAVE_CHARSET_ucs2 + failed+= strnncollsp_char_mbminlen2("ucs2_general_ci", NULL); + failed+= strnncollsp_char_mbminlen2("ucs2_general_nopad_ci", NULL); + failed+= strnncollsp_char_mbminlen2("ucs2_bin", NULL); + failed+= strnncollsp_char_mbminlen2("ucs2_nopad_bin", NULL); + failed+= strnncollsp_char_mbminlen2("ucs2_unicode_ci", NULL); + failed+= strnncollsp_char_mbminlen2("ucs2_unicode_nopad_ci", NULL); +#endif + + return failed; +} + + +int main(int ac, char **av) { size_t i, failed= 0; - - plan(2); + + MY_INIT(av[0]); + + plan(3); diag("Testing my_like_range_xxx() functions"); for (i= 0; i < array_elements(charset_list); i++) @@ -780,5 +1276,11 @@ int main() failed= test_strcollsp(); ok(failed == 0, "Testing cs->coll->strnncollsp()"); + diag("Testing cs->coll->strnncollsp_char()"); + failed= test_strnncollsp_char(); + ok(failed == 0, "Testing cs->coll->strnncollsp_char()"); + + my_end(0); + return exit_status(); } -- cgit v1.2.1