+
+void
+StringCaseTest::TestFullCaseFoldingIterator() {
+ UnicodeString ffi=UNICODE_STRING_SIMPLE("ffi");
+ UnicodeString ss=UNICODE_STRING_SIMPLE("ss");
+ FullCaseFoldingIterator iter;
+ int32_t count=0;
+ int32_t countSpecific=0;
+ UChar32 c;
+ UnicodeString full;
+ while((c=iter.next(full))>=0) {
+ ++count;
+ // Check that the full Case_Folding has more than 1 code point.
+ if(!full.hasMoreChar32Than(0, 0x7fffffff, 1)) {
+ errln("error: FullCaseFoldingIterator.next()=U+%04lX full Case_Folding has at most 1 code point", (long)c);
+ continue;
+ }
+ // Check that full == Case_Folding(c).
+ UnicodeString cf(c);
+ cf.foldCase();
+ if(full!=cf) {
+ errln("error: FullCaseFoldingIterator.next()=U+%04lX full Case_Folding != cf(c)", (long)c);
+ continue;
+ }
+ // Spot-check a couple of specific cases.
+ if((full==ffi && c==0xfb03) || (full==ss && (c==0xdf || c==0x1e9e))) {
+ ++countSpecific;
+ }
+ }
+ if(countSpecific!=3) {
+ errln("error: FullCaseFoldingIterator did not yield exactly the expected specific cases");
+ }
+ if(count<70) {
+ errln("error: FullCaseFoldingIterator yielded only %d (cp, full) pairs", (int)count);
+ }
+}