~ubuntu-branches/ubuntu/jaunty/texlive-bin/jaunty-security

« back to all changes in this revision

Viewing changes to build/source/libs/icu-xetex/test/intltest/ficoll.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-06-26 23:14:59 UTC
  • mfrom: (2.1.30 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080626231459-y02rjsrgtafu83yr
Tags: 2007.dfsg.2-3
add missing source roadmap.fig of roadmap.eps in fontinst documentation
(Closes: #482915) (urgency medium due to RC bug)
(new patch add-missing-fontinst-source)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 * COPYRIGHT: 
 
3
 * Copyright (c) 1997-2003, International Business Machines Corporation and
 
4
 * others. All Rights Reserved.
 
5
 ********************************************************************/
 
6
 
 
7
#include "unicode/utypes.h"
 
8
 
 
9
#if !UCONFIG_NO_COLLATION
 
10
 
 
11
#ifndef _COLL
 
12
#include "unicode/coll.h"
 
13
#endif
 
14
 
 
15
#ifndef _TBLCOLL
 
16
#include "unicode/tblcoll.h"
 
17
#endif
 
18
 
 
19
#ifndef _UNISTR
 
20
#include "unicode/unistr.h"
 
21
#endif
 
22
 
 
23
#ifndef _SORTKEY
 
24
#include "unicode/sortkey.h"
 
25
#endif
 
26
 
 
27
#ifndef _FICOLL
 
28
#include "ficoll.h"
 
29
#endif
 
30
 
 
31
#include "sfwdchit.h"
 
32
 
 
33
CollationFinnishTest::CollationFinnishTest()
 
34
: myCollation(0)
 
35
{
 
36
    UErrorCode status = U_ZERO_ERROR;
 
37
    myCollation = Collator::createInstance(Locale("fi", "FI", ""),status);
 
38
}
 
39
 
 
40
CollationFinnishTest::~CollationFinnishTest()
 
41
{
 
42
    delete myCollation;
 
43
}
 
44
 
 
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},
 
50
    {0x77, 0x61, 0x74, 0}
 
51
};
 
52
 
 
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},
 
58
    {0x76, 0x61, 0x74, 0}
 
59
};
 
60
 
 
61
const Collator::EComparisonResult CollationFinnishTest::results[] = {
 
62
    Collator::GREATER,
 
63
    Collator::LESS,
 
64
    Collator::GREATER,
 
65
    Collator::LESS,
 
66
    // test primary > 4
 
67
    Collator::EQUAL,
 
68
};
 
69
 
 
70
void CollationFinnishTest::TestTertiary(/* char* par */)
 
71
{
 
72
    int32_t i = 0;
 
73
    myCollation->setStrength(Collator::TERTIARY);
 
74
    for (i = 0; i < 4 ; i++) {
 
75
        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
 
76
    }
 
77
}
 
78
void CollationFinnishTest::TestPrimary(/* char* par */)
 
79
{
 
80
    int32_t i;
 
81
    myCollation->setStrength(Collator::PRIMARY);
 
82
    for (i = 4; i < 5; i++) {
 
83
        doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
 
84
    }
 
85
}
 
86
 
 
87
void CollationFinnishTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
 
88
{
 
89
    if (exec) logln("TestSuite CollationFinnishTest: ");
 
90
 
 
91
    if((!myCollation) && exec) {
 
92
      errln(__FILE__ " cannot test - failed to create collator.");
 
93
      name = "";
 
94
      return;
 
95
    }
 
96
    switch (index) {
 
97
        case 0: name = "TestPrimary";   if (exec)   TestPrimary(/* par */); break;
 
98
        case 1: name = "TestTertiary";  if (exec)   TestTertiary(/* par */); break;
 
99
        default: name = ""; break;
 
100
    }
 
101
}
 
102
 
 
103
#endif /* #if !UCONFIG_NO_COLLATION */