1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/******************************************************************** 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * COPYRIGHT: 327f654740f2a26ad62a5c155af9199af9e69b889claireho * Copyright (c) 1997-2010, International Business Machines Corporation and 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * others. All Rights Reserved. 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ********************************************************************/ 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/******************************************************************************** 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* File CFRTST.C 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Modification History: 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Name Description 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Madhu Katragadda Ported for C API 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*********************************************************************************/ 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * CollationFrenchTest is a third level test class. This tests the locale 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specific primary, secondary and tertiary rules. For example, the ignorable 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character '-' in string "black-bird". The en_US locale uses the default 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * collation rules as its sorting sequence. 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include <stdlib.h> 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_COLLATION 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/ucol.h" 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/uloc.h" 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "cintltst.h" 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "ccolltst.h" 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "callcoll.h" 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "cfrtst.h" 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/ustring.h" 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "string.h" 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querustatic UCollator *myCollation; 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst static UChar testSourceCases[][MAX_TOKEN_LEN] = 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0061/*'a'*/, 0x0062/*'b'*/, 0x0063/*'c'*/, 0x0000}, 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0043/*'C'*/, 0x004f/*'O'*/, 0x0054/*'T'*/, 0x0045/*'E'*/, 0x0000}, 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0063/*'c'*/, 0x006f/*'o'*/, 0x002d/*'-'*/, 0x006f/*'o'*/, 0x0070/*'p'*/, 0x0000}, 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0000}, 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0048/*'H'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x006f/*'o'*/, 0x0000}, 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01f1, 0x0000}, 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0xfb00, 0x0000}, 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01fa, 0x0000}, 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0101, 0x0000} 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst static UChar testTargetCases[][MAX_TOKEN_LEN] = 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0041/*'A'*/, 0x0042/*'B'*/, 0x0043/*'C'*/, 0x0000}, 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0063/*'c'*/, 0x00f4, 0x0074/*'t'*/, 0x0065/*'e'*/, 0x0000}, 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0043/*'C'*/, 0x004f/*'O'*/, 0x004f/*'O'*/, 0x0050/*'P'*/, 0x0000}, 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x00E9, 0x0000}, 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x00E9, 0x0000}, 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0000}, 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0068/*'h'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x004f/*'O'*/, 0x0000}, 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01ee, 0x0000}, 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x25ca, 0x0000}, 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00e0, 0x0000}, 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01df, 0x0000} 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst static UCollationResult results[] = 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS, 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS, 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS, /*UCOL_GREATER,*/ 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS, 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_GREATER, 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_GREATER, 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS, 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_GREATER, 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS, /*UCOL_GREATER,*/ 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_GREATER, 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS, 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCOL_LESS 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 0x0300 is grave, 0x0301 is acute*/ 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* the order of elements in this array must be different than the order in CollationEnglishTest*/ 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst static UChar testAcute[][MAX_TOKEN_LEN] = 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*00*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0000}, 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*01*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0000}, 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*02*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0000}, 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*03*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0000}, 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*04*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0000}, 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*05*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0301, 0x0000}, 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*06*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0000}, 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*07*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0000}, 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*08*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0000}, 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*09*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0000}, 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0a*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0b*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0c*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0d*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0e*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0f*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0300, 0x0000}, 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*10*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0000}, 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*11*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0000}, 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*12*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0000}, 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*13*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0000}, 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*14*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*15*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*16*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*17*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*18*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000} 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst static UChar testBugs[][MAX_TOKEN_LEN] = 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0061/*'a'*/, 0x000}, 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0041/*'A'*/, 0x000}, 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0065/*'e'*/, 0x000}, 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0045/*'E'*/, 0x000}, 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00e9, 0x000}, 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00e8, 0x000}, 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00ea, 0x000}, 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00eb, 0x000}, 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0065/*'e'*/, 0x0061/*'a'*/, 0x000}, 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0078/*'x'*/, 0x000} 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querustatic void TestGetSortKey(void); 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid addFrenchCollTest(TestNode** root) 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru addTest(root, &TestSecondary, "tscoll/cfrtst/TestSecondary"); 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru addTest(root, &TestTertiary, "tscoll/cfrtst/TestTertiary"); 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru addTest(root, &TestExtra, "tscoll/cfrtst/TestExtra"); 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru addTest(root, &TestGetSortKey, "tscoll/cfrtst/TestGetSortKey"); 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querustatic void TestTertiary( ) 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t i; 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode status = U_ZERO_ERROR; 14827f654740f2a26ad62a5c155af9199af9e69b889claireho myCollation = ucol_open("fr_CA", &status); 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(U_FAILURE(status) || !myCollation){ 15085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status)); 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_setAttribute(myCollation, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &status); 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(U_FAILURE(status)){ 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 15927f654740f2a26ad62a5c155af9199af9e69b889claireho log_verbose("Testing fr_CA Collation with Tertiary strength\n"); 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_setStrength(myCollation, UCOL_QUATERNARY); 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (i = 0; i < 12 ; i++) 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]); 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_close(myCollation); 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querustatic void TestSecondary() 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t i,j, testAcuteSize; 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCollationResult expected=UCOL_EQUAL; 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode status = U_ZERO_ERROR; 17327f654740f2a26ad62a5c155af9199af9e69b889claireho myCollation = ucol_open("fr_CA", &status); 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(U_FAILURE(status)){ 17585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status)); 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_setAttribute(myCollation, UCOL_STRENGTH, UCOL_SECONDARY, &status); 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(U_FAILURE(status)){ 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 18327f654740f2a26ad62a5c155af9199af9e69b889claireho log_verbose("Testing fr_CA Collation with Secondary strength\n"); 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /*test acute and grave ordering (compare to french collation)*/ 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru testAcuteSize = sizeof(testAcute) / sizeof(testAcute[0]); 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (i = 0; i < testAcuteSize; i++) 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (j = 0; j < testAcuteSize; j++) 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (i < j) expected = UCOL_LESS; 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (i == j) expected = UCOL_EQUAL; 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (i > j) expected = UCOL_GREATER; 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru doTest(myCollation, testAcute[i], testAcute[j], expected ); 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_close(myCollation); 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querustatic void TestExtra() 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t i, j; 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode status = U_ZERO_ERROR; 20327f654740f2a26ad62a5c155af9199af9e69b889claireho myCollation = ucol_open("fr_CA", &status); 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(U_FAILURE(status)){ 20585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status)); 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 20827f654740f2a26ad62a5c155af9199af9e69b889claireho log_verbose("Testing fr_CA Collation extra with secondary strength\n"); 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_setStrength(myCollation, UCOL_TERTIARY); 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (i = 0; i < 9 ; i++) 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (j = i + 1; j < 10; j += 1) 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru doTest(myCollation, testBugs[i], testBugs[j], UCOL_LESS); 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_close(myCollation); 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querustatic void TestGetSortKey() { 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /* This is meant to test a buffer reallocation crash while using 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru French secondary sorting with a large buffer. 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru The fact that Japanese characters are used is irrelevant. */ 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const UChar pucUTF16[] = { 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3049,0x30b9,0x3088,0xfffd,0xfffd,0x308f,0xfffd,0x3042, 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0xfffd,0x305e,0xfffd,0x30b6,0x30bb,0x305b,0x30b1, 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3050,0x30af,0x304e,0x30bd,0xfffd,0x30c6,0xfffd,0xfffd, 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30e1,0xfffd,0xfffd,0x30d9,0xfffd,0x3092,0x3075,0x304a, 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3074,0x3070,0x30f5,0x30c4,0x306e,0x30df,0x3053,0xfffd, 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30a6,0x30b6,0x30e0,0xfffd,0x30bc,0x30ef,0x3087,0x30cc, 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x305f,0x30de,0xfffd,0x3090,0x3063,0x30dc,0x30b6,0x30b9, 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30d2,0x3072,0x3061,0xfffd,0xfffd,0xfffd,0x307b,0x3092, 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30a5,0x30a9,0x30b1,0x30e7,0xfffd,0xfffd,0xfffd,0xfffd, 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x305e,0xfffd,0x30c7,0x30ae,0x305b,0x308b,0x30c0, 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30f5,0xfffd,0xfffd,0xfffd,0x307d,0x304e,0xfffd,0xfffd, 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30c0,0x30c8,0x306f,0x307a,0x30dd,0x30e4,0x3084,0xfffd, 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x308c,0x30f1,0xfffd,0x30c6,0xfffd,0x307a,0xfffd,0x3052, 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3056,0x305d,0x30b7,0xfffd,0x305b,0x30b0,0x30b9,0xfffd, 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30b2,0x306d,0x3044,0xfffd,0x3073,0xfffd,0x30be,0x30cf, 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3080,0xfffd,0x30a8,0x30f5,0x30a5,0x30c7,0x307c,0xfffd, 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30d1,0x305f,0x30b2,0xfffd,0x3053,0x30ca,0xfffd,0x30dd, 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3058,0x30c0,0x305d,0x30e1,0xfffd,0x30bb,0x305f,0x30d1, 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30f2,0x3058,0x3086,0x30ce,0x30db,0x30cb,0x30e9,0xfffd, 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x308c,0xfffd,0xfffd,0x30af,0x30c4,0x3076,0x304c,0x30f5, 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30e8,0x308c,0xfffd,0x30e2,0x3073,0x30a3,0x304e,0x30ea, 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x304f,0xfffd,0x306c,0x3044,0xfffd,0xfffd,0x30c9, 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30f5,0xfffd,0xfffd,0xfffd,0x30eb,0x30a8,0xfffd, 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x306d,0x307d,0x30d8,0x3069,0xfffd,0xfffd,0x3086,0x30a9, 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x3076,0x30e9,0x30cc,0x3074,0x30e0,0xfffd,0xfffd, 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30f0,0x3086,0x30ac,0x3076,0x3068,0x30c7,0xfffd, 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30b7,0x30d2,0x3048,0x308e,0x30e8,0x30d9,0x30ce,0x30d0, 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x308b,0x30ee,0x30e6,0x3079,0x30f3,0x30af,0xfffd,0x3079, 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0xfffd,0x30ca,0x30bf,0xfffd,0x30b5,0xfffd,0xfffd, 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3093,0xfffd,0x30ba,0xfffd,0x3076,0x3047,0x304a,0xfffd, 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x3086,0xfffd,0x3081,0xfffd,0x30f6,0x3066,0xfffd, 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30b6,0x30ef,0x30e2,0x30bf,0xfffd,0x3053,0x304a, 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0xfffd,0x304a,0x30e8,0xfffd,0x30e2,0xfffd,0xfffd, 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x305c,0x3081,0x30c6,0xfffd,0x3091,0x3046,0x306a,0x3059, 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0xfffd,0x30dd,0x30d1,0x308a,0x30ee,0xfffd,0xfffd, 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x308a,0x3042,0x30da,0xfffd,0x3064,0x30ef,0x305c,0x306b, 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30ca,0x3085,0x3067,0x30ea,0x30c2,0x30c8,0xfffd, 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30f5,0xfffd,0xfffd,0xfffd,0x30ca,0xfffd,0x3050,0x30f1, 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3050,0x3053,0x3072,0xfffd,0xfffd,0xfffd,0x3074,0xfffd, 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x304b,0x30dd,0x306d,0xfffd,0x3049,0x30a1,0x30cc,0x30de, 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30ae,0x307b,0x308a,0xfffd,0x3065,0xfffd,0xfffd,0x30c0, 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x3048,0x30dc,0x304f,0x3085,0x3059,0x304b,0x30d3, 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30eb,0x30a4,0x3073,0xfffd,0x30ba,0x308f,0x30a7,0x30c3, 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3074,0x30cf,0x306c,0x3053,0x30c0,0xfffd,0x3066,0xfffd, 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x308f,0xfffd,0x30b5,0xfffd,0x3092,0x30c4,0xfffd,0x30d6, 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3056,0x30ad,0x30d2,0x30ba,0xfffd,0x30e6,0x304c,0x3088, 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30b6,0x3048,0x3077,0x30d1,0xfffd,0x3050,0xfffd,0x3042, 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0xfffd,0x308f,0xfffd,0x30c1,0xfffd,0x3074,0x3061, 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3056,0x30e5,0xfffd,0xfffd,0x3057,0xfffd,0xfffd,0xfffd, 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30bd,0x30b3,0x30ee,0xfffd,0x30f2,0x3084,0x3050, 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30e7,0xfffd,0xfffd,0x3060,0x3049,0x30f2,0x30ad, 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30bf,0x30f1,0x30a2,0xfffd,0x30af,0xfffd,0x3060,0x30a1, 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30e9,0x30c3,0xfffd,0x3072,0x3093,0x3070,0xfffd,0x308f, 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3060,0xfffd,0x3067,0x306f,0x3082,0x308b,0x3051,0xfffd, 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3058,0xfffd,0xfffd,0x30a8,0x3051,0x3054,0x30ad,0x30f0, 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3053,0xfffd,0x30e1,0x30d7,0x308d,0x307f,0x30be,0x30b0, 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30db,0xfffd,0x30d1,0xfffd,0x3054,0x30a5,0xfffd, 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x306a,0xfffd,0x305c,0xfffd,0x3052,0x3088,0xfffd,0x306e, 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30a9,0x30a1,0x30b4,0x3083,0x30bd,0xfffd,0xfffd, 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x306a,0x3070,0x30cd,0xfffd,0x3072,0x30ed,0x30c6,0x30be, 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30c4,0x305e,0x30b3,0x30e1,0x308a,0xfffd,0x305b,0xfffd, 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3042,0x3088,0xfffd,0x304c,0xfffd,0x3089,0x3071,0xfffd, 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x30c6,0x3062,0x3079,0xfffd,0x304b,0x304a,0xfffd, 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30ad,0x3045,0x3045,0x3087,0xfffd,0x306a,0x308b,0x0000, 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30bd,0x3065,0x30b8,0x3086,0x30d3,0x3076,0xfffd,0xfffd, 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x308f,0x3053,0x307c,0x3053,0x3084,0x30ae,0x30c4,0x3045, 291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30a8,0x30d0,0x30e1,0x308c,0x30e6,0x30b7,0xfffd,0xfffd, 292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x3046,0x305f,0xfffd,0x3086,0x30ab,0xfffd,0xfffd, 293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30c8,0xfffd,0x30a1,0x3052,0x3059,0xfffd,0x30a4,0xfffd, 294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0x308c,0x3085,0x30ab,0x30b5,0x3091,0x30bf,0x30e3, 295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0xfffd,0x3087,0xfffd,0x30f6,0x3051,0x30bd,0x3092, 296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3063,0xfffd,0x30a9,0x3063,0x306e,0xfffd,0xfffd,0xfffd, 297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x306c,0xfffd,0x307e,0x30ad,0x3077,0x30c2,0x30e9,0x30d5, 298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0xfffd,0xfffd,0x30c6,0x305c,0xfffd,0xfffd,0x3089,0xfffd, 299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3048,0x30cb,0x308c,0xfffd,0xfffd,0x3044,0xfffd,0x3080, 300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x3063,0x3079,0xfffd,0x308a,0x30cb,0x3042,0x3057,0xfffd, 301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x307c,0x30c1,0x30a8,0x30cf,0xfffd,0x3083,0xfffd,0xfffd, 302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x306c,0xfffd,0x305e,0x3092,0xfffd,0x30dc,0x30b0,0x3081, 303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 0x30e3,0x30f0,0x304e,0x30cc,0x308e,0x30c4,0x30ad 304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru }; 305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode status = U_ZERO_ERROR; 307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UCollator *pCollator; 308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t lenActualSortKey; 309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru uint8_t pucSortKey[4096]; 310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t LENSORTKEY = (int32_t)sizeof(pucSortKey); 311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_prepareShortStringOpen("LFR_AN_CX_EX_FO_HX_NX_S3", 0, NULL, &status); 313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru pCollator = ucol_openFromShortString("LFR_AN_CX_EX_FO_HX_NX_S3", 0, NULL, &status); 315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (U_FAILURE(status)) { 31785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho log_data_err("error opening collator -> %s. (Are you missing data?)\n", u_errorName(status)); 318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru lenActualSortKey = ucol_getSortKey(pCollator, 322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru (const UChar *)pucUTF16, 323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru sizeof(pucUTF16) / sizeof(pucUTF16[0]), 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru pucSortKey, 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LENSORTKEY); 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (lenActualSortKey > LENSORTKEY) { 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru log_err("sort key too big for original buffer. Got: %d Expected: %d\n", lenActualSortKey, LENSORTKEY); 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /* If the test didn't crash, then the test succeeded. */ 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ucol_close(pCollator); 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_COLLATION */ 336