From: Andy Heninger Date: Wed, 18 Jan 2017 23:51:57 +0000 (+0000) Subject: ICU-12643 C++11 trial. Use some features as a test case. X-Git-Tag: milestone-59-0-1~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08e0afec5825c82c6d7373245972984c96a5575b;p=icu ICU-12643 C++11 trial. Use some features as a test case. X-SVN-Rev: 39578 --- diff --git a/icu4c/source/test/intltest/rbbitst.cpp b/icu4c/source/test/intltest/rbbitst.cpp index 96a2b7a9edd..a4ab93aa2a5 100644 --- a/icu4c/source/test/intltest/rbbitst.cpp +++ b/icu4c/source/test/intltest/rbbitst.cpp @@ -1171,15 +1171,6 @@ void RBBITest::TestExtended() { EParseState savedState = PARSE_TAG; - static const UChar CH_LF = 0x0a; - static const UChar CH_CR = 0x0d; - static const UChar CH_HASH = 0x23; - /*static const UChar CH_PERIOD = 0x2e;*/ - static const UChar CH_LT = 0x3c; - static const UChar CH_GT = 0x3e; - static const UChar CH_BACKSLASH = 0x5c; - static const UChar CH_BULLET = 0x2022; - int32_t lineNum = 1; int32_t colStart = 0; int32_t column = 0; @@ -1191,12 +1182,12 @@ void RBBITest::TestExtended() { status = U_ZERO_ERROR; UChar c = testString.charAt(charIdx); charIdx++; - if (c == CH_CR && charIdxsetSize(breakIdx+1); tp.expectedBreaks->setElementAt(-1, breakIdx); @@ -1325,7 +1316,7 @@ void RBBITest::TestExtended() { // Get the code point from the name and insert it into the test data. // (Damn, no API takes names in Unicode !!! // we've got to take it back to char *) - int32_t nameEndIdx = testString.indexOf((UChar)0x7d/*'}'*/, charIdx); + int32_t nameEndIdx = testString.indexOf(u'}', charIdx); int32_t nameLength = nameEndIdx - (charIdx+2); char charNameBuf[200]; UChar32 theChar = -1; @@ -1372,28 +1363,28 @@ void RBBITest::TestExtended() { break; } - if (c == CH_LT) { + if (c == u'<') { tagValue = 0; parseState = PARSE_NUM; break; } - if (c == CH_HASH && column==3) { // TODO: why is column off so far? + if (c == u'#' && column==3) { // TODO: why is column off so far? parseState = PARSE_COMMENT; savedState = PARSE_DATA; break; } - if (c == CH_BACKSLASH) { + if (c == u'\\') { // Check for \ at end of line, a line continuation. // Advance over (discard) the newline UChar32 cp = testString.char32At(charIdx); - if (cp == CH_CR && charIdx') { // Finished the number. Add the info to the expected break data, // and switch parse state back to doing plain data. parseState = PARSE_DATA; @@ -1689,20 +1680,20 @@ void RBBITest::TestUnicodeFiles() { // See ticket #7270. UBool RBBITest::testCaseIsKnownIssue(const UnicodeString &testCase, const char *fileName) { - static const UChar badTestCases[][4] = { // Line Numbers from Unicode 7.0.0 file. - {(UChar)0x200B, (UChar)0x0020, (UChar)0x007D, (UChar)0x0000}, // Line 5198 - {(UChar)0x200B, (UChar)0x0020, (UChar)0x0029, (UChar)0x0000}, // Line 5202 - {(UChar)0x200B, (UChar)0x0020, (UChar)0x0021, (UChar)0x0000}, // Line 5214 - {(UChar)0x200B, (UChar)0x0020, (UChar)0x002c, (UChar)0x0000}, // Line 5246 - {(UChar)0x200B, (UChar)0x0020, (UChar)0x002f, (UChar)0x0000}, // Line 5298 - {(UChar)0x200B, (UChar)0x0020, (UChar)0x2060, (UChar)0x0000} // Line 5302 + static const UChar *badTestCases[] = { // Line Numbers from Unicode 7.0.0 file. + u"\u200B\u0020\u007D", // Line 5198 + u"\u200B\u0020\u0029", // Line 5202 + u"\u200B\u0020\u0021", // Line 5214 + u"\u200B\u0020\u002c", // Line 5246 + u"\u200B\u0020\u002f", // Line 5298 + u"\u200B\u0020\u2060" // Line 5302 }; if (strcmp(fileName, "LineBreakTest.txt") != 0) { return FALSE; } - for (int i=0; icontains(*posChar)) { - *posChar = 0x41; // thisChar = 'A'; + *posChar = u'A'; } // Push the updated nextPos and nextChar back to our caller.