]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/ficoll.cpp
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
4 * Copyright (c) 1997-2009,2014, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 ********************************************************************/
8 #include "unicode/utypes.h"
10 #if !UCONFIG_NO_COLLATION
13 #include "unicode/coll.h"
17 #include "unicode/tblcoll.h"
21 #include "unicode/unistr.h"
25 #include "unicode/sortkey.h"
34 CollationFinnishTest::CollationFinnishTest()
37 UErrorCode status
= U_ZERO_ERROR
;
38 myCollation
= Collator::createInstance(Locale("fi", "FI", "", "collation=standard"),status
);
41 CollationFinnishTest::~CollationFinnishTest()
46 const UChar
CollationFinnishTest::testSourceCases
[][CollationFinnishTest::MAX_TOKEN_LEN
] = {
47 {0x77, 0x61, 0x74, 0}, // "wat"
48 {0x76, 0x61, 0x74, 0}, // "vat"
49 {0x61, 0x00FC, 0x62, 0x65, 0x63, 0x6b, 0},
50 {0x4c, 0x00E5, 0x76, 0x69, 0},
51 {0x77, 0x61, 0x74, 0} // "wat"
54 const UChar
CollationFinnishTest::testTargetCases
[][CollationFinnishTest::MAX_TOKEN_LEN
] = {
55 {0x76, 0x61, 0x74, 0}, // "vat"
56 {0x77, 0x61, 0x79, 0},
57 {0x61, 0x78, 0x62, 0x65, 0x63, 0x6b, 0},
58 {0x4c, 0x00E4, 0x77, 0x65, 0},
59 {0x76, 0x61, 0x74, 0} // "vat"
62 const Collator::EComparisonResult
CollationFinnishTest::results
[] = {
68 Collator::GREATER
, // v < w per cldrbug 6615
71 void CollationFinnishTest::TestTertiary(/* char* par */)
74 myCollation
->setStrength(Collator::TERTIARY
);
75 for (i
= 0; i
< 4 ; i
++) {
76 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
79 void CollationFinnishTest::TestPrimary(/* char* par */)
82 myCollation
->setStrength(Collator::PRIMARY
);
83 for (i
= 4; i
< 5; i
++) {
84 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
88 void CollationFinnishTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par*/ )
90 if (exec
) logln("TestSuite CollationFinnishTest: ");
92 if((!myCollation
) && exec
) {
93 dataerrln(__FILE__
" cannot test - failed to create collator.");
98 case 0: name
= "TestPrimary"; if (exec
) TestPrimary(/* par */); break;
99 case 1: name
= "TestTertiary"; if (exec
) TestTertiary(/* par */); break;
100 default: name
= ""; break;
104 #endif /* #if !UCONFIG_NO_COLLATION */