]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/escoll.cpp
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 /********************************************************************
6 * Copyright (c) 1997-2009, International Business Machines Corporation and
7 * others. All Rights Reserved.
8 ********************************************************************/
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_COLLATION
15 #include "unicode/coll.h"
19 #include "unicode/tblcoll.h"
23 #include "unicode/unistr.h"
27 #include "unicode/sortkey.h"
36 CollationSpanishTest::CollationSpanishTest()
39 UErrorCode status
= U_ZERO_ERROR
;
40 myCollation
= Collator::createInstance(Locale("es", "ES", ""),status
);
43 CollationSpanishTest::~CollationSpanishTest()
48 const UChar
CollationSpanishTest::testSourceCases
[][CollationSpanishTest::MAX_TOKEN_LEN
] = {
49 {0x61, 0x6c, 0x69, 0x61, 0x73, 0},
50 {0x45, 0x6c, 0x6c, 0x69, 0x6f, 0x74, 0},
51 {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0},
52 {0x61, 0x63, 0x48, 0x63, 0},
53 {0x61, 0x63, 0x63, 0},
54 {0x61, 0x6c, 0x69, 0x61, 0x73, 0},
55 {0x61, 0x63, 0x48, 0x63, 0},
56 {0x61, 0x63, 0x63, 0},
57 {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0},
60 const UChar
CollationSpanishTest::testTargetCases
[][CollationSpanishTest::MAX_TOKEN_LEN
] = {
61 {0x61, 0x6c, 0x6c, 0x69, 0x61, 0x73, 0},
62 {0x45, 0x6d, 0x69, 0x6f, 0x74, 0},
63 {0x68, 0x65, 0x6c, 0x6c, 0x4f, 0},
64 {0x61, 0x43, 0x48, 0x63, 0},
65 {0x61, 0x43, 0x48, 0x63, 0},
66 {0x61, 0x6c, 0x6c, 0x69, 0x61, 0x73, 0},
67 {0x61, 0x43, 0x48, 0x63, 0},
68 {0x61, 0x43, 0x48, 0x63, 0},
69 {0x68, 0x65, 0x6c, 0x6c, 0x4f, 0},
72 const Collator::EComparisonResult
CollationSpanishTest::results
[] = {
85 void CollationSpanishTest::TestTertiary(/* char* par */)
88 myCollation
->setStrength(Collator::TERTIARY
);
89 for (i
= 0; i
< 5 ; i
++) {
90 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
93 void CollationSpanishTest::TestPrimary(/* char* par */)
96 myCollation
->setStrength(Collator::PRIMARY
);
97 for (i
= 5; i
< 9; i
++) {
98 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
102 void CollationSpanishTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par */)
104 if (exec
) logln("TestSuite CollationSpanishTest: ");
106 if((!myCollation
) && exec
) {
107 dataerrln(__FILE__
" cannot test - failed to create collator.");
112 case 0: name
= "TestPrimary"; if (exec
) TestPrimary(/* par */); break;
113 case 1: name
= "TestTertiary"; if (exec
) TestTertiary(/* par */); break;
114 default: name
= ""; break;
118 #endif /* #if !UCONFIG_NO_COLLATION */