OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2002-2013, International Business Machines | 4 * Copyright (C) 2002-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: strcase.cpp | 8 * file name: strcase.cpp |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 2002mar12 | 13 * created on: 2002mar12 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
15 * | 15 * |
16 * Test file for string casing C++ API functions. | 16 * Test file for string casing C++ API functions. |
17 */ | 17 */ |
18 | 18 |
19 #include "unicode/uchar.h" | 19 #include "unicode/uchar.h" |
20 #include "unicode/ures.h" | 20 #include "unicode/ures.h" |
21 #include "unicode/uloc.h" | 21 #include "unicode/uloc.h" |
22 #include "unicode/locid.h" | 22 #include "unicode/locid.h" |
23 #include "unicode/ubrk.h" | 23 #include "unicode/ubrk.h" |
24 #include "unicode/unistr.h" | 24 #include "unicode/unistr.h" |
25 #include "unicode/ucasemap.h" | 25 #include "unicode/ucasemap.h" |
26 #include "ucase.h" | 26 #include "ucase.h" |
27 #include "ustrtest.h" | 27 #include "ustrtest.h" |
28 #include "unicode/tstdtmod.h" | 28 #include "unicode/tstdtmod.h" |
29 | 29 #include "cmemory.h" |
30 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
31 | 30 |
32 StringCaseTest::~StringCaseTest() {} | 31 StringCaseTest::~StringCaseTest() {} |
33 | 32 |
34 void | 33 void |
35 StringCaseTest::runIndexedTest(int32_t index, UBool exec, const char *&name, cha
r * /*par*/) { | 34 StringCaseTest::runIndexedTest(int32_t index, UBool exec, const char *&name, cha
r * /*par*/) { |
36 if(exec) { | 35 if(exec) { |
37 logln("TestSuite StringCaseTest: "); | 36 logln("TestSuite StringCaseTest: "); |
38 } | 37 } |
39 TESTCASE_AUTO_BEGIN; | 38 TESTCASE_AUTO_BEGIN; |
40 TESTCASE_AUTO(TestCaseConversion); | 39 TESTCASE_AUTO(TestCaseConversion); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 #if !UCONFIG_NO_BREAK_ITERATION | 483 #if !UCONFIG_NO_BREAK_ITERATION |
485 if(whichCase==TEST_TITLE) { | 484 if(whichCase==TEST_TITLE) { |
486 type = myCase->getInt("Type", status); | 485 type = myCase->getInt("Type", status); |
487 if(type>=0) { | 486 if(type>=0) { |
488 iter.adoptInstead(ubrk_open((UBreakIteratorType)type, cL
ocaleID, NULL, 0, &status)); | 487 iter.adoptInstead(ubrk_open((UBreakIteratorType)type, cL
ocaleID, NULL, 0, &status)); |
489 } else if(type==-2) { | 488 } else if(type==-2) { |
490 // Open a trivial break iterator that only delivers { 0,
length } | 489 // Open a trivial break iterator that only delivers { 0,
length } |
491 // or even just { 0 } as boundaries. | 490 // or even just { 0 } as boundaries. |
492 static const UChar rules[] = { 0x2e, 0x2a, 0x3b }; // "
.*;" | 491 static const UChar rules[] = { 0x2e, 0x2a, 0x3b }; // "
.*;" |
493 UParseError parseError; | 492 UParseError parseError; |
494 iter.adoptInstead(ubrk_openRules(rules, LENGTHOF(rules),
NULL, 0, &parseError, &status)); | 493 iter.adoptInstead(ubrk_openRules(rules, UPRV_LENGTHOF(ru
les), NULL, 0, &parseError, &status)); |
495 } | 494 } |
496 } | 495 } |
497 #endif | 496 #endif |
498 options = 0; | 497 options = 0; |
499 if(whichCase==TEST_TITLE || whichCase==TEST_FOLD) { | 498 if(whichCase==TEST_TITLE || whichCase==TEST_FOLD) { |
500 optionsString = myCase->getString("Options", status); | 499 optionsString = myCase->getString("Options", status); |
501 if(optionsString.indexOf((UChar)0x54)>=0) { // T | 500 if(optionsString.indexOf((UChar)0x54)>=0) { // T |
502 options|=U_FOLD_CASE_EXCLUDE_SPECIAL_I; | 501 options|=U_FOLD_CASE_EXCLUDE_SPECIAL_I; |
503 } | 502 } |
504 if(optionsString.indexOf((UChar)0x4c)>=0) { // L | 503 if(optionsString.indexOf((UChar)0x4c)>=0) { // L |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 ++countSpecific; | 564 ++countSpecific; |
566 } | 565 } |
567 } | 566 } |
568 if(countSpecific!=3) { | 567 if(countSpecific!=3) { |
569 errln("error: FullCaseFoldingIterator did not yield exactly the expected
specific cases"); | 568 errln("error: FullCaseFoldingIterator did not yield exactly the expected
specific cases"); |
570 } | 569 } |
571 if(count<70) { | 570 if(count<70) { |
572 errln("error: FullCaseFoldingIterator yielded only %d (cp, full) pairs",
(int)count); | 571 errln("error: FullCaseFoldingIterator yielded only %d (cp, full) pairs",
(int)count); |
573 } | 572 } |
574 } | 573 } |
OLD | NEW |