Skip to content

Commit 07e0f7e

Browse files
pedberg-icuroubert
authored andcommitted
ICU-22318 Fix bad spacing in utxttest.cpp
1 parent eec5082 commit 07e0f7e

File tree

1 file changed

+41
-42
lines changed

1 file changed

+41
-42
lines changed

icu4c/source/test/intltest/utxttest.cpp

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ void UTextTest::Ticket10983() {
15161516

15171517
void UTextTest::Ticket12130() {
15181518
UErrorCode status = U_ZERO_ERROR;
1519-
1519+
15201520
const char *text8 =
15211521
"Fundamentally, computers just deal with numbers. They store letters and other characters "
15221522
"by assigning a number for each one. Before Unicode was invented, there were hundreds "
@@ -1549,7 +1549,7 @@ void UTextTest::Ticket12130() {
15491549
if (expectedni != ni) {
15501550
errln("%s:%d utext_getNativeIndex() expected %d, got %d", __FILE__, __LINE__, expectedni, ni);
15511551
}
1552-
if (0 != str.tempSubString(startIdx, 20).compare(extractBuffer)) {
1552+
if (0 != str.tempSubString(startIdx, 20).compare(extractBuffer)) {
15531553
errln("%s:%d utext_extract() failed. expected \"%s\", got \"%s\"",
15541554
__FILE__, __LINE__, CStr(str.tempSubString(startIdx, 20))(), CStr(UnicodeString(extractBuffer))());
15551555
}
@@ -1558,7 +1558,7 @@ void UTextTest::Ticket12130() {
15581558

15591559
// Similar utext extract, this time with the string length provided to the UText in advance,
15601560
// and a buffer of larger than required capacity.
1561-
1561+
15621562
utext_openUChars(&ut, ustr, str.length(), &status);
15631563
for (int32_t startIdx = 0; startIdx<str.length(); ++startIdx) {
15641564
int32_t endIdx = startIdx + 20;
@@ -1576,7 +1576,7 @@ void UTextTest::Ticket12130() {
15761576
if (expectedni != ni) {
15771577
errln("%s:%d utext_getNativeIndex() expected %d, got %d", __FILE__, __LINE__, expectedni, ni);
15781578
}
1579-
if (0 != str.tempSubString(startIdx, 20).compare(extractBuffer)) {
1579+
if (0 != str.tempSubString(startIdx, 20).compare(extractBuffer)) {
15801580
errln("%s:%d utext_extract() failed. expected \"%s\", got \"%s\"",
15811581
__FILE__, __LINE__, CStr(str.tempSubString(startIdx, 20))(), CStr(UnicodeString(extractBuffer))());
15821582
}
@@ -1621,10 +1621,10 @@ static const char16_t testAccessText[] = { // text with surrogates at chunk boun
16211621
0xE070,0xe071,0xe072,0xD83D,0xDE00,0xe075,0xe076,0xe077, 0xe078,0xe079,0xe07a,0xD83D,0xDE00,0xe07d,0xe07e,0xD802, // 112-127, unpaired lead at 127
16221622
};
16231623

1624-
static const UChar32 testAccess32Text[] = { // same as above in UTF32
1624+
static const UChar32 testAccess32Text[] = { // same as above in UTF32, surrogate pairs coalesce...
16251625
0xDC00,0xe001,0xe002,0x1F600,0xe005,0xe006,0xe007, 0xe008,0xe009,0xe00a,0x1F600,0xe00d,0xe00e,0xe00f, // 000-013, unpaired trail at 0
16261626
0xE010,0xe011,0xe012,0x1F600,0xe015,0xe016,0xe017, 0xe018,0xe019,0xe01a,0x1F600,0xe01d,0xe01e,0x10001, // 014-027, nonBMP at 27, will split in chunks
1627-
0xe021,0xe022,0x1F600,0xe025,0xe026,0xe027, 0xe028,0xe029,0xe02a,0x1F600,0xe02d,0xe02e,0xe02f, // 028-040
1627+
/*---*/0xe021,0xe022,0x1F600,0xe025,0xe026,0xe027, 0xe028,0xe029,0xe02a,0x1F600,0xe02d,0xe02e,0xe02f, // 028-040
16281628
0xe030,0xe031,0xe032,0x1F600,0xe035,0xe036,0xe037, 0xe038,0xe039,0xe03a,0x1F600,0xe03d,0xe03e,0xe03f, // 041-054
16291629
0xDC02,0xe041,0xe042,0x1F600,0xe045,0xe046,0xe047, 0xe048,0xe049,0xe04a,0x1F600,0xe04d,0xe04e,0xe04f, // 055-068, unpaired trail at 55
16301630
0xe050,0xe051,0xe052,0x1F600,0xe055,0xe056,0xe057, 0xe058,0xe059,0xe05a,0x1F600,0xe05d,0xe05e,0xD801, // 069-082, unpaired lead at 82
@@ -1759,7 +1759,7 @@ u32NativeLength(UText *ut) {
17591759

17601760
/**
17611761
* Map from the current char16_t offset within the current text chunk to
1762-
* the corresponding native index in the original source text.
1762+
* the corresponding native index in the original source text.
17631763
* @return Absolute (native) index corresponding to chunkOffset in the current chunk.
17641764
* The returned native index should always be to a code point boundary.
17651765
*/
@@ -1779,7 +1779,7 @@ u32MapOffsetToNative(const UText *ut) {
17791779
/**
17801780
* Map from a native index to a char16_t offset within a text chunk.
17811781
* Behavior is undefined if the native index does not fall within the
1782-
* current chunk.
1782+
* current chunk.
17831783
* @param nativeIndex Absolute (native) text index, chunk->start<=index<=chunk->limit.
17841784
* @return Chunk-relative UTF-16 offset corresponding to the specified native
17851785
* index.
@@ -1938,7 +1938,6 @@ utext_openUChar32s(UText *ut, const UChar32 *s, int64_t length, const char16_t *
19381938
}
19391939

19401940

1941-
19421941
void UTextTest::AccessChangesChunkSize() {
19431942
UErrorCode status = U_ZERO_ERROR;
19441943
UText ut = UTEXT_INITIALIZER;
@@ -1960,43 +1959,43 @@ void UTextTest::AccessChangesChunkSize() {
19601959
ut.pFuncs = &textFuncs;
19611960

19621961
// do test
1963-
const OffsetAndChar *testEntryPtr = testAccessEntries;
1964-
int32_t testCount = UPRV_LENGTHOF(testAccessEntries);
1965-
for (; testCount-- > 0; testEntryPtr++) {
1966-
utext_setNativeIndex(&ut, testEntryPtr->nativeOffset);
1967-
int64_t beforeOffset = utext_getNativeIndex(&ut);
1968-
UChar32 uchar = utext_current32(&ut);
1969-
int64_t afterOffset = utext_getNativeIndex(&ut);
1970-
if (uchar != testEntryPtr->expectChar || afterOffset != beforeOffset) {
1971-
errln("utext_current32 unexpected behavior for u16, test case %lld: expected char %04X at offset %lld, got %04X at %lld;\n"
1972-
"chunkNativeStart %lld chunkNativeLimit %lld nativeIndexingLimit %d chunkLength %d chunkOffset %d",
1973-
static_cast<int64_t>(testEntryPtr - testAccessEntries), testEntryPtr->expectChar, beforeOffset, uchar, afterOffset,
1974-
ut.chunkNativeStart, ut.chunkNativeLimit, ut.nativeIndexingLimit, ut.chunkLength, ut.chunkOffset);
1975-
}
1976-
}
1977-
utext_close(&ut);
1978-
1979-
ut = UTEXT_INITIALIZER;
1980-
utext_openUChar32s(&ut, testAccess32Text, UPRV_LENGTHOF(testAccess32Text), testAccessText, &status);
1962+
const OffsetAndChar *testEntryPtr = testAccessEntries;
1963+
int32_t testCount = UPRV_LENGTHOF(testAccessEntries);
1964+
for (; testCount-- > 0; testEntryPtr++) {
1965+
utext_setNativeIndex(&ut, testEntryPtr->nativeOffset);
1966+
int64_t beforeOffset = utext_getNativeIndex(&ut);
1967+
UChar32 uchar = utext_current32(&ut);
1968+
int64_t afterOffset = utext_getNativeIndex(&ut);
1969+
if (uchar != testEntryPtr->expectChar || afterOffset != beforeOffset) {
1970+
errln("utext_current32 unexpected behavior for u16, test case %lld: expected char %04X at offset %lld, got %04X at %lld;\n"
1971+
"chunkNativeStart %lld chunkNativeLimit %lld nativeIndexingLimit %d chunkLength %d chunkOffset %d",
1972+
static_cast<int64_t>(testEntryPtr - testAccessEntries), testEntryPtr->expectChar, beforeOffset, uchar, afterOffset,
1973+
ut.chunkNativeStart, ut.chunkNativeLimit, ut.nativeIndexingLimit, ut.chunkLength, ut.chunkOffset);
1974+
}
1975+
}
1976+
utext_close(&ut);
1977+
1978+
ut = UTEXT_INITIALIZER;
1979+
utext_openUChar32s(&ut, testAccess32Text, UPRV_LENGTHOF(testAccess32Text), testAccessText, &status);
19811980
if (U_FAILURE(status)) {
19821981
errln("utext_openUChar32s failed: %s", u_errorName(status));
19831982
return;
19841983
}
19851984
// do test
1986-
testEntryPtr = testAccess32Entries;
1987-
testCount = UPRV_LENGTHOF(testAccess32Entries);
1988-
for (; testCount-- > 0; testEntryPtr++) {
1989-
utext_setNativeIndex(&ut, testEntryPtr->nativeOffset);
1990-
int64_t beforeOffset = utext_getNativeIndex(&ut);
1991-
UChar32 uchar = utext_current32(&ut);
1992-
int64_t afterOffset = utext_getNativeIndex(&ut);
1993-
if (uchar != testEntryPtr->expectChar || afterOffset != beforeOffset) {
1994-
errln("utext_current32 unexpected behavior for u32, test case %lld: expected char %04X at offset %lld, got %04X at %lld;\n"
1995-
"chunkNativeStart %lld chunkNativeLimit %lld nativeIndexingLimit %d chunkLength %d chunkOffset %d",
1996-
static_cast<int64_t>(testEntryPtr - testAccess32Entries), testEntryPtr->expectChar, beforeOffset, uchar, afterOffset,
1997-
ut.chunkNativeStart, ut.chunkNativeLimit, ut.nativeIndexingLimit, ut.chunkLength, ut.chunkOffset);
1998-
}
1999-
}
2000-
utext_close(&ut);
1985+
testEntryPtr = testAccess32Entries;
1986+
testCount = UPRV_LENGTHOF(testAccess32Entries);
1987+
for (; testCount-- > 0; testEntryPtr++) {
1988+
utext_setNativeIndex(&ut, testEntryPtr->nativeOffset);
1989+
int64_t beforeOffset = utext_getNativeIndex(&ut);
1990+
UChar32 uchar = utext_current32(&ut);
1991+
int64_t afterOffset = utext_getNativeIndex(&ut);
1992+
if (uchar != testEntryPtr->expectChar || afterOffset != beforeOffset) {
1993+
errln("utext_current32 unexpected behavior for u32, test case %lld: expected char %04X at offset %lld, got %04X at %lld;\n"
1994+
"chunkNativeStart %lld chunkNativeLimit %lld nativeIndexingLimit %d chunkLength %d chunkOffset %d",
1995+
static_cast<int64_t>(testEntryPtr - testAccess32Entries), testEntryPtr->expectChar, beforeOffset, uchar, afterOffset,
1996+
ut.chunkNativeStart, ut.chunkNativeLimit, ut.nativeIndexingLimit, ut.chunkLength, ut.chunkOffset);
1997+
}
1998+
}
1999+
utext_close(&ut);
20012000
}
20022001

0 commit comments

Comments
 (0)