]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/lcukocol.cpp
ICU-64243.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / lcukocol.cpp
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
b75a7d8f
A
3/********************************************************************
4 * COPYRIGHT:
729e4ab9 5 * Copyright (c) 1997-2009, International Business Machines Corporation and
b75a7d8f
A
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
33LotusCollationKoreanTest::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 {
729e4ab9 41 errcheckln(status, "Couldn't instantiate the collator with %s", u_errorName(status));
b75a7d8f
A
42 delete myCollation;
43 myCollation = 0;
44 }
45
46}
47
48LotusCollationKoreanTest::~LotusCollationKoreanTest()
49{
50 delete myCollation;
51}
52
53const UChar LotusCollationKoreanTest::testSourceCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = {
54 {0xac00, 0}
55
56};
57
58const UChar LotusCollationKoreanTest::testTargetCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = {
59 {0xac01, 0}
60};
61
62const Collator::EComparisonResult LotusCollationKoreanTest::results[] = {
63 Collator::LESS
64};
65
66void 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
76void 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 {
729e4ab9 85 dataerrln("Class collator not instantiated");
b75a7d8f
A
86 name = "";
87 }
88}
89
90#endif /* #if !UCONFIG_NO_COLLATION */