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
CollationFinnishTest::CollationFinnishTest()
36
UErrorCode status = U_ZERO_ERROR;
37
myCollation = Collator::createInstance(Locale("fi", "FI", ""),status);
40
CollationFinnishTest::~CollationFinnishTest()
45
const UChar CollationFinnishTest::testSourceCases[][CollationFinnishTest::MAX_TOKEN_LEN] = {
46
{0x77, 0x61, 0x74, 0},
47
{0x76, 0x61, 0x74, 0},
48
{0x61, 0x00FC, 0x62, 0x65, 0x63, 0x6b, 0},
49
{0x4c, 0x00E5, 0x76, 0x69, 0},
53
const UChar CollationFinnishTest::testTargetCases[][CollationFinnishTest::MAX_TOKEN_LEN] = {
54
{0x76, 0x61, 0x74, 0},
55
{0x77, 0x61, 0x79, 0},
56
{0x61, 0x78, 0x62, 0x65, 0x63, 0x6b, 0},
57
{0x4c, 0x00E4, 0x77, 0x65, 0},
61
const Collator::EComparisonResult CollationFinnishTest::results[] = {
70
void CollationFinnishTest::TestTertiary(/* char* par */)
73
myCollation->setStrength(Collator::TERTIARY);
74
for (i = 0; i < 4 ; i++) {
75
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
78
void CollationFinnishTest::TestPrimary(/* char* par */)
81
myCollation->setStrength(Collator::PRIMARY);
82
for (i = 4; i < 5; i++) {
83
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
87
void CollationFinnishTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
89
if (exec) logln("TestSuite CollationFinnishTest: ");
91
if((!myCollation) && exec) {
92
errln(__FILE__ " cannot test - failed to create collator.");
97
case 0: name = "TestPrimary"; if (exec) TestPrimary(/* par */); break;
98
case 1: name = "TestTertiary"; if (exec) TestTertiary(/* par */); break;
99
default: name = ""; break;
103
#endif /* #if !UCONFIG_NO_COLLATION */