]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/ficoll.cpp
1 /********************************************************************
2 * Copyright (c) 1997-2009,2014, International Business Machines
3 * Corporation and others. All Rights Reserved.
4 ********************************************************************/
6 #include "unicode/utypes.h"
8 #if !UCONFIG_NO_COLLATION
11 #include "unicode/coll.h"
15 #include "unicode/tblcoll.h"
19 #include "unicode/unistr.h"
23 #include "unicode/sortkey.h"
32 CollationFinnishTest::CollationFinnishTest()
35 UErrorCode status
= U_ZERO_ERROR
;
36 myCollation
= Collator::createInstance(Locale("fi", "FI", "", "collation=standard"),status
);
39 CollationFinnishTest::~CollationFinnishTest()
44 const UChar
CollationFinnishTest::testSourceCases
[][CollationFinnishTest::MAX_TOKEN_LEN
] = {
45 {0x77, 0x61, 0x74, 0}, // "wat"
46 {0x76, 0x61, 0x74, 0}, // "vat"
47 {0x61, 0x00FC, 0x62, 0x65, 0x63, 0x6b, 0},
48 {0x4c, 0x00E5, 0x76, 0x69, 0},
49 {0x77, 0x61, 0x74, 0} // "wat"
52 const UChar
CollationFinnishTest::testTargetCases
[][CollationFinnishTest::MAX_TOKEN_LEN
] = {
53 {0x76, 0x61, 0x74, 0}, // "vat"
54 {0x77, 0x61, 0x79, 0},
55 {0x61, 0x78, 0x62, 0x65, 0x63, 0x6b, 0},
56 {0x4c, 0x00E4, 0x77, 0x65, 0},
57 {0x76, 0x61, 0x74, 0} // "vat"
60 const Collator::EComparisonResult
CollationFinnishTest::results
[] = {
66 Collator::GREATER
, // v < w per cldrbug 6615
69 void CollationFinnishTest::TestTertiary(/* char* par */)
72 myCollation
->setStrength(Collator::TERTIARY
);
73 for (i
= 0; i
< 4 ; i
++) {
74 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
77 void CollationFinnishTest::TestPrimary(/* char* par */)
80 myCollation
->setStrength(Collator::PRIMARY
);
81 for (i
= 4; i
< 5; i
++) {
82 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
86 void CollationFinnishTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par*/ )
88 if (exec
) logln("TestSuite CollationFinnishTest: ");
90 if((!myCollation
) && exec
) {
91 dataerrln(__FILE__
" cannot test - failed to create collator.");
96 case 0: name
= "TestPrimary"; if (exec
) TestPrimary(/* par */); break;
97 case 1: name
= "TestTertiary"; if (exec
) TestTertiary(/* par */); break;
98 default: name
= ""; break;
102 #endif /* #if !UCONFIG_NO_COLLATION */