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* Modification history 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Date Name Description 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 02/14/2001 synwee Added attributes in TestTertiary and 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* TestSecondary 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru***********************************************************************/ 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_COLLATION 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/coll.h" 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/tblcoll.h" 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/unistr.h" 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/sortkey.h" 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "frcoll.h" 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "sfwdchit.h" 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruCollationFrenchTest::CollationFrenchTest() 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru: myCollation(0) 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode status = U_ZERO_ERROR; 3027f654740f2a26ad62a5c155af9199af9e69b889claireho myCollation = Collator::createInstance(Locale::getCanadaFrench(), status); 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(!myCollation || U_FAILURE(status)) { 3285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho errcheckln(status, __FILE__ "failed to create! err " + UnicodeString(u_errorName(status))); 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /* if it wasn't already: */ 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru delete myCollation; 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru myCollation = NULL; 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruCollationFrenchTest::~CollationFrenchTest() 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru delete myCollation; 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst UChar CollationFrenchTest::testSourceCases[][CollationFrenchTest::MAX_TOKEN_LEN] = 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0061/*'a'*/, 0x0062/*'b'*/, 0x0063/*'c'*/, 0x0000}, 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0043/*'C'*/, 0x004f/*'O'*/, 0x0054/*'T'*/, 0x0045/*'E'*/, 0x0000}, 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0063/*'c'*/, 0x006f/*'o'*/, 0x002d/*'-'*/, 0x006f/*'o'*/, 0x0070/*'p'*/, 0x0000}, 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0000}, 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0048/*'H'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x006f/*'o'*/, 0x0000}, 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01f1, 0x0000}, 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0xfb00, 0x0000}, 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01fa, 0x0000}, 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0101, 0x0000} 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst UChar CollationFrenchTest::testTargetCases[][CollationFrenchTest::MAX_TOKEN_LEN] = 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0041/*'A'*/, 0x0042/*'B'*/, 0x0043/*'C'*/, 0x0000}, 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0063/*'c'*/, 0x00f4, 0x0074/*'t'*/, 0x0065/*'e'*/, 0x0000}, 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0043/*'C'*/, 0x004f/*'O'*/, 0x004f/*'O'*/, 0x0050/*'P'*/, 0x0000}, 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x00E9, 0x0000}, 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00E9, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x00E9, 0x0000}, 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0000}, 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0070/*'p'*/, 0x00EA, 0x0063/*'c'*/, 0x0068/*'h'*/, 0x0065/*'e'*/, 0x0072/*'r'*/, 0x0000}, 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0068/*'h'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x004f/*'O'*/, 0x0000}, 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01ee, 0x0000}, 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x25ca, 0x0000}, 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00e0, 0x0000}, 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x01df, 0x0000} 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst Collator::EComparisonResult CollationFrenchTest::results[] = 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS, 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS, 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS, /*Collator::GREATER,*/ 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS, 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::GREATER, 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::GREATER, 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS, 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::GREATER, 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS, /*Collator::GREATER,*/ 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::GREATER, 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS, 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::LESS 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// 0x0300 is grave, 0x0301 is acute 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// the order of elements in this array must be different than the order in CollationEnglishTest 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst UChar CollationFrenchTest::testAcute[][CollationFrenchTest::MAX_TOKEN_LEN] = 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*00*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0000}, 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*01*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0000}, 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*02*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0000}, 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*03*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0000}, 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*04*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0000}, 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*05*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0301, 0x0000}, 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*06*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0000}, 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*07*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0000}, 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*08*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0000}, 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*09*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0000}, 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0a*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0b*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0c*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0d*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0e*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0301, 0x0000}, 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*0f*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0300, 0x0000}, 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*10*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0000}, 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*11*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0300, 0x0000}, 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*12*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0000}, 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*13*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0300, 0x0000}, 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*14*/ {0x0065/*'e'*/, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*15*/ {0x0065/*'e'*/, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*16*/ {0x0065/*'e'*/, 0x0300, 0x0301, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*17*/ {0x0065/*'e'*/, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000}, 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*18*/ {0x0065/*'e'*/, 0x0301, 0x0300, 0x0065/*'e'*/, 0x0301, 0x0300, 0x0000} 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruconst UChar CollationFrenchTest::testBugs[][CollationFrenchTest::MAX_TOKEN_LEN] = 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0061/*'a'*/, 0x000}, 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0041/*'A'*/, 0x000}, 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0065/*'e'*/, 0x000}, 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0045/*'E'*/, 0x000}, 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00e9, 0x000}, 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00e8, 0x000}, 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00ea, 0x000}, 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x00eb, 0x000}, 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0065/*'e'*/, 0x0061/*'a'*/, 0x000}, 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru {0x0078/*'x'*/, 0x000} 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid CollationFrenchTest::TestTertiary(/* char* par */) 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t i = 0; 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode status = U_ZERO_ERROR; 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru myCollation->setStrength(Collator::TERTIARY); 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru myCollation->setAttribute(UCOL_FRENCH_COLLATION, UCOL_ON, status); 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru myCollation->setAttribute(UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, status); 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (U_FAILURE(status)) { 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru errln("Error setting attribute in French collator"); 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru else 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (i = 0; i < 12 ; i++) 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]); 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid CollationFrenchTest::TestSecondary(/* char* par */) 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //test acute and grave ordering 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t i = 0; 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t j; 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator::EComparisonResult expected; 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode status = U_ZERO_ERROR; 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //myCollation->setAttribute(UCOL_FRENCH_COLLATION, UCOL_ON, status); 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru myCollation->setStrength(Collator::SECONDARY); 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (U_FAILURE(status)) 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru errln("Error setting attribute in French collator"); 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru else 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const int32_t testAcuteSize = (int32_t)(sizeof(testAcute) / sizeof(testAcute[0])); 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (i = 0; i < testAcuteSize; i++) 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (j = 0; j < testAcuteSize; j++) 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (i < j) 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru expected = Collator::LESS; 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru else if (i == j) 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru expected = Collator::EQUAL; 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru else // (i > j) 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru expected = Collator::GREATER; 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru doTest(myCollation, testAcute[i], testAcute[j], expected ); 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid CollationFrenchTest::TestExtra(/* char* par */) 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t i, j; 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru myCollation->setStrength(Collator::TERTIARY); 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (i = 0; i < 9 ; i++) 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for (j = i + 1; j < 10; j += 1) 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru { 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS); 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid CollationFrenchTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (exec) logln("TestSuite CollationFrenchTest: "); 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if((!myCollation) && exec) { 20485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho dataerrln(__FILE__ " cannot test - failed to create collator."); 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru name = "some test"; 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru switch (index) { 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru case 0: name = "TestSecondary"; if (exec) TestSecondary(/* par */); break; 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru case 1: name = "TestTertiary"; if (exec) TestTertiary(/* par */); break; 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru case 2: name = "TestExtra"; if (exec) TestExtra(/* par */); break; 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru default: name = ""; break; 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_COLLATION */ 218