/******************************************************************** * COPYRIGHT: * Copyright (c) 2001, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************* * * File cmsccoll.C * *******************************************************************************/ /** * These are the tests specific to ICU 1.8 and above, that I didn't know where * to fit. */ #include #include "unicode/utypes.h" #include "unicode/ucol.h" #include "unicode/ucoleitr.h" #include "unicode/uloc.h" #include "cintltst.h" #include "ccolltst.h" #include "callcoll.h" #include "unicode/ustring.h" #include "string.h" #include "ucol_imp.h" #include "ucol_tok.h" #include "cmemory.h" #include "ucmp32.h" #ifdef WIN32 #define UNICODE #include #else #define LCID uint32_t #define LOCALE_SYSTEM_DEFAULT 0 #endif #define MAX_TOKEN_LEN 16 typedef int tst_strcoll(void *collator, const int object, const UChar *source, const int sLen, const UChar *target, const int tLen); /** * Return an integer array containing all of the collation orders * returned by calls to next on the specified iterator */ static int32_t* getOrders(UCollationElements *iter, int32_t *orderLength) { UErrorCode status; int32_t order; int32_t maxSize = 100; int32_t size = 0; int32_t *temp; int32_t *orders =(int32_t*)malloc(sizeof(int32_t) * maxSize); status= U_ZERO_ERROR; while ((order=ucol_next(iter, &status)) != UCOL_NULLORDER) { if (size == maxSize) { maxSize *= 2; temp = (int32_t*)malloc(sizeof(int32_t) * maxSize); memcpy(temp, orders, size * sizeof(int32_t)); free(orders); orders = temp; } orders[size++] = order; } if (maxSize > size) { temp = (int32_t*)malloc(sizeof(int32_t) * size); memcpy(temp, orders, size * sizeof(int32_t)); free(orders); orders = temp; } *orderLength = size; return orders; } static void backAndForth(UCollationElements *iter) { /* Run through the iterator forwards and stick it into an array */ int32_t index, o; UErrorCode status = U_ZERO_ERROR; int32_t orderLength = 0; int32_t *orders; orders= getOrders(iter, &orderLength); /* Now go through it backwards and make sure we get the same values */ index = orderLength; ucol_reset(iter); /* synwee : changed */ while ((o = ucol_previous(iter, &status)) != UCOL_NULLORDER) { if (o != orders[-- index]) { if (o == 0) index ++; else { while (index > 0 && orders[-- index] == 0) { } if (o != orders[index]) { log_err("Mismatch at index : %d\n", index); break; } } } } while (index != 0 && orders[index - 1] == 0) { index --; } if (index != 0) { log_err("Didn't get back to beginning - index is %d\n", index); ucol_reset(iter); log_err("\nnext: "); while ((o = ucol_next(iter, &status)) != UCOL_NULLORDER) { log_err("Error at %d\n", o); } log_err("\nprev: "); while ((o = ucol_previous(iter, &status)) != UCOL_NULLORDER) { log_err("Error at %d\n", o); } log_verbose("\n"); } free(orders); } const static char cnt1[][10] = { "AA", "AC", "AZ", "AQ", "AB", "ABZ", "ABQ", "Z", "ABC", "Q", "B" }; const static char cnt2[][10] = { "DA", "DAD", "DAZ", "MAR", "Z", "DAVIS", "MARK", "DAV", "DAVI" }; static void IncompleteCntTest( ) { UErrorCode status = U_ZERO_ERROR; UChar *temp=(UChar*)malloc(sizeof(UChar) * 90); UChar *t1 =(UChar*)malloc(sizeof(UChar) * 90); UChar *t2 =(UChar*)malloc(sizeof(UChar) * 90); UCollator *coll = NULL; uint32_t i = 0, j = 0; uint32_t size = 0; u_uastrcpy(temp, " & Z < ABC < Q < B"); coll = ucol_openRules(temp, u_strlen(temp), UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status); if(U_SUCCESS(status)) { size = sizeof(cnt1)/sizeof(cnt1[0]); for(i = 0; i < size-1; i++) { for(j = i+1; j < size; j++) { UCollationElements *iter; u_uastrcpy(t1, cnt1[i]); u_uastrcpy(t2, cnt1[j]); doTest(coll, t1, t2, UCOL_LESS); /* synwee : added collation element iterator test */ iter = ucol_openElements(coll, t2, u_strlen(t2), &status); if (U_FAILURE(status)) { log_err("Creation of iterator failed\n"); break; } backAndForth(iter); free(iter); } } } ucol_close(coll); u_uastrcpy(temp, " & Z < DAVIS < MARK 0x0400 && *p<0x0500)?0x00e1:0x491; UChar preQ = (*p>0x0400 && *p<0x0500)?0x0041:0x413; */ /*log_verbose("Testing primary\n");*/ doTest(col, p, q, UCOL_LESS); /* UCollationResult result = ucol_strcoll(col,p,u_strlen(p),q,u_strlen(q)); if(result!=UCOL_LESS){ aescstrdup(p,utfSource,256); aescstrdup(q,utfTarget,256); fprintf(file,"Primary failed source: %s target: %s \n", utfSource,utfTarget); } */ source[0] = preP; u_strcpy(source+1,p); target[0] = preQ; u_strcpy(target+1,q); doTest(col, source, target, UCOL_LESS); /* fprintf(file,"Primary swamps 2nd failed source: %s target: %s \n", utfSource,utfTarget); */ } static void testSecondary(UCollator* col, const UChar* p,const UChar* q){ UChar source[256] = { '\0'}; UChar target[256] = { '\0'}; /*log_verbose("Testing secondary\n");*/ doTest(col, p, q, UCOL_LESS); /* fprintf(file,"secondary failed source: %s target: %s \n", utfSource,utfTarget); */ source[0] = 0x0053; u_strcpy(source+1,p); target[0]= 0x0073; u_strcpy(target+1,q); doTest(col, source, target, UCOL_LESS); /* fprintf(file,"secondary swamps 3rd failed source: %s target: %s \n",utfSource,utfTarget); */ u_strcpy(source,p); source[u_strlen(p)] = 0x62; source[u_strlen(p)+1] = 0; u_strcpy(target,q); target[u_strlen(q)] = 0x61; target[u_strlen(q)+1] = 0; doTest(col, source, target, UCOL_GREATER); /* fprintf(file,"secondary is swamped by 1 failed source: %s target: %s \n",utfSource,utfTarget); */ } static void testTertiary(UCollator* col, const UChar* p,const UChar* q){ UChar source[256] = { '\0'}; UChar target[256] = { '\0'}; /*log_verbose("Testing tertiary\n");*/ doTest(col, p, q, UCOL_LESS); /* fprintf(file,"Tertiary failed source: %s target: %s \n",utfSource,utfTarget); */ source[0] = 0x0020; u_strcpy(source+1,p); target[0]= 0x002D; u_strcpy(target+1,q); doTest(col, source, target, UCOL_LESS); /* fprintf(file,"Tertiary swamps 4th failed source: %s target: %s \n", utfSource,utfTarget); */ u_strcpy(source,p); source[u_strlen(p)] = 0xE0; source[u_strlen(p)+1] = 0; u_strcpy(target,q); target[u_strlen(q)] = 0x61; target[u_strlen(q)+1] = 0; doTest(col, source, target, UCOL_GREATER); /* fprintf(file,"Tertiary is swamped by 3rd failed source: %s target: %s \n",utfSource,utfTarget); */ } static void testEquality(UCollator* col, const UChar* p,const UChar* q){ /* UChar source[256] = { '\0'}; UChar target[256] = { '\0'}; */ doTest(col, p, q, UCOL_EQUAL); /* fprintf(file,"Primary failed source: %s target: %s \n", utfSource,utfTarget); */ } static void testCollator(UCollator *coll, UErrorCode *status) { const UChar *rules = NULL, *current = NULL; int32_t ruleLen = 0; uint32_t strength = 0; uint32_t chOffset = 0; uint32_t chLen = 0; uint32_t exOffset = 0; uint32_t exLen = 0; uint32_t firstEx = 0; /* uint32_t rExpsLen = 0; */ uint32_t firstLen = 0; UBool varT = FALSE; UBool top_ = TRUE; uint8_t specs = 0; UBool startOfRules = TRUE; UBool lastReset = FALSE; UColTokenParser src; UColOptionSet opts; UChar first[256]; UChar second[256]; UChar *rulesCopy = NULL; src.opts = &opts; rules = ucol_getRules(coll, &ruleLen); if(U_SUCCESS(*status) && ruleLen > 0) { rulesCopy = (UChar *)uprv_malloc((ruleLen+UCOL_TOK_EXTRA_RULE_SPACE_SIZE)*sizeof(UChar)); uprv_memcpy(rulesCopy, rules, ruleLen*sizeof(UChar)); src.source = src.current = rulesCopy; src.end = rulesCopy+ruleLen; src.extraCurrent = src.end; src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE; *first = *second = 0; while ((current = ucol_tok_parseNextToken(&src, &strength, &chOffset, &chLen, &exOffset, &exLen, &specs, startOfRules, status)) != NULL) { startOfRules = FALSE; varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0); top_ = (UBool)((specs & UCOL_TOK_TOP) != 0); u_strncpy(second,rulesCopy+chOffset, chLen); second[chLen] = 0; if(exLen > 0 && firstEx == 0) { u_strncat(first, rulesCopy+exOffset, exLen); first[firstLen+exLen] = 0; } lastReset = FALSE; switch(strength){ case UCOL_IDENTICAL: testEquality(coll,first,second); break; case UCOL_PRIMARY: testPrimary(coll,first,second); break; case UCOL_SECONDARY: testSecondary(coll,first,second); break; case UCOL_TERTIARY: testTertiary(coll,first,second); break; case UCOL_TOK_RESET: default: break; } firstLen = chLen; firstEx = exLen; u_strcpy(first, second); } uprv_free(rulesCopy); } } static int ucaTest(void *collator, const int object, const UChar *source, const int sLen, const UChar *target, const int tLen) { UCollator *UCA = (UCollator *)collator; return ucol_strcoll(UCA, source, sLen, target, tLen); } /* static int winTest(void *collator, const int object, const UChar *source, const int sLen, const UChar *target, const int tLen) { #ifdef WIN32 LCID lcid = (LCID)collator; return CompareString(lcid, 0, source, sLen, target, tLen); #else return 0; #endif } */ static UCollationResult swampEarlier(tst_strcoll* func, void *collator, int opts, UChar s1, UChar s2, const UChar *s, const uint32_t sLen, const UChar *t, const uint32_t tLen) { UChar source[256] = {0}; UChar target[256] = {0}; source[0] = s1; u_strcpy(source+1, s); target[0] = s2; u_strcpy(target+1, t); return func(collator, opts, source, sLen+1, target, tLen+1); } static UCollationResult swampLater(tst_strcoll* func, void *collator, int opts, UChar s1, UChar s2, const UChar *s, const uint32_t sLen, const UChar *t, const uint32_t tLen) { UChar source[256] = {0}; UChar target[256] = {0}; u_strcpy(source, s); source[sLen] = s1; u_strcpy(target, t); target[tLen] = s2; return func(collator, opts, source, sLen+1, target, tLen+1); } static uint32_t probeStrength(tst_strcoll* func, void *collator, int opts, const UChar *s, const uint32_t sLen, const UChar *t, const uint32_t tLen, UCollationResult result) { UChar fPrimary = 0x6d; UChar sPrimary = 0x6e; UChar fSecondary = 0x310d; UChar sSecondary = 0x31a3; UChar fTertiary = 0x310f; UChar sTertiary = 0x31b7; UCollationResult oposite; if(result == UCOL_EQUAL) { return UCOL_IDENTICAL; } else if(result == UCOL_GREATER) { oposite = UCOL_LESS; } else { oposite = UCOL_GREATER; } if(swampEarlier(func, collator, opts, sSecondary, fSecondary, s, sLen, t, tLen) == result) { return UCOL_PRIMARY; } else if((swampEarlier(func, collator, opts, sTertiary, 0x310f, s, sLen, t, tLen) == result) && (swampEarlier(func, collator, opts, 0x310f, sTertiary, s, sLen, t, tLen) == result)) { return UCOL_SECONDARY; } else if((swampLater(func, collator, opts, sTertiary, fTertiary, s, sLen, t, tLen) == result) && (swampLater(func, collator, opts, fTertiary, sTertiary, s, sLen, t, tLen) == result)) { return UCOL_TERTIARY; } else if((swampLater(func, collator, opts, sTertiary, 0x310f, s, sLen, t, tLen) == oposite) && (swampLater(func, collator, opts, fTertiary, sTertiary, s, sLen, t, tLen) == oposite)) { return UCOL_QUATERNARY; } else { return UCOL_IDENTICAL; } } static char *getRelationSymbol(UCollationResult res, uint32_t strength, char *buffer) { uint32_t i = 0; if(res == UCOL_EQUAL || strength == 0xdeadbeef) { buffer[0] = '='; buffer[1] = '='; buffer[2] = '\0'; } else if(res == UCOL_GREATER) { for(i = 0; i=0x20) { toPrint = (char)rules[i]; if(toPrint == '&') { line = 1; fprintf(stdout, "\n&"); } else if(toPrint == ';') { fprintf(stdout, "<<"); line+=2; } else if(toPrint == ',') { fprintf(stdout, "<<<"); line+=3; } else { fprintf(stdout, "%c", toPrint); line++; } } else if(rules[i]<0x3400 || rules[i]>=0xa000) { fprintf(stdout, "\\u%04X", rules[i]); line+=6; } if(line>72) { fprintf(stdout, "\n"); line = 0; } } log_verbose("\n"); } static uint32_t testSwitch(tst_strcoll* func, void *collator, int opts, uint32_t strength, const UChar *first, const UChar *second, const char* msg) { uint32_t diffs = 0; UCollationResult realResult; uint32_t realStrength; uint32_t sLen = u_strlen(first); uint32_t tLen = u_strlen(second); realResult = func(collator, opts, first, sLen, second, tLen); realStrength = probeStrength(func, collator, opts, first, sLen, second, tLen, realResult); if(strength == UCOL_IDENTICAL && realResult != UCOL_IDENTICAL) { logFailure(msg, "tailoring", first, sLen, second, tLen, realResult, realStrength, UCOL_EQUAL, strength); diffs++; } else if(realResult != UCOL_LESS || realStrength != strength) { logFailure(msg, "tailoring", first, sLen, second, tLen, realResult, realStrength, UCOL_LESS, strength); diffs++; } return diffs; } static void testAgainstUCA(UCollator *coll, UCollator *UCA, LCID lcid, const char *refName, UErrorCode *status) { const UChar *rules = NULL, *current = NULL; int32_t ruleLen = 0; uint32_t strength = 0; uint32_t chOffset = 0; uint32_t chLen = 0; uint32_t exOffset = 0; uint32_t exLen = 0; /* uint32_t rExpsLen = 0; */ uint32_t firstLen = 0, secondLen = 0; UBool varT = FALSE; UBool top_ = TRUE; uint8_t specs = 0; UBool startOfRules = TRUE; UColTokenParser src; UColOptionSet opts; UChar first[256]; UChar second[256]; UChar *rulesCopy = NULL; uint32_t UCAdiff = 0; uint32_t Windiff = 1; src.opts = &opts; rules = ucol_getRules(coll, &ruleLen); /*printOutRules(rules);*/ if(U_SUCCESS(*status) && ruleLen > 0) { rulesCopy = (UChar *)uprv_malloc((ruleLen+UCOL_TOK_EXTRA_RULE_SPACE_SIZE)*sizeof(UChar)); uprv_memcpy(rulesCopy, rules, ruleLen*sizeof(UChar)); src.source = src.current = rulesCopy; src.end = rulesCopy+ruleLen; src.extraCurrent = src.end; src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE; *first = *second = 0; while ((current = ucol_tok_parseNextToken(&src, &strength, &chOffset, &chLen, &exOffset, &exLen, &specs, startOfRules, status)) != NULL) { startOfRules = FALSE; varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0); top_ = (UBool)((specs & UCOL_TOK_TOP) != 0); u_strncpy(second,rulesCopy+chOffset, chLen); second[chLen] = 0; secondLen = chLen; if(exLen > 0) { u_strncat(first, rulesCopy+exOffset, exLen); first[firstLen+exLen] = 0; firstLen += exLen; } if(strength != UCOL_TOK_RESET) { if((*first<0x3400 || *first>=0xa000) && (*second<0x3400 || *second>=0xa000)) { UCAdiff += testSwitch(&ucaTest, (void *)UCA, 0, strength, first, second, refName); /*Windiff += testSwitch(&winTest, (void *)lcid, 0, strength, first, second, "Win32");*/ } } firstLen = chLen; u_strcpy(first, second); } if(UCAdiff != 0 && Windiff != 0) { log_verbose("\n"); } if(UCAdiff == 0) { log_verbose("No immediate difference with %s!\n", refName); } if(Windiff == 0) { log_verbose("No immediate difference with Win32!\n"); } uprv_free(rulesCopy); } } static void testCEs(UCollator *coll, UErrorCode *status) { const UChar *rules = NULL, *current = NULL; int32_t ruleLen = 0; uint32_t strength = 0; uint32_t maxStrength = UCOL_IDENTICAL; uint32_t baseCE, baseContCE, nextCE, nextContCE, currCE, currContCE; uint32_t lastCE; uint32_t lastContCE; int32_t result = 0; uint32_t chOffset = 0; uint32_t chLen = 0; uint32_t exOffset = 0; uint32_t exLen = 0; uint32_t oldOffset = 0; /* uint32_t rExpsLen = 0; */ /* uint32_t firstLen = 0; */ uint8_t specs = 0; UBool varT = FALSE; UBool top_ = TRUE; UBool startOfRules = TRUE; UColTokenParser src; UColOptionSet opts; UChar *rulesCopy = NULL; collIterate c; baseCE=baseContCE=nextCE=nextContCE=currCE=currContCE=lastCE=lastContCE = UCOL_NOT_FOUND; src.opts = &opts; rules = ucol_getRules(coll, &ruleLen); ucol_initInverseUCA(status); if(U_SUCCESS(*status) && ruleLen > 0) { rulesCopy = (UChar *)uprv_malloc((ruleLen+UCOL_TOK_EXTRA_RULE_SPACE_SIZE)*sizeof(UChar)); uprv_memcpy(rulesCopy, rules, ruleLen*sizeof(UChar)); src.source = src.current = rulesCopy; src.end = rulesCopy+ruleLen; src.extraCurrent = src.end; src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE; while ((current = ucol_tok_parseNextToken(&src, &strength, &chOffset, &chLen, &exOffset, &exLen, &specs, startOfRules, status)) != NULL) { startOfRules = FALSE; varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0); top_ = (UBool)((specs & UCOL_TOK_TOP) != 0); init_collIterate(coll, rulesCopy+chOffset, chLen, &c); currCE = ucol_getNextCE(coll, &c, status); if(currCE == 0 && UCOL_ISTHAIPREVOWEL(*(rulesCopy+chOffset))) { log_verbose("Thai prevowel detected. Will pick next CE\n"); currCE = ucol_getNextCE(coll, &c, status); } currContCE = ucol_getNextCE(coll, &c, status); if(!isContinuation(currContCE)) { currContCE = 0; } if(strength == UCOL_TOK_RESET) { if(top_ == TRUE) { nextCE = baseCE = currCE = UCOL_RESET_TOP_VALUE; nextContCE = baseContCE = currContCE = 0; } else { nextCE = baseCE = currCE; nextContCE = baseContCE = currContCE; } maxStrength = UCOL_IDENTICAL; } else { if(strength < maxStrength) { maxStrength = strength; if(baseCE == UCOL_RESET_TOP_VALUE) { log_verbose("Resetting to [top]\n"); nextCE = UCOL_NEXT_TOP_VALUE; nextContCE = 0; } else { result = ucol_inv_getNextCE(baseCE & 0xFFFFFF3F, baseContCE, &nextCE, &nextContCE, maxStrength); } if(result < 0) { if(isTailored(coll, *(rulesCopy+oldOffset), status)) { log_verbose("Reset is tailored codepoint %04X, don't know how to continue, taking next test\n", *(rulesCopy+oldOffset)); return; } else { log_err("couldn't find the CE\n"); return; } } } currCE &= 0xFFFFFF3F; currContCE &= 0xFFFFFFBF; if(maxStrength == UCOL_IDENTICAL) { if(baseCE != currCE || baseContCE != currContCE) { log_err("current CE (initial strength UCOL_EQUAL)\n"); } } else { if(strength == UCOL_IDENTICAL) { if(lastCE != currCE || lastContCE != currContCE) { log_err("current CE (initial strength UCOL_EQUAL)\n"); } } else { if(currCE > nextCE || (currCE == nextCE && currContCE >= nextContCE)) { log_err("current CE is not less than base CE\n"); } if(currCE < lastCE || (currCE == lastCE && currContCE <= lastContCE)) { log_err("sequence of generated CEs is broken\n"); } } } } oldOffset = chOffset; lastCE = currCE & 0xFFFFFF3F; lastContCE = currContCE & 0xFFFFFFBF; } uprv_free(rulesCopy); } } static const char* localesToTest[] = { "ar", "bg", "ca", "cs", "da", "el", "en_BE", "en_US_POSIX", "es", "et", "fi", "fr", "hi", "hr", "hu", "is", "iw", "ja", "ko", "lt", "lv", "mk", "mt", "nb", "nn", "nn_NO", "pl", "ro", "ru", "sh", "sk", "sl", "sq", "sr", "sv", "th", "tr", "uk", "vi", "zh", "zh_TW" }; static const char* rulesToTest[] = { /*"& Z < p, P",*/ /* Cui Mins rules */ "NFC, NORM_BUFFER_TEST_LEN, &status); nfdSize = unorm_normalize(&u, 1, UNORM_NFD, 0, t[noCases]->NFD, NORM_BUFFER_TEST_LEN, &status); if(nfcSize != nfdSize || (uprv_memcmp(t[noCases]->NFC, t[noCases]->NFD, nfcSize * sizeof(UChar)) != 0)) { t[noCases]->u = u; noCases++; t[noCases] = (tester *)uprv_malloc(sizeof(tester)); } } for(i = 0; iNFC, t[u]->NFD, UCOL_EQUAL); } ucol_close(coll); } } for(u = 0; u <= noCases; u++) { uprv_free(t[u]); } uprv_free(t); } static void TestUnmappedSpaces(void) { UChar u; UErrorCode status = U_ZERO_ERROR; UCollator *uca = ucol_open("", &status); for(u = 0; u < 0xFFFF; u++) { if(ucmp32_get(uca->mapping, u) == UCOL_NOT_FOUND) { log_verbose("%04X ", u); } } ucol_close(uca); } static void TestEmptyRule() { UErrorCode status = U_ZERO_ERROR; UChar rulez[] = { 0 }; UCollator *coll = ucol_openRules(rulez, 0, UCOL_NO_NORMALIZATION, UCOL_TERTIARY, &status); ucol_close(coll); } static void TestUCAZero() { UErrorCode status = U_ZERO_ERROR; char blah[] = "\\u9fff"; uint8_t res[256]; UChar b[256]; UCollator *coll = ucol_open("", &status); u_unescape(blah, b, 256); ucol_getSortKey(coll, b, 1, res, 256); ucol_close(coll); } /* Pinyin tonal order */ /* A < .. (\u0101) < .. (\u00e1) < .. (\u01ce) < .. (\u00e0) (w/macron)< (w/acute)< (w/caron)< (w/grave) E < .. (\u0113) < .. (\u00e9) < .. (\u011b) < .. (\u00e8) I < .. (\u012b) < .. (\u00ed) < .. (\u01d0) < .. (\u00ec) O < .. (\u014d) < .. (\u00f3) < .. (\u01d2) < .. (\u00f2) U < .. (\u016b) < .. (\u00fa) < .. (\u01d4) < .. (\u00f9) < .. (\u01d6) < .. (\u01d8) < .. (\u01da) < .. (\u01dc) < .. (\u00fc) However, in testing we got the following order: A < .. (\u00e1) < .. (\u00e0) < .. (\u01ce) < .. (\u0101) (w/acute)< (w/grave)< (w/caron)< (w/macron) E < .. (\u00e9) < .. (\u00e8) < .. (\u00ea) < .. (\u011b) < .. (\u0113) I < .. (\u00ed) < .. (\u00ec) < .. (\u01d0) < .. (\u012b) O < .. (\u00f3) < .. (\u00f2) < .. (\u01d2) < .. (\u014d) U < .. (\u00fa) < .. (\u00f9) < .. (\u01d4) < .. (\u00fc) < .. (\u01d8) < .. (\u01dc) < .. (\u01da) < .. (\u01d6) < .. (\u016b) */ static void TestBefore() { const static char *data[] = { "\\u0101", "\\u00e1", "\\u01ce", "\\u00e0", "A", "\\u0113", "\\u00e9", "\\u011b", "\\u00e8", "E", "\\u012b", "\\u00ed", "\\u01d0", "\\u00ec", "I", "\\u014d", "\\u00f3", "\\u01d2", "\\u00f2", "O", "\\u016b", "\\u00fa", "\\u01d4", "\\u00f9", "U", "\\u01d6", "\\u01d8", "\\u01da", "\\u01dc", "\\u00fc" }; genericRulesStarter( "&[before 1]a<\\u0101<\\u00e1<\\u01ce<\\u00e0" "&[before 1]e<\\u0113<\\u00e9<\\u011b<\\u00e8" "&[before 1]i<\\u012b<\\u00ed<\\u01d0<\\u00ec" "&[before 1]o<\\u014d<\\u00f3<\\u01d2<\\u00f2" "&[before 1]u<\\u016b<\\u00fa<\\u01d4<\\u00f9" "&u<\\u01d6<\\u01d8<\\u01da<\\u01dc<\\u00fc", data, sizeof(data)/sizeof(data[0])); } static void TestJ784() { const static char *data[] = { "A", "\\u0101", "\\u00e1", "\\u01ce", "\\u00e0", "E", "\\u0113", "\\u00e9", "\\u011b", "\\u00e8", "I", "\\u012b", "\\u00ed", "\\u01d0", "\\u00ec", "O", "\\u014d", "\\u00f3", "\\u01d2", "\\u00f2", "U", "\\u016b", "\\u00fa", "\\u01d4", "\\u00f9", "\\u00fc", "\\u01d6", "\\u01d8", "\\u01da", "\\u01dc" }; genericLocaleStarter("zh", data, sizeof(data)/sizeof(data[0])); } static void TestJ831() { const static char *data[] = { "I", "i", "Y", "y" }; genericLocaleStarter("lv", data, sizeof(data)/sizeof(data[0])); } static void TestJ815() { const static char *data[] = { "aa", "Aa", "ab", "Ab", "ad", "Ad", "ae", "Ae", "\\u00e6", "\\u00c6", "af", "Af", "b", "B" }; genericLocaleStarter("fr", data, sizeof(data)/sizeof(data[0])); genericRulesStarter("[backwards 2]&A<<\\u00e6/e<<<\\u00c6/E", data, sizeof(data)/sizeof(data[0])); } /* "& a < b < c < d& r < c", "& a < b < d& r < c", "& a < b < c < d& c < m", "& a < b < c < m < d", "& a < b < c < d& a < m", "& a < m < b < c < d", "& a <<< b << c < d& a < m", "& a <<< b << c < m < d", "& a < b < c < d& [before 1] c < m", "& a < b < m < c < d", "& a << b <<< c << d <<< e& [before 3] e <<< x", "& a << b <<< c << d <<< x <<< e", "& a << b <<< c << d <<< e& [before 2] e <<< x", "& a << b <<< c <<< x << d <<< e", "& a << b <<< c << d <<< e& [before 1] e <<< x", "& a <<< x << b <<< c << d <<< e", "& a << b <<< c << d <<< e <<< f < g& [before 1] e < x", "& a << b <<< c << d <<< e <<< f < x < g", */ static void TestRedundantRules() { int32_t i; const static char *rules[] = { "& a << b <<< c << d <<< e& [before 1] e <<< x", "& a < b < c < d& [before 1] c < m", "& a << b <<< c << d <<< e& [before 3] e <<< x", "& a << b <<< c << d <<< e& [before 2] e <<< x", "& a << b <<< c << d <<< e <<< f < g& [before 1] e < x", "& a <<< b << c < d& a < m", "&a