1 // Copyright (C) 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /******************************************************************** 4 * COPYRIGHT: 5 * Copyright (c) 1997-2009, International Business Machines Corporation and 6 * others. All Rights Reserved. 7 ********************************************************************/ 8 9 #include "unicode/utypes.h" 10 11 #if !UCONFIG_NO_COLLATION 12 13 #ifndef _COLL 14 #include "unicode/coll.h" 15 #endif 16 17 #ifndef _TBLCOLL 18 #include "unicode/tblcoll.h" 19 #endif 20 21 #ifndef _UNISTR 22 #include "unicode/unistr.h" 23 #endif 24 25 #ifndef _SORTKEY 26 #include "unicode/sortkey.h" 27 #endif 28 29 #include "lcukocol.h" 30 31 #include "sfwdchit.h" 32 33 LotusCollationKoreanTest::LotusCollationKoreanTest() 34 : myCollation(0) 35 { 36 UErrorCode status = U_ZERO_ERROR; 37 myCollation = Collator::createInstance("ko_kr", status); 38 if(U_SUCCESS(status)) { 39 myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 40 } else { 41 errcheckln(status, "Couldn't instantiate the collator with %s", u_errorName(status)); 42 delete myCollation; 43 myCollation = 0; 44 } 45 46 } 47 48 LotusCollationKoreanTest::~LotusCollationKoreanTest() 49 { 50 delete myCollation; 51 } 52 53 const UChar LotusCollationKoreanTest::testSourceCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = { 54 {0xac00, 0} 55 56 }; 57 58 const UChar LotusCollationKoreanTest::testTargetCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = { 59 {0xac01, 0} 60 }; 61 62 const Collator::EComparisonResult LotusCollationKoreanTest::results[] = { 63 Collator::LESS 64 }; 65 66 void LotusCollationKoreanTest::TestTertiary(/* char* par */) 67 { 68 int32_t i = 0; 69 myCollation->setStrength(Collator::TERTIARY); 70 71 for (i = 0; i < 1; i++) { 72 doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]); 73 } 74 } 75 76 void LotusCollationKoreanTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) 77 { 78 if (exec) logln("TestSuite LotusCollationKoreanTest: "); 79 if(myCollation) { 80 switch (index) { 81 case 0: name = "TestTertiary"; if (exec) TestTertiary(/* par */); break; 82 default: name = ""; break; 83 } 84 } else { 85 dataerrln("Class collator not instantiated"); 86 name = ""; 87 } 88 } 89 90 #endif /* #if !UCONFIG_NO_COLLATION */ 91