]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/trcoll.cpp
1 /********************************************************************
3 * Copyright (c) 1997-2003, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #include "unicode/utypes.h"
9 #if !UCONFIG_NO_COLLATION
12 #include "unicode/coll.h"
16 #include "unicode/tblcoll.h"
20 #include "unicode/unistr.h"
24 #include "unicode/sortkey.h"
33 CollationTurkishTest::CollationTurkishTest()
36 UErrorCode status
= U_ZERO_ERROR
;
37 myCollation
= Collator::createInstance(Locale("tr", "", ""),status
);
40 CollationTurkishTest::~CollationTurkishTest()
45 const UChar
CollationTurkishTest::testSourceCases
[][CollationTurkishTest::MAX_TOKEN_LEN
] = {
47 {0x76, 0x00E4, 0x74, 0},
48 {0x6f, 0x6c, 0x64, 0},
49 {0x00FC, 0x6f, 0x69, 0x64, 0},
50 {0x68, 0x011E, 0x61, 0x6c, 0x74, 0},
51 {0x73, 0x74, 0x72, 0x65, 0x73, 0x015E, 0},
52 {0x76, 0x6f, 0x0131, 0x64, 0},
53 {0x69, 0x64, 0x65, 0x61, 0},
54 {0x00FC, 0x6f, 0x69, 0x64, 0},
55 {0x76, 0x6f, 0x0131, 0x64, 0},
56 {0x69, 0x64, 0x65, 0x61, 0}
59 const UChar
CollationTurkishTest::testTargetCases
[][CollationTurkishTest::MAX_TOKEN_LEN
] = {
61 {0x76, 0x62, 0x74, 0},
62 {0x00D6, 0x61, 0x79, 0},
63 {0x76, 0x6f, 0x69, 0x64, 0},
64 {0x68, 0x61, 0x6c, 0x74, 0},
65 {0x015E, 0x74, 0x72, 0x65, 0x015E, 0x73, 0},
66 {0x76, 0x6f, 0x69, 0x64, 0},
67 {0x49, 0x64, 0x65, 0x61, 0},
68 {0x76, 0x6f, 0x69, 0x64, 0},
69 {0x76, 0x6f, 0x69, 0x64, 0},
70 {0x49, 0x64, 0x65, 0x61, 0}
73 const Collator::EComparisonResult
CollationTurkishTest::results
[] = {
88 void CollationTurkishTest::TestTertiary(/* char* par */)
91 myCollation
->setStrength(Collator::TERTIARY
);
92 for (i
= 0; i
< 8 ; i
++) {
93 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
96 void CollationTurkishTest::TestPrimary(/* char* par */)
99 myCollation
->setStrength(Collator::PRIMARY
);
100 for (i
= 8; i
< 11; i
++) {
101 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
105 void CollationTurkishTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par*/ )
107 if (exec
) logln("TestSuite CollationTurkishTest: ");
109 if((!myCollation
) && exec
) {
110 errln(__FILE__
" cannot test - failed to create collator.");
115 case 0: name
= "TestPrimary"; if (exec
) TestPrimary(/* par */); break;
116 case 1: name
= "TestTertiary"; if (exec
) TestTertiary(/* par */); break;
117 default: name
= ""; break;
121 #endif /* #if !UCONFIG_NO_COLLATION */