2 *******************************************************************************
4 * Copyright (C) 2002-2016, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: cstrcase.c
10 * tab size: 8 (not used)
13 * created on: 2002feb21
14 * created by: Markus W. Scherer
16 * Test file for string casing C API functions.
20 #include "unicode/utypes.h"
21 #include "unicode/uchar.h"
22 #include "unicode/ustring.h"
23 #include "unicode/uloc.h"
24 #include "unicode/ubrk.h"
25 #include "unicode/ucasemap.h"
30 /* test string case mapping functions --------------------------------------- */
36 beforeLower
[]= { 0x61, 0x42, 0x49, 0x3a3, 0xdf, 0x3a3, 0x2f, 0xd93f, 0xdfff },
37 lowerRoot
[]= { 0x61, 0x62, 0x69, 0x3c3, 0xdf, 0x3c2, 0x2f, 0xd93f, 0xdfff },
38 lowerTurkish
[]={ 0x61, 0x62, 0x131, 0x3c3, 0xdf, 0x3c2, 0x2f, 0xd93f, 0xdfff };
44 /* lowercase with root locale and separate buffers */
46 errorCode
=U_ZERO_ERROR
;
47 length
=u_strToLower(buffer
, UPRV_LENGTHOF(buffer
),
48 beforeLower
, UPRV_LENGTHOF(beforeLower
),
51 if( U_FAILURE(errorCode
) ||
52 length
!=(UPRV_LENGTHOF(lowerRoot
)) ||
53 uprv_memcmp(lowerRoot
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
56 log_err("error in u_strToLower(root locale)=%ld error=%s string matches: %s\t\nlowerRoot=%s\t\nbuffer=%s\n",
58 u_errorName(errorCode
),
59 uprv_memcmp(lowerRoot
, buffer
, length
*U_SIZEOF_UCHAR
)==0 &&
60 buffer
[length
]==0 ? "yes" : "no",
61 aescstrdup(lowerRoot
,-1),
62 aescstrdup(buffer
,-1));
65 /* lowercase with turkish locale and in the same buffer */
66 uprv_memcpy(buffer
, beforeLower
, sizeof(beforeLower
));
67 buffer
[UPRV_LENGTHOF(beforeLower
)]=0;
68 errorCode
=U_ZERO_ERROR
;
69 length
=u_strToLower(buffer
, UPRV_LENGTHOF(buffer
),
70 buffer
, -1, /* implicit srcLength */
73 if( U_FAILURE(errorCode
) ||
74 length
!=(UPRV_LENGTHOF(lowerTurkish
)) ||
75 uprv_memcmp(lowerTurkish
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
78 log_err("error in u_strToLower(turkish locale)=%ld error=%s string matches: %s\n",
80 u_errorName(errorCode
),
81 uprv_memcmp(lowerTurkish
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
84 /* test preflighting */
85 buffer
[0]=buffer
[2]=0xabcd;
86 errorCode
=U_ZERO_ERROR
;
87 length
=u_strToLower(buffer
, 2, /* set destCapacity=2 */
88 beforeLower
, UPRV_LENGTHOF(beforeLower
),
91 if( errorCode
!=U_BUFFER_OVERFLOW_ERROR
||
92 length
!=(UPRV_LENGTHOF(lowerRoot
)) ||
93 uprv_memcmp(lowerRoot
, buffer
, 2*U_SIZEOF_UCHAR
)!=0 ||
96 log_err("error in u_strToLower(root locale preflighting)=%ld error=%s string matches: %s\n",
98 u_errorName(errorCode
),
99 uprv_memcmp(lowerRoot
, buffer
, 2*U_SIZEOF_UCHAR
)==0 && buffer
[2]==0xabcd ? "yes" : "no");
102 /* test error handling */
103 errorCode
=U_ZERO_ERROR
;
104 length
=u_strToLower(NULL
, UPRV_LENGTHOF(buffer
),
105 beforeLower
, UPRV_LENGTHOF(beforeLower
),
108 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
) {
109 log_err("error in u_strToLower(root locale dest=NULL)=%ld error=%s\n",
111 u_errorName(errorCode
));
115 errorCode
=U_ZERO_ERROR
;
116 length
=u_strToLower(buffer
, -1,
117 beforeLower
, UPRV_LENGTHOF(beforeLower
),
120 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
123 log_err("error in u_strToLower(root locale destCapacity=-1)=%ld error=%s buffer[0]==0x%lx\n",
125 u_errorName(errorCode
),
131 TestCaseUpper(void) {
134 beforeUpper
[]= { 0x61, 0x42, 0x69, 0x3c2, 0xdf, 0x3c3, 0x2f, 0xfb03, 0xd93f, 0xdfff },
135 upperRoot
[]= { 0x41, 0x42, 0x49, 0x3a3, 0x53, 0x53, 0x3a3, 0x2f, 0x46, 0x46, 0x49, 0xd93f, 0xdfff },
136 upperTurkish
[]={ 0x41, 0x42, 0x130, 0x3a3, 0x53, 0x53, 0x3a3, 0x2f, 0x46, 0x46, 0x49, 0xd93f, 0xdfff };
140 UErrorCode errorCode
;
142 /* uppercase with root locale and in the same buffer */
143 uprv_memcpy(buffer
, beforeUpper
, sizeof(beforeUpper
));
144 errorCode
=U_ZERO_ERROR
;
145 length
=u_strToUpper(buffer
, UPRV_LENGTHOF(buffer
),
146 buffer
, UPRV_LENGTHOF(beforeUpper
),
149 if( U_FAILURE(errorCode
) ||
150 length
!=(UPRV_LENGTHOF(upperRoot
)) ||
151 uprv_memcmp(upperRoot
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
154 log_err("error in u_strToUpper(root locale)=%ld error=%s string matches: %s\n",
156 u_errorName(errorCode
),
157 uprv_memcmp(upperRoot
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
160 /* uppercase with turkish locale and separate buffers */
162 errorCode
=U_ZERO_ERROR
;
163 length
=u_strToUpper(buffer
, UPRV_LENGTHOF(buffer
),
164 beforeUpper
, UPRV_LENGTHOF(beforeUpper
),
167 if( U_FAILURE(errorCode
) ||
168 length
!=(UPRV_LENGTHOF(upperTurkish
)) ||
169 uprv_memcmp(upperTurkish
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
172 log_err("error in u_strToUpper(turkish locale)=%ld error=%s string matches: %s\n",
174 u_errorName(errorCode
),
175 uprv_memcmp(upperTurkish
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
178 /* test preflighting */
179 errorCode
=U_ZERO_ERROR
;
180 length
=u_strToUpper(NULL
, 0,
181 beforeUpper
, UPRV_LENGTHOF(beforeUpper
),
184 if( errorCode
!=U_BUFFER_OVERFLOW_ERROR
||
185 length
!=(UPRV_LENGTHOF(upperTurkish
))
187 log_err("error in u_strToUpper(turkish locale pure preflighting)=%ld error=%s\n",
189 u_errorName(errorCode
));
192 /* test error handling */
194 errorCode
=U_ZERO_ERROR
;
195 length
=u_strToUpper(buffer
, UPRV_LENGTHOF(buffer
),
196 NULL
, UPRV_LENGTHOF(beforeUpper
),
199 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
202 log_err("error in u_strToUpper(turkish locale src=NULL)=%ld error=%s buffer[0]==0x%lx\n",
204 u_errorName(errorCode
),
209 errorCode
=U_ZERO_ERROR
;
210 length
=u_strToUpper(buffer
, UPRV_LENGTHOF(buffer
),
214 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
217 log_err("error in u_strToUpper(turkish locale srcLength=-2)=%ld error=%s buffer[0]==0x%lx\n",
219 u_errorName(errorCode
),
224 #if !UCONFIG_NO_BREAK_ITERATION
227 TestCaseTitle(void) {
230 beforeTitle
[]= { 0x61, 0x42, 0x20, 0x69, 0x3c2, 0x20, 0xdf, 0x3c3, 0x2f, 0xfb03, 0xd93f, 0xdfff },
231 titleWord
[]= { 0x41, 0x62, 0x20, 0x49, 0x3c2, 0x20, 0x53, 0x73, 0x3c3, 0x2f, 0x46, 0x66, 0x69, 0xd93f, 0xdfff },
232 titleChar
[]= { 0x41, 0x42, 0x20, 0x49, 0x3a3, 0x20, 0x53, 0x73, 0x3a3, 0x2f, 0x46, 0x66, 0x69, 0xd93f, 0xdfff };
235 UBreakIterator
*titleIterChars
;
237 UErrorCode errorCode
;
239 errorCode
=U_ZERO_ERROR
;
240 titleIterChars
=ubrk_open(UBRK_CHARACTER
, "", beforeTitle
, UPRV_LENGTHOF(beforeTitle
), &errorCode
);
241 if(U_FAILURE(errorCode
)) {
242 log_err_status(errorCode
, "error: ubrk_open(UBRK_CHARACTER)->%s\n", u_errorName(errorCode
));
246 /* titlecase with standard break iterator and in the same buffer */
247 uprv_memcpy(buffer
, beforeTitle
, sizeof(beforeTitle
));
248 errorCode
=U_ZERO_ERROR
;
249 length
=u_strToTitle(buffer
, UPRV_LENGTHOF(buffer
),
250 buffer
, UPRV_LENGTHOF(beforeTitle
),
253 if( U_FAILURE(errorCode
) ||
254 length
!=(UPRV_LENGTHOF(titleWord
)) ||
255 uprv_memcmp(titleWord
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
258 log_err("error in u_strToTitle(standard iterator)=%ld error=%s string matches: %s\n",
260 u_errorName(errorCode
),
261 uprv_memcmp(titleWord
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
264 /* titlecase with UBRK_CHARACTERS and separate buffers */
266 errorCode
=U_ZERO_ERROR
;
267 length
=u_strToTitle(buffer
, UPRV_LENGTHOF(buffer
),
268 beforeTitle
, UPRV_LENGTHOF(beforeTitle
),
271 if( U_FAILURE(errorCode
) ||
272 length
!=(UPRV_LENGTHOF(titleChar
)) ||
273 uprv_memcmp(titleChar
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
276 log_err("error in u_strToTitle(UBRK_CHARACTERS)=%ld error=%s string matches: %s\n",
278 u_errorName(errorCode
),
279 uprv_memcmp(titleChar
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
282 /* test preflighting */
283 errorCode
=U_ZERO_ERROR
;
284 length
=u_strToTitle(NULL
, 0,
285 beforeTitle
, UPRV_LENGTHOF(beforeTitle
),
288 if( errorCode
!=U_BUFFER_OVERFLOW_ERROR
||
289 length
!=(UPRV_LENGTHOF(titleChar
))
291 log_err("error in u_strToTitle(UBRK_CHARACTERS pure preflighting)=%ld error=%s\n",
293 u_errorName(errorCode
));
296 /* test error handling */
298 errorCode
=U_ZERO_ERROR
;
299 length
=u_strToTitle(buffer
, UPRV_LENGTHOF(buffer
),
300 NULL
, UPRV_LENGTHOF(beforeTitle
),
303 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
306 log_err("error in u_strToTitle(UBRK_CHARACTERS src=NULL)=%ld error=%s buffer[0]==0x%lx\n",
308 u_errorName(errorCode
),
313 errorCode
=U_ZERO_ERROR
;
314 length
=u_strToTitle(buffer
, UPRV_LENGTHOF(buffer
),
318 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
321 log_err("error in u_strToTitle(UBRK_CHARACTERS srcLength=-2)=%ld error=%s buffer[0]==0x%lx\n",
323 u_errorName(errorCode
),
327 ubrk_close(titleIterChars
);
331 TestCaseDutchTitle(void) {
334 beforeTitle
[]= { 0x69, 0x6A, 0x73, 0x73, 0x45, 0x6c, 0x20, 0x69, 0x67, 0x6c, 0x4f, 0x6f , 0x20 , 0x49, 0x4A, 0x53, 0x53, 0x45, 0x4C },
335 titleRoot
[]= { 0x49, 0x6A, 0x73, 0x73, 0x65, 0x6c, 0x20, 0x49, 0x67, 0x6c, 0x6f, 0x6f , 0x20 , 0x49, 0x6A, 0x73, 0x73, 0x65, 0x6C },
336 titleDutch
[]= { 0x49, 0x4A, 0x73, 0x73, 0x65, 0x6c, 0x20, 0x49, 0x67, 0x6c, 0x6f, 0x6f , 0x20 , 0x49, 0x4A, 0x73, 0x73, 0x65, 0x6C };
339 UBreakIterator
*titleIterWord
;
341 UErrorCode errorCode
;
343 errorCode
=U_ZERO_ERROR
;
344 titleIterWord
=ubrk_open(UBRK_WORD
, "", beforeTitle
, UPRV_LENGTHOF(beforeTitle
), &errorCode
);
345 if(U_FAILURE(errorCode
)) {
346 log_err_status(errorCode
, "error: ubrk_open(UBRK_WORD)->%s\n", u_errorName(errorCode
));
350 /* titlecase with default locale */
352 errorCode
=U_ZERO_ERROR
;
353 length
=u_strToTitle(buffer
, UPRV_LENGTHOF(buffer
),
354 beforeTitle
, UPRV_LENGTHOF(beforeTitle
),
357 if( U_FAILURE(errorCode
) ||
358 length
!=(UPRV_LENGTHOF(titleRoot
)) ||
359 uprv_memcmp(titleRoot
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
363 u_UCharsToChars(buffer
,charsOut
,sizeof(charsOut
));
364 log_err("error in u_strToTitle(UBRK_CHARACTERS)=%ld error=%s root locale string matches: %s\noutput buffer is {%s}\n",
366 u_errorName(errorCode
),
367 uprv_memcmp(titleRoot
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no", charsOut
);
369 /* titlecase with Dutch locale */
371 errorCode
=U_ZERO_ERROR
;
372 length
=u_strToTitle(buffer
, UPRV_LENGTHOF(buffer
),
373 beforeTitle
, UPRV_LENGTHOF(beforeTitle
),
376 if( U_FAILURE(errorCode
) ||
377 length
!=(UPRV_LENGTHOF(titleDutch
)) ||
378 uprv_memcmp(titleDutch
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
382 u_UCharsToChars(buffer
,charsOut
,sizeof(charsOut
));
383 log_err("error in u_strToTitle(UBRK_CHARACTERS)=%ld error=%s dutch locale string matches: %s\noutput buffer is {%s}\n",
385 u_errorName(errorCode
),
386 uprv_memcmp(titleDutch
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no", charsOut
);
389 ubrk_close(titleIterWord
);
394 /* test case folding and case-insensitive string compare -------------------- */
397 TestCaseFolding(void) {
399 * CaseFolding.txt says about i and its cousins:
400 * 0049; C; 0069; # LATIN CAPITAL LETTER I
401 * 0049; T; 0131; # LATIN CAPITAL LETTER I
403 * 0130; F; 0069 0307; # LATIN CAPITAL LETTER I WITH DOT ABOVE
404 * 0130; T; 0069; # LATIN CAPITAL LETTER I WITH DOT ABOVE
406 * See CaseFolding.txt and the Unicode Standard for how to apply the case foldings.
410 /* input, default, exclude special i */
416 0xfb03, 0xfb03, 0xfb03,
417 0x1040e,0x10436,0x10436,
418 0x5ffff,0x5ffff,0x5ffff
422 mixed
[]= { 0x61, 0x42, 0x130, 0x49, 0x131, 0x3d0, 0xdf, 0xfb03, 0xd93f, 0xdfff },
423 foldedDefault
[]= { 0x61, 0x62, 0x69, 0x307, 0x69, 0x131, 0x3b2, 0x73, 0x73, 0x66, 0x66, 0x69, 0xd93f, 0xdfff },
424 foldedExcludeSpecialI
[]={ 0x61, 0x62, 0x69, 0x131, 0x131, 0x3b2, 0x73, 0x73, 0x66, 0x66, 0x69, 0xd93f, 0xdfff };
426 UVersionInfo unicodeVersion
={ 0, 0, 17, 89 }, unicode_3_1
={ 3, 1, 0, 0 };
433 UErrorCode errorCode
;
436 /* if unicodeVersion()>=3.1 then test exclude-special-i cases as well */
437 u_getUnicodeVersion(unicodeVersion
);
438 isUnicode_3_1
= uprv_memcmp(unicodeVersion
, unicode_3_1
, 4)>=0;
440 /* test simple case folding */
442 for(i
=0; i
<sizeof(simple
)/12; p
+=3, ++i
) {
443 if(u_foldCase(p
[0], U_FOLD_CASE_DEFAULT
)!=p
[1]) {
444 log_err("error: u_foldCase(0x%04lx, default)=0x%04lx instead of 0x%04lx\n",
445 p
[0], u_foldCase(p
[0], U_FOLD_CASE_DEFAULT
), p
[1]);
449 if(isUnicode_3_1
&& u_foldCase(p
[0], U_FOLD_CASE_EXCLUDE_SPECIAL_I
)!=p
[2]) {
450 log_err("error: u_foldCase(0x%04lx, exclude special i)=0x%04lx instead of 0x%04lx\n",
451 p
[0], u_foldCase(p
[0], U_FOLD_CASE_EXCLUDE_SPECIAL_I
), p
[2]);
456 /* test full string case folding with default option and separate buffers */
458 errorCode
=U_ZERO_ERROR
;
459 length
=u_strFoldCase(buffer
, UPRV_LENGTHOF(buffer
),
460 mixed
, UPRV_LENGTHOF(mixed
),
463 if( U_FAILURE(errorCode
) ||
464 length
!=(UPRV_LENGTHOF(foldedDefault
)) ||
465 uprv_memcmp(foldedDefault
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
468 log_err("error in u_strFoldCase(default)=%ld error=%s string matches: %s\n",
470 u_errorName(errorCode
),
471 uprv_memcmp(foldedDefault
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
474 /* exclude special i */
477 errorCode
=U_ZERO_ERROR
;
478 length
=u_strFoldCase(buffer
, UPRV_LENGTHOF(buffer
),
479 mixed
, UPRV_LENGTHOF(mixed
),
480 U_FOLD_CASE_EXCLUDE_SPECIAL_I
,
482 if( U_FAILURE(errorCode
) ||
483 length
!=(UPRV_LENGTHOF(foldedExcludeSpecialI
)) ||
484 uprv_memcmp(foldedExcludeSpecialI
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
487 log_err("error in u_strFoldCase(exclude special i)=%ld error=%s string matches: %s\n",
489 u_errorName(errorCode
),
490 uprv_memcmp(foldedExcludeSpecialI
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
494 /* test full string case folding with default option and in the same buffer */
495 uprv_memcpy(buffer
, mixed
, sizeof(mixed
));
496 buffer
[UPRV_LENGTHOF(mixed
)]=0;
497 errorCode
=U_ZERO_ERROR
;
498 length
=u_strFoldCase(buffer
, UPRV_LENGTHOF(buffer
),
499 buffer
, -1, /* implicit srcLength */
502 if( U_FAILURE(errorCode
) ||
503 length
!=(UPRV_LENGTHOF(foldedDefault
)) ||
504 uprv_memcmp(foldedDefault
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
507 log_err("error in u_strFoldCase(default same buffer)=%ld error=%s string matches: %s\n",
509 u_errorName(errorCode
),
510 uprv_memcmp(foldedDefault
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
513 /* test full string case folding, exclude special i, in the same buffer */
515 uprv_memcpy(buffer
, mixed
, sizeof(mixed
));
516 errorCode
=U_ZERO_ERROR
;
517 length
=u_strFoldCase(buffer
, UPRV_LENGTHOF(buffer
),
518 buffer
, UPRV_LENGTHOF(mixed
),
519 U_FOLD_CASE_EXCLUDE_SPECIAL_I
,
521 if( U_FAILURE(errorCode
) ||
522 length
!=UPRV_LENGTHOF(foldedExcludeSpecialI
) ||
523 uprv_memcmp(foldedExcludeSpecialI
, buffer
, length
*U_SIZEOF_UCHAR
)!=0 ||
526 log_err("error in u_strFoldCase(exclude special i same buffer)=%ld error=%s string matches: %s\n",
528 u_errorName(errorCode
),
529 uprv_memcmp(foldedExcludeSpecialI
, buffer
, length
*U_SIZEOF_UCHAR
)==0 && buffer
[length
]==0 ? "yes" : "no");
533 /* test preflighting */
534 buffer
[0]=buffer
[2]=0xabcd;
535 errorCode
=U_ZERO_ERROR
;
536 length
=u_strFoldCase(buffer
, 2, /* set destCapacity=2 */
537 mixed
, UPRV_LENGTHOF(mixed
),
540 if( errorCode
!=U_BUFFER_OVERFLOW_ERROR
||
541 length
!=UPRV_LENGTHOF(foldedDefault
) ||
542 uprv_memcmp(foldedDefault
, buffer
, 2*U_SIZEOF_UCHAR
)!=0 ||
545 log_err("error in u_strFoldCase(default preflighting)=%ld error=%s string matches: %s\n",
547 u_errorName(errorCode
),
548 uprv_memcmp(foldedDefault
, buffer
, 2*U_SIZEOF_UCHAR
)==0 && buffer
[2]==0xabcd ? "yes" : "no");
551 errorCode
=U_ZERO_ERROR
;
552 length
=u_strFoldCase(NULL
, 0,
553 mixed
, UPRV_LENGTHOF(mixed
),
556 if( errorCode
!=U_BUFFER_OVERFLOW_ERROR
||
557 length
!=UPRV_LENGTHOF(foldedDefault
)
559 log_err("error in u_strFoldCase(default pure preflighting)=%ld error=%s\n",
561 u_errorName(errorCode
));
564 /* test error handling */
565 errorCode
=U_ZERO_ERROR
;
566 length
=u_strFoldCase(NULL
, UPRV_LENGTHOF(buffer
),
567 mixed
, UPRV_LENGTHOF(mixed
),
570 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
) {
571 log_err("error in u_strFoldCase(default dest=NULL)=%ld error=%s\n",
573 u_errorName(errorCode
));
577 errorCode
=U_ZERO_ERROR
;
578 length
=u_strFoldCase(buffer
, -1,
579 mixed
, UPRV_LENGTHOF(mixed
),
582 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
585 log_err("error in u_strFoldCase(default destCapacity=-1)=%ld error=%s buffer[0]==0x%lx\n",
587 u_errorName(errorCode
),
592 errorCode
=U_ZERO_ERROR
;
593 length
=u_strFoldCase(buffer
, UPRV_LENGTHOF(buffer
),
594 NULL
, UPRV_LENGTHOF(mixed
),
595 U_FOLD_CASE_EXCLUDE_SPECIAL_I
,
597 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
600 log_err("error in u_strFoldCase(exclude special i src=NULL)=%ld error=%s buffer[0]==0x%lx\n",
602 u_errorName(errorCode
),
607 errorCode
=U_ZERO_ERROR
;
608 length
=u_strFoldCase(buffer
, UPRV_LENGTHOF(buffer
),
610 U_FOLD_CASE_EXCLUDE_SPECIAL_I
,
612 if( errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
||
615 log_err("error in u_strFoldCase(exclude special i srcLength=-2)=%ld error=%s buffer[0]==0x%lx\n",
617 u_errorName(errorCode
),
623 TestCaseCompare(void) {
626 mixed
[]= { 0x61, 0x42, 0x131, 0x3a3, 0xdf, 0xfb03, 0xd93f, 0xdfff, 0 },
627 otherDefault
[]= { 0x41, 0x62, 0x131, 0x3c3, 0x73, 0x53, 0x46, 0x66, 0x49, 0xd93f, 0xdfff, 0 },
628 otherExcludeSpecialI
[]={ 0x41, 0x62, 0x131, 0x3c3, 0x53, 0x73, 0x66, 0x46, 0x69, 0xd93f, 0xdfff, 0 },
629 different
[]= { 0x41, 0x62, 0x131, 0x3c3, 0x73, 0x53, 0x46, 0x66, 0x49, 0xd93f, 0xdffd, 0 };
631 UVersionInfo unicodeVersion
={ 0, 0, 17, 89 }, unicode_3_1
={ 3, 1, 0, 0 };
633 int32_t result
, lenMixed
, lenOtherDefault
, lenOtherExcludeSpecialI
, lenDifferent
;
634 UErrorCode errorCode
;
637 errorCode
=U_ZERO_ERROR
;
639 lenMixed
=u_strlen(mixed
);
640 lenOtherDefault
=u_strlen(otherDefault
);
641 (void)lenOtherDefault
; /* Suppress set but not used warning. */
642 lenOtherExcludeSpecialI
=u_strlen(otherExcludeSpecialI
);
643 lenDifferent
=u_strlen(different
);
645 /* if unicodeVersion()>=3.1 then test exclude-special-i cases as well */
646 u_getUnicodeVersion(unicodeVersion
);
647 isUnicode_3_1
= uprv_memcmp(unicodeVersion
, unicode_3_1
, 4)>=0;
648 (void)isUnicode_3_1
; /* Suppress set but not used warning. */
650 /* test u_strcasecmp() */
651 result
=u_strcasecmp(mixed
, otherDefault
, U_FOLD_CASE_DEFAULT
);
653 log_err("error: u_strcasecmp(mixed, other, default)=%ld instead of 0\n", result
);
655 result
=u_strCaseCompare(mixed
, -1, otherDefault
, -1, U_FOLD_CASE_DEFAULT
, &errorCode
);
657 log_err("error: u_strCaseCompare(mixed, other, default)=%ld instead of 0\n", result
);
660 /* test u_strcasecmp() - exclude special i */
661 result
=u_strcasecmp(mixed
, otherExcludeSpecialI
, U_FOLD_CASE_EXCLUDE_SPECIAL_I
);
663 log_err("error: u_strcasecmp(mixed, other, exclude special i)=%ld instead of 0\n", result
);
665 result
=u_strCaseCompare(mixed
, lenMixed
, otherExcludeSpecialI
, lenOtherExcludeSpecialI
, U_FOLD_CASE_EXCLUDE_SPECIAL_I
, &errorCode
);
667 log_err("error: u_strCaseCompare(mixed, other, exclude special i)=%ld instead of 0\n", result
);
670 /* test u_strcasecmp() */
671 result
=u_strcasecmp(mixed
, different
, U_FOLD_CASE_DEFAULT
);
673 log_err("error: u_strcasecmp(mixed, different, default)=%ld instead of positive\n", result
);
675 result
=u_strCaseCompare(mixed
, -1, different
, lenDifferent
, U_FOLD_CASE_DEFAULT
, &errorCode
);
677 log_err("error: u_strCaseCompare(mixed, different, default)=%ld instead of positive\n", result
);
680 /* test u_strncasecmp() - stop before the sharp s (U+00df) */
681 result
=u_strncasecmp(mixed
, different
, 4, U_FOLD_CASE_DEFAULT
);
683 log_err("error: u_strncasecmp(mixed, different, 4, default)=%ld instead of 0\n", result
);
685 result
=u_strCaseCompare(mixed
, 4, different
, 4, U_FOLD_CASE_DEFAULT
, &errorCode
);
687 log_err("error: u_strCaseCompare(mixed, 4, different, 4, default)=%ld instead of 0\n", result
);
690 /* test u_strncasecmp() - stop in the middle of the sharp s (U+00df) */
691 result
=u_strncasecmp(mixed
, different
, 5, U_FOLD_CASE_DEFAULT
);
693 log_err("error: u_strncasecmp(mixed, different, 5, default)=%ld instead of positive\n", result
);
695 result
=u_strCaseCompare(mixed
, 5, different
, 5, U_FOLD_CASE_DEFAULT
, &errorCode
);
697 log_err("error: u_strCaseCompare(mixed, 5, different, 5, default)=%ld instead of positive\n", result
);
700 /* test u_memcasecmp() - stop before the sharp s (U+00df) */
701 result
=u_memcasecmp(mixed
, different
, 4, U_FOLD_CASE_DEFAULT
);
703 log_err("error: u_memcasecmp(mixed, different, 4, default)=%ld instead of 0\n", result
);
706 /* test u_memcasecmp() - stop in the middle of the sharp s (U+00df) */
707 result
=u_memcasecmp(mixed
, different
, 5, U_FOLD_CASE_DEFAULT
);
709 log_err("error: u_memcasecmp(mixed, different, 5, default)=%ld instead of positive\n", result
);
713 /* test UCaseMap ------------------------------------------------------------ */
716 * API test for UCaseMap;
717 * test cases for actual case mappings using UCaseMap see
718 * intltest utility/UnicodeStringTest/StringCaseTest/TestCasing
723 aBc
[] ={ 0x61, 0x42, 0x63, 0 },
724 abc
[] ={ 0x61, 0x62, 0x63, 0 },
725 ABCg
[]={ 0x41, 0x42, 0x43, 0x67, 0 },
726 defg
[]={ 0x64, 0x65, 0x66, 0x67, 0 };
733 UErrorCode errorCode
;
735 errorCode
=U_ZERO_ERROR
;
736 csm
=ucasemap_open("tur", 0xa5, &errorCode
);
737 if(U_FAILURE(errorCode
)) {
738 log_err("ucasemap_open(\"tur\") failed - %s\n", u_errorName(errorCode
));
741 locale
=ucasemap_getLocale(csm
);
742 if(0!=strcmp(locale
, "tr")) {
743 log_err("ucasemap_getLocale(ucasemap_open(\"tur\"))==%s!=\"tr\"\n", locale
);
745 /* overly long locale IDs get truncated to their language code to avoid unnecessary allocation */
746 ucasemap_setLocale(csm
, "I-kLInGOn-the-quick-brown-fox-jumps-over-the-lazy-dog", &errorCode
);
747 locale
=ucasemap_getLocale(csm
);
748 if(0!=strcmp(locale
, "i-klingon")) {
749 log_err("ucasemap_getLocale(ucasemap_setLocale(\"I-kLInGOn-the-quick-br...\"))==%s!=\"i-klingon\"\n", locale
);
752 errorCode
=U_ZERO_ERROR
;
753 options
=ucasemap_getOptions(csm
);
755 log_err("ucasemap_getOptions(ucasemap_open(0xa5))==0x%lx!=0xa5\n", (long)options
);
757 ucasemap_setOptions(csm
, 0x333333, &errorCode
);
758 options
=ucasemap_getOptions(csm
);
759 if(options
!=0x333333) {
760 log_err("ucasemap_getOptions(ucasemap_setOptions(0x333333))==0x%lx!=0x333333\n", (long)options
);
763 /* test case mapping API; not all permutations necessary due to shared implementation code */
765 /* NUL terminated source */
766 errorCode
=U_ZERO_ERROR
;
767 length
=ucasemap_utf8ToLower(csm
, utf8Out
, (int32_t)sizeof(utf8Out
), aBc
, -1, &errorCode
);
768 if(U_FAILURE(errorCode
) || length
!=3 || 0!=strcmp(abc
, utf8Out
)) {
769 log_err("ucasemap_utf8ToLower(aBc\\0) failed\n");
772 /* incoming failure code */
773 errorCode
=U_PARSE_ERROR
;
774 strcpy(utf8Out
, defg
);
775 length
=ucasemap_utf8ToLower(csm
, utf8Out
, (int32_t)sizeof(utf8Out
), aBc
, -1, &errorCode
);
776 if(errorCode
!=U_PARSE_ERROR
|| 0!=strcmp(defg
, utf8Out
)) {
777 log_err("ucasemap_utf8ToLower(failure) failed\n");
780 /* overlapping input & output */
781 errorCode
=U_ZERO_ERROR
;
782 strcpy(utf8Out
, aBc
);
783 length
=ucasemap_utf8ToUpper(csm
, utf8Out
, 2, utf8Out
+1, 2, &errorCode
);
784 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
|| 0!=strcmp(aBc
, utf8Out
)) {
785 log_err("ucasemap_utf8ToUpper(overlap 1) failed\n");
788 /* overlap in the other direction */
789 errorCode
=U_ZERO_ERROR
;
790 strcpy(utf8Out
, aBc
);
791 length
=ucasemap_utf8ToUpper(csm
, utf8Out
+1, 2, utf8Out
, 2, &errorCode
);
792 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
|| 0!=strcmp(aBc
, utf8Out
)) {
793 log_err("ucasemap_utf8ToUpper(overlap 2) failed\n");
796 /* NULL destination */
797 errorCode
=U_ZERO_ERROR
;
798 strcpy(utf8Out
, defg
);
799 length
=ucasemap_utf8ToLower(csm
, NULL
, (int32_t)sizeof(utf8Out
), aBc
, -1, &errorCode
);
800 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
|| 0!=strcmp(defg
, utf8Out
)) {
801 log_err("ucasemap_utf8ToLower(dest=NULL) failed\n");
805 errorCode
=U_ZERO_ERROR
;
806 strcpy(utf8Out
, defg
);
807 length
=ucasemap_utf8ToLower(csm
, utf8Out
, -2, aBc
, -1, &errorCode
);
808 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
|| 0!=strcmp(defg
, utf8Out
)) {
809 log_err("ucasemap_utf8ToLower(destCapacity<0) failed\n");
813 errorCode
=U_ZERO_ERROR
;
814 strcpy(utf8Out
, defg
);
815 length
=ucasemap_utf8ToLower(csm
, utf8Out
, (int32_t)sizeof(utf8Out
), NULL
, -1, &errorCode
);
816 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
|| 0!=strcmp(defg
, utf8Out
)) {
817 log_err("ucasemap_utf8ToLower(src=NULL) failed\n");
821 errorCode
=U_ZERO_ERROR
;
822 strcpy(utf8Out
, defg
);
823 length
=ucasemap_utf8ToLower(csm
, utf8Out
, (int32_t)sizeof(utf8Out
), aBc
, -2, &errorCode
);
824 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
|| 0!=strcmp(defg
, utf8Out
)) {
825 log_err("ucasemap_utf8ToLower(srcLength<-1) failed\n");
828 /* buffer overflow */
829 errorCode
=U_ZERO_ERROR
;
830 strcpy(utf8Out
, defg
);
831 length
=ucasemap_utf8ToUpper(csm
, utf8Out
, 2, aBc
, 3, &errorCode
);
832 if(errorCode
!=U_BUFFER_OVERFLOW_ERROR
|| length
!=3 || 0!=strcmp(defg
+2, utf8Out
+2)) {
833 log_err("ucasemap_utf8ToUpper(overflow) failed\n");
836 /* dest not terminated (leaves g from defg alone) */
837 errorCode
=U_ZERO_ERROR
;
838 strcpy(utf8Out
, defg
);
839 length
=ucasemap_utf8ToUpper(csm
, utf8Out
, 3, aBc
, 3, &errorCode
);
840 if(errorCode
!=U_STRING_NOT_TERMINATED_WARNING
|| length
!=3 || 0!=strcmp(ABCg
, utf8Out
)) {
841 log_err("ucasemap_utf8ToUpper(overflow) failed\n");
844 /* C API coverage for case folding. More thorough test via C++ intltest's StringCaseTest::TestCasing(). */
845 errorCode
=U_ZERO_ERROR
;
847 length
=ucasemap_utf8FoldCase(csm
, utf8Out
, (int32_t)sizeof(utf8Out
), aBc
, 3, &errorCode
);
848 if(U_FAILURE(errorCode
) || length
!=3 || 0!=strcmp(abc
, utf8Out
)) {
849 log_err("ucasemap_utf8FoldCase(aBc) failed\n");
855 #if !UCONFIG_NO_BREAK_ITERATION
857 /* Try titlecasing with options. */
859 TestUCaseMapToTitle(void) {
860 /* "a 'CaT. A 'dOg! 'eTc." where '=U+02BB */
862 * Note: The sentence BreakIterator does not recognize a '.'
863 * as a sentence terminator if it is followed by lowercase.
864 * That is why the example has the '!'.
868 beforeTitle
[]= { 0x61, 0x20, 0x2bb, 0x43, 0x61, 0x54, 0x2e, 0x20, 0x41, 0x20, 0x2bb, 0x64, 0x4f, 0x67, 0x21, 0x20, 0x2bb, 0x65, 0x54, 0x63, 0x2e },
869 titleWord
[]= { 0x41, 0x20, 0x2bb, 0x43, 0x61, 0x74, 0x2e, 0x20, 0x41, 0x20, 0x2bb, 0x44, 0x6f, 0x67, 0x21, 0x20, 0x2bb, 0x45, 0x74, 0x63, 0x2e },
870 titleWordNoAdjust
[]={ 0x41, 0x20, 0x2bb, 0x63, 0x61, 0x74, 0x2e, 0x20, 0x41, 0x20, 0x2bb, 0x64, 0x6f, 0x67, 0x21, 0x20, 0x2bb, 0x65, 0x74, 0x63, 0x2e },
871 titleSentNoLower
[]= { 0x41, 0x20, 0x2bb, 0x43, 0x61, 0x54, 0x2e, 0x20, 0x41, 0x20, 0x2bb, 0x64, 0x4f, 0x67, 0x21, 0x20, 0x2bb, 0x45, 0x54, 0x63, 0x2e };
875 UBreakIterator
*sentenceIter
;
876 const UBreakIterator
*iter
;
878 UErrorCode errorCode
;
880 errorCode
=U_ZERO_ERROR
;
881 csm
=ucasemap_open("", 0, &errorCode
);
882 if(U_FAILURE(errorCode
)) {
883 log_err("ucasemap_open(\"\") failed - %s\n", u_errorName(errorCode
));
887 iter
=ucasemap_getBreakIterator(csm
);
889 log_err("ucasemap_getBreakIterator() returns %p!=NULL before setting any iterator or titlecasing\n", iter
);
892 /* Use default UBreakIterator: Word breaks. */
893 length
=ucasemap_toTitle(csm
, buffer
, UPRV_LENGTHOF(buffer
), beforeTitle
, UPRV_LENGTHOF(beforeTitle
), &errorCode
);
894 if( U_FAILURE(errorCode
) ||
895 length
!=UPRV_LENGTHOF(titleWord
) ||
896 0!=u_memcmp(buffer
, titleWord
, length
) ||
899 log_err_status(errorCode
, "ucasemap_toTitle(default iterator)=%ld failed - %s\n", (long)length
, u_errorName(errorCode
));
901 if (U_SUCCESS(errorCode
)) {
902 iter
=ucasemap_getBreakIterator(csm
);
904 log_err("ucasemap_getBreakIterator() returns NULL after titlecasing\n");
908 /* Try U_TITLECASE_NO_BREAK_ADJUSTMENT. */
909 ucasemap_setOptions(csm
, U_TITLECASE_NO_BREAK_ADJUSTMENT
, &errorCode
);
910 if(U_FAILURE(errorCode
)) {
911 log_err_status(errorCode
, "error: ucasemap_setOptions(U_TITLECASE_NO_BREAK_ADJUSTMENT) failed - %s\n", u_errorName(errorCode
));
915 length
=ucasemap_toTitle(csm
, buffer
, UPRV_LENGTHOF(buffer
), beforeTitle
, UPRV_LENGTHOF(beforeTitle
), &errorCode
);
916 if( U_FAILURE(errorCode
) ||
917 length
!=UPRV_LENGTHOF(titleWordNoAdjust
) ||
918 0!=u_memcmp(buffer
, titleWordNoAdjust
, length
) ||
921 log_err("ucasemap_toTitle(default iterator, no break adjustment)=%ld failed - %s\n", (long)length
, u_errorName(errorCode
));
924 /* Set a sentence break iterator. */
925 errorCode
=U_ZERO_ERROR
;
926 sentenceIter
=ubrk_open(UBRK_SENTENCE
, "", NULL
, 0, &errorCode
);
927 if(U_FAILURE(errorCode
)) {
928 log_err("error: ubrk_open(UBRK_SENTENCE) failed - %s\n", u_errorName(errorCode
));
932 ucasemap_setBreakIterator(csm
, sentenceIter
, &errorCode
);
933 if(U_FAILURE(errorCode
)) {
934 log_err("error: ucasemap_setBreakIterator(sentence iterator) failed - %s\n", u_errorName(errorCode
));
935 ubrk_close(sentenceIter
);
939 iter
=ucasemap_getBreakIterator(csm
);
940 if(iter
!=sentenceIter
) {
941 log_err("ucasemap_getBreakIterator() returns %p!=%p after setting the iterator\n", iter
, sentenceIter
);
944 ucasemap_setOptions(csm
, U_TITLECASE_NO_LOWERCASE
, &errorCode
);
945 if(U_FAILURE(errorCode
)) {
946 log_err("error: ucasemap_setOptions(U_TITLECASE_NO_LOWERCASE) failed - %s\n", u_errorName(errorCode
));
950 /* Use the sentence break iterator with the option. Preflight first. */
951 length
=ucasemap_toTitle(csm
, NULL
, 0, beforeTitle
, UPRV_LENGTHOF(beforeTitle
), &errorCode
);
952 if( errorCode
!=U_BUFFER_OVERFLOW_ERROR
||
953 length
!=UPRV_LENGTHOF(titleSentNoLower
)
955 log_err("ucasemap_toTitle(preflight sentence break iterator, no lowercasing)=%ld failed - %s\n", (long)length
, u_errorName(errorCode
));
958 errorCode
=U_ZERO_ERROR
;
960 length
=ucasemap_toTitle(csm
, buffer
, UPRV_LENGTHOF(buffer
), beforeTitle
, UPRV_LENGTHOF(beforeTitle
), &errorCode
);
961 if( U_FAILURE(errorCode
) ||
962 length
!=UPRV_LENGTHOF(titleSentNoLower
) ||
963 0!=u_memcmp(buffer
, titleSentNoLower
, length
) ||
966 log_err("ucasemap_toTitle(sentence break iterator, no lowercasing)=%ld failed - %s\n", (long)length
, u_errorName(errorCode
));
969 /* UTF-8 C API coverage. More thorough test via C++ intltest's StringCaseTest::TestCasing(). */
971 char utf8BeforeTitle
[64], utf8TitleSentNoLower
[64], utf8
[64];
972 int32_t utf8BeforeTitleLength
, utf8TitleSentNoLowerLength
;
974 errorCode
=U_ZERO_ERROR
;
975 u_strToUTF8(utf8BeforeTitle
, (int32_t)sizeof(utf8BeforeTitle
), &utf8BeforeTitleLength
, beforeTitle
, UPRV_LENGTHOF(beforeTitle
), &errorCode
);
976 u_strToUTF8(utf8TitleSentNoLower
, (int32_t)sizeof(utf8TitleSentNoLower
), &utf8TitleSentNoLowerLength
, titleSentNoLower
, UPRV_LENGTHOF(titleSentNoLower
), &errorCode
);
978 length
=ucasemap_utf8ToTitle(csm
, utf8
, (int32_t)sizeof(utf8
), utf8BeforeTitle
, utf8BeforeTitleLength
, &errorCode
);
979 if( U_FAILURE(errorCode
) ||
980 length
!=utf8TitleSentNoLowerLength
||
981 0!=uprv_memcmp(utf8
, utf8TitleSentNoLower
, length
) ||
984 log_err("ucasemap_utf8ToTitle(sentence break iterator, no lowercasing)=%ld failed - %s\n", (long)length
, u_errorName(errorCode
));
993 /* Test case for internal API u_caseInsensitivePrefixMatch */
995 TestUCaseInsensitivePrefixMatch(void) {
1002 {"ABC", "ab", 2, 2},
1003 {"ABCD", "abcx", 3, 3},
1004 {"ABC", "xyz", 0, 0},
1005 /* U+00DF LATIN SMALL LETTER SHARP S */
1006 {"A\\u00dfBC", "Ass", 2, 3},
1007 {"Fust", "Fu\\u00dfball", 2, 2},
1008 {"\\u00dfsA", "s\\u00dfB", 2, 2},
1009 {"\\u00dfs", "s\\u00df", 2, 2},
1010 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */
1011 {"XYZ\\u0130i\\u0307xxx", "xyzi\\u0307\\u0130yyy", 6, 6},
1016 for (i
= 0; testCases
[i
].s1
!= 0; i
++) {
1017 UErrorCode sts
= U_ZERO_ERROR
;
1018 UChar u1
[64], u2
[64];
1019 int32_t matchLen1
, matchLen2
;
1021 u_unescape(testCases
[i
].s1
, u1
, 64);
1022 u_unescape(testCases
[i
].s2
, u2
, 64);
1024 u_caseInsensitivePrefixMatch(u1
, -1, u2
, -1, 0, &matchLen1
, &matchLen2
, &sts
);
1025 if (U_FAILURE(sts
)) {
1026 log_err("error: %s, s1=%s, s2=%s", u_errorName(sts
), testCases
[i
].s1
, testCases
[i
].s2
);
1027 } else if (matchLen1
!= testCases
[i
].r1
|| matchLen2
!= testCases
[i
].r2
) {
1028 log_err("s1=%s, s2=%2 / match len1=%d, len2=%d / expected len1=%d, len2=%d",
1029 testCases
[i
].s1
, testCases
[i
].s2
,
1030 matchLen1
, matchLen2
,
1031 testCases
[i
].r1
, testCases
[i
].r2
);
1036 void addCaseTest(TestNode
** root
);
1038 void addCaseTest(TestNode
** root
) {
1039 /* cstrcase.c functions, declared in cucdtst.h */
1040 addTest(root
, &TestCaseLower
, "tsutil/cstrcase/TestCaseLower");
1041 addTest(root
, &TestCaseUpper
, "tsutil/cstrcase/TestCaseUpper");
1042 #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILE_IO
1043 addTest(root
, &TestCaseTitle
, "tsutil/cstrcase/TestCaseTitle");
1044 addTest(root
, &TestCaseDutchTitle
, "tsutil/cstrcase/TestCaseDutchTitle");
1046 addTest(root
, &TestCaseFolding
, "tsutil/cstrcase/TestCaseFolding");
1047 addTest(root
, &TestCaseCompare
, "tsutil/cstrcase/TestCaseCompare");
1048 addTest(root
, &TestUCaseMap
, "tsutil/cstrcase/TestUCaseMap");
1049 #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILE_IO
1050 addTest(root
, &TestUCaseMapToTitle
, "tsutil/cstrcase/TestUCaseMapToTitle");
1052 addTest(root
, &TestUCaseInsensitivePrefixMatch
, "tsutil/cstrcase/TestUCaseInsensitivePrefixMatch");