]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/trcoll.cpp
1 /********************************************************************
3 * Copyright (c) 1997-2004, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #include "unicode/unistr.h"
9 #if !UCONFIG_NO_COLLATION
11 #include "unicode/tstdtmod.h"
12 #include "unicode/coll.h"
13 #include "unicode/tblcoll.h"
14 #include "unicode/sortkey.h"
18 CollationTurkishTest::CollationTurkishTest()
21 UErrorCode status
= U_ZERO_ERROR
;
22 myCollation
= Collator::createInstance(Locale("tr", "", ""),status
);
25 CollationTurkishTest::~CollationTurkishTest()
30 const UChar
CollationTurkishTest::testSourceCases
[][CollationTurkishTest::MAX_TOKEN_LEN
] = {
32 {0x76, 0x00E4, 0x74, 0},
33 {0x6f, 0x6c, 0x64, 0},
34 {0x00FC, 0x6f, 0x69, 0x64, 0},
35 {0x68, 0x011E, 0x61, 0x6c, 0x74, 0},
36 {0x73, 0x74, 0x72, 0x65, 0x73, 0x015E, 0},
37 {0x76, 0x6f, 0x0131, 0x64, 0},
38 {0x69, 0x64, 0x65, 0x61, 0},
39 {0x00FC, 0x6f, 0x69, 0x64, 0},
40 {0x76, 0x6f, 0x0131, 0x64, 0},
41 {0x69, 0x64, 0x65, 0x61, 0}
44 const UChar
CollationTurkishTest::testTargetCases
[][CollationTurkishTest::MAX_TOKEN_LEN
] = {
46 {0x76, 0x62, 0x74, 0},
47 {0x00D6, 0x61, 0x79, 0},
48 {0x76, 0x6f, 0x69, 0x64, 0},
49 {0x68, 0x61, 0x6c, 0x74, 0},
50 {0x015E, 0x74, 0x72, 0x65, 0x015E, 0x73, 0},
51 {0x76, 0x6f, 0x69, 0x64, 0},
52 {0x49, 0x64, 0x65, 0x61, 0},
53 {0x76, 0x6f, 0x69, 0x64, 0},
54 {0x76, 0x6f, 0x69, 0x64, 0},
55 {0x49, 0x64, 0x65, 0x61, 0}
58 const Collator::EComparisonResult
CollationTurkishTest::results
[] = {
73 void CollationTurkishTest::TestTertiary(/* char* par */)
76 myCollation
->setStrength(Collator::TERTIARY
);
77 for (i
= 0; i
< 8 ; i
++) {
78 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
81 void CollationTurkishTest::TestPrimary(/* char* par */)
84 myCollation
->setStrength(Collator::PRIMARY
);
85 for (i
= 8; i
< 11; i
++) {
86 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
90 void CollationTurkishTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par*/ )
92 if (exec
) logln("TestSuite CollationTurkishTest: ");
94 if((!myCollation
) && exec
) {
95 errln(__FILE__
" cannot test - failed to create collator.");
100 case 0: name
= "TestPrimary"; if (exec
) TestPrimary(/* par */); break;
101 case 1: name
= "TestTertiary"; if (exec
) TestTertiary(/* par */); break;
102 default: name
= ""; break;
106 #endif /* #if !UCONFIG_NO_COLLATION */