2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2001-03-21 18:10:38 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 1997-2009, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
2001-03-21 18:10:38 +00:00
|
|
|
********************************************************************/
|
2002-09-21 00:43:14 +00:00
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_COLLATION
|
|
|
|
|
2001-03-21 18:10:38 +00:00
|
|
|
#ifndef _COLL
|
|
|
|
#include "unicode/coll.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TBLCOLL
|
|
|
|
#include "unicode/tblcoll.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _UNISTR
|
|
|
|
#include "unicode/unistr.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SORTKEY
|
|
|
|
#include "unicode/sortkey.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "lcukocol.h"
|
|
|
|
|
|
|
|
#include "sfwdchit.h"
|
|
|
|
|
|
|
|
LotusCollationKoreanTest::LotusCollationKoreanTest()
|
|
|
|
: myCollation(0)
|
|
|
|
{
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
myCollation = Collator::createInstance("ko_kr", status);
|
2003-06-06 04:54:34 +00:00
|
|
|
if(U_SUCCESS(status)) {
|
|
|
|
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
|
|
|
|
} else {
|
2009-06-12 19:34:21 +00:00
|
|
|
errcheckln(status, "Couldn't instantiate the collator with %s", u_errorName(status));
|
2003-06-06 04:54:34 +00:00
|
|
|
delete myCollation;
|
|
|
|
myCollation = 0;
|
|
|
|
}
|
|
|
|
|
2001-03-21 18:10:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LotusCollationKoreanTest::~LotusCollationKoreanTest()
|
|
|
|
{
|
|
|
|
delete myCollation;
|
|
|
|
}
|
|
|
|
|
|
|
|
const UChar LotusCollationKoreanTest::testSourceCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = {
|
2002-04-02 02:55:31 +00:00
|
|
|
{0xac00, 0}
|
2001-03-21 18:10:38 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const UChar LotusCollationKoreanTest::testTargetCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = {
|
2002-04-02 02:55:31 +00:00
|
|
|
{0xac01, 0}
|
2001-03-21 18:10:38 +00:00
|
|
|
};
|
|
|
|
|
2003-03-19 13:21:51 +00:00
|
|
|
const Collator::EComparisonResult LotusCollationKoreanTest::results[] = {
|
|
|
|
Collator::LESS
|
2001-03-21 18:10:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void LotusCollationKoreanTest::TestTertiary(/* char* par */)
|
|
|
|
{
|
|
|
|
int32_t i = 0;
|
2002-04-02 02:55:31 +00:00
|
|
|
myCollation->setStrength(Collator::TERTIARY);
|
|
|
|
|
2001-03-21 18:10:38 +00:00
|
|
|
for (i = 0; i < 1; i++) {
|
2003-02-14 07:14:02 +00:00
|
|
|
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
|
2001-03-21 18:10:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LotusCollationKoreanTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
|
|
|
|
{
|
|
|
|
if (exec) logln("TestSuite LotusCollationKoreanTest: ");
|
2003-06-06 04:54:34 +00:00
|
|
|
if(myCollation) {
|
|
|
|
switch (index) {
|
|
|
|
case 0: name = "TestTertiary"; if (exec) TestTertiary(/* par */); break;
|
|
|
|
default: name = ""; break;
|
|
|
|
}
|
|
|
|
} else {
|
2009-06-12 19:34:21 +00:00
|
|
|
dataerrln("Class collator not instantiated");
|
2003-06-06 04:54:34 +00:00
|
|
|
name = "";
|
2001-03-21 18:10:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_COLLATION */
|