]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/escoll.cpp
2 /********************************************************************
4 * Copyright (c) 1997-2009, International Business Machines Corporation and
5 * 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 CollationSpanishTest::CollationSpanishTest()
37 UErrorCode status
= U_ZERO_ERROR
;
38 myCollation
= Collator::createInstance(Locale("es", "ES", ""),status
);
41 CollationSpanishTest::~CollationSpanishTest()
46 const UChar
CollationSpanishTest::testSourceCases
[][CollationSpanishTest::MAX_TOKEN_LEN
] = {
47 {0x61, 0x6c, 0x69, 0x61, 0x73, 0},
48 {0x45, 0x6c, 0x6c, 0x69, 0x6f, 0x74, 0},
49 {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0},
50 {0x61, 0x63, 0x48, 0x63, 0},
51 {0x61, 0x63, 0x63, 0},
52 {0x61, 0x6c, 0x69, 0x61, 0x73, 0},
53 {0x61, 0x63, 0x48, 0x63, 0},
54 {0x61, 0x63, 0x63, 0},
55 {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0},
58 const UChar
CollationSpanishTest::testTargetCases
[][CollationSpanishTest::MAX_TOKEN_LEN
] = {
59 {0x61, 0x6c, 0x6c, 0x69, 0x61, 0x73, 0},
60 {0x45, 0x6d, 0x69, 0x6f, 0x74, 0},
61 {0x68, 0x65, 0x6c, 0x6c, 0x4f, 0},
62 {0x61, 0x43, 0x48, 0x63, 0},
63 {0x61, 0x43, 0x48, 0x63, 0},
64 {0x61, 0x6c, 0x6c, 0x69, 0x61, 0x73, 0},
65 {0x61, 0x43, 0x48, 0x63, 0},
66 {0x61, 0x43, 0x48, 0x63, 0},
67 {0x68, 0x65, 0x6c, 0x6c, 0x4f, 0},
70 const Collator::EComparisonResult
CollationSpanishTest::results
[] = {
83 void CollationSpanishTest::TestTertiary(/* char* par */)
86 myCollation
->setStrength(Collator::TERTIARY
);
87 for (i
= 0; i
< 5 ; i
++) {
88 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
91 void CollationSpanishTest::TestPrimary(/* char* par */)
94 myCollation
->setStrength(Collator::PRIMARY
);
95 for (i
= 5; i
< 9; i
++) {
96 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
100 void CollationSpanishTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par */)
102 if (exec
) logln("TestSuite CollationSpanishTest: ");
104 if((!myCollation
) && exec
) {
105 dataerrln(__FILE__
" cannot test - failed to create collator.");
110 case 0: name
= "TestPrimary"; if (exec
) TestPrimary(/* par */); break;
111 case 1: name
= "TestTertiary"; if (exec
) TestTertiary(/* par */); break;
112 default: name
= ""; break;
116 #endif /* #if !UCONFIG_NO_COLLATION */