+/* Test case for internal API u_caseInsensitivePrefixMatch */
+static void
+TestUCaseInsensitivePrefixMatch(void) {
+ struct {
+ const char *s1;
+ const char *s2;
+ int32_t r1;
+ int32_t r2;
+ } testCases[] = {
+ {"ABC", "ab", 2, 2},
+ {"ABCD", "abcx", 3, 3},
+ {"ABC", "xyz", 0, 0},
+ /* U+00DF LATIN SMALL LETTER SHARP S */
+ {"A\\u00dfBC", "Ass", 2, 3},
+ {"Fust", "Fu\\u00dfball", 2, 2},
+ {"\\u00dfsA", "s\\u00dfB", 2, 2},
+ {"\\u00dfs", "s\\u00df", 2, 2},
+ /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */
+ {"XYZ\\u0130i\\u0307xxx", "xyzi\\u0307\\u0130yyy", 6, 6},
+ {0, 0, 0, 0}
+ };
+ int32_t i;
+
+ for (i = 0; testCases[i].s1 != 0; i++) {
+ UErrorCode sts = U_ZERO_ERROR;
+ UChar u1[64], u2[64];
+ int32_t matchLen1, matchLen2;
+
+ u_unescape(testCases[i].s1, u1, 64);
+ u_unescape(testCases[i].s2, u2, 64);
+
+ u_caseInsensitivePrefixMatch(u1, -1, u2, -1, 0, &matchLen1, &matchLen2, &sts);
+ if (U_FAILURE(sts)) {
+ log_err("error: %s, s1=%s, s2=%s", u_errorName(sts), testCases[i].s1, testCases[i].s2);
+ } else if (matchLen1 != testCases[i].r1 || matchLen2 != testCases[i].r2) {
+ log_err("s1=%s, s2=%2 / match len1=%d, len2=%d / expected len1=%d, len2=%d",
+ testCases[i].s1, testCases[i].s2,
+ matchLen1, matchLen2,
+ testCases[i].r1, testCases[i].r2);
+ }
+ }
+}
+