mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-8716 Fix some rbbi and number format test so that it will pass without data
X-SVN-Rev: 30598
This commit is contained in:
parent
8ccd432155
commit
451107e9e3
4 changed files with 49 additions and 43 deletions
|
@ -849,28 +849,30 @@ static void TestBreakIteratorRefresh(void) {
|
|||
ubrk_setUText(bi, &ut1, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
|
||||
/* Line boundaries will occur before each letter in the original string */
|
||||
TEST_ASSERT(1 == ubrk_next(bi));
|
||||
TEST_ASSERT(3 == ubrk_next(bi));
|
||||
if (U_SUCCESS(status)) {
|
||||
/* Line boundaries will occur before each letter in the original string */
|
||||
TEST_ASSERT(1 == ubrk_next(bi));
|
||||
TEST_ASSERT(3 == ubrk_next(bi));
|
||||
|
||||
/* Move the string, kill the original string. */
|
||||
u_strcpy(movedStr, testStr);
|
||||
u_memset(testStr, 0x20, u_strlen(testStr));
|
||||
utext_openUChars(&ut2, movedStr, -1, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
ubrk_refreshUText(bi, &ut2, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
|
||||
/* Move the string, kill the original string. */
|
||||
u_strcpy(movedStr, testStr);
|
||||
u_memset(testStr, 0x20, u_strlen(testStr));
|
||||
utext_openUChars(&ut2, movedStr, -1, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
ubrk_refreshUText(bi, &ut2, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
|
||||
/* Find the following matches, now working in the moved string. */
|
||||
TEST_ASSERT(5 == ubrk_next(bi));
|
||||
TEST_ASSERT(7 == ubrk_next(bi));
|
||||
TEST_ASSERT(8 == ubrk_next(bi));
|
||||
TEST_ASSERT(UBRK_DONE == ubrk_next(bi));
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
/* Find the following matches, now working in the moved string. */
|
||||
TEST_ASSERT(5 == ubrk_next(bi));
|
||||
TEST_ASSERT(7 == ubrk_next(bi));
|
||||
TEST_ASSERT(8 == ubrk_next(bi));
|
||||
TEST_ASSERT(UBRK_DONE == ubrk_next(bi));
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
|
||||
utext_close(&ut1);
|
||||
utext_close(&ut2);
|
||||
}
|
||||
ubrk_close(bi);
|
||||
utext_close(&ut1);
|
||||
utext_close(&ut2);
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
|
||||
|
|
|
@ -6457,6 +6457,7 @@ void NumberFormatTest::TestExplicitParents() {
|
|||
void NumberFormatTest::TestAvailableNumberingSystems() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
StringEnumeration *availableNumberingSystems = NumberingSystem::getAvailableNames(status);
|
||||
CHECK_DATA(status, "NumberingSystem::getAvailableNames()")
|
||||
|
||||
int32_t nsCount = availableNumberingSystems->count(status);
|
||||
if ( nsCount < 36 ) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
|
||||
#define TEST_ASSERT_SUCCESS(status) {if (U_FAILURE(status)) {\
|
||||
errln("Failure at file %s, line %d, error = %s", __FILE__, __LINE__, u_errorName(status));}}
|
||||
dataerrln("Failure at file %s, line %d, error = %s", __FILE__, __LINE__, u_errorName(status));}}
|
||||
|
||||
#define TEST_ASSERT(expr) {if ((expr) == FALSE) { \
|
||||
errln("Test Failure at file %s, line %d: \"%s\" is false.\n", __FILE__, __LINE__, #expr);};}
|
||||
|
@ -1141,31 +1141,34 @@ void RBBIAPITest::TestRefreshInputText() {
|
|||
|
||||
utext_openUChars(&ut1, testStr, -1, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
bi->setText(&ut1, status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
|
||||
/* Line boundaries will occur before each letter in the original string */
|
||||
TEST_ASSERT(1 == bi->next());
|
||||
TEST_ASSERT(3 == bi->next());
|
||||
if (U_SUCCESS(status)) {
|
||||
bi->setText(&ut1, status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
|
||||
/* Line boundaries will occur before each letter in the original string */
|
||||
TEST_ASSERT(1 == bi->next());
|
||||
TEST_ASSERT(3 == bi->next());
|
||||
|
||||
/* Move the string, kill the original string. */
|
||||
u_strcpy(movedStr, testStr);
|
||||
u_memset(testStr, 0x20, u_strlen(testStr));
|
||||
utext_openUChars(&ut2, movedStr, -1, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
RuleBasedBreakIterator *returnedBI = &bi->refreshInputText(&ut2, status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT(bi == returnedBI);
|
||||
|
||||
/* Find the following matches, now working in the moved string. */
|
||||
TEST_ASSERT(5 == bi->next());
|
||||
TEST_ASSERT(7 == bi->next());
|
||||
TEST_ASSERT(8 == bi->next());
|
||||
TEST_ASSERT(UBRK_DONE == bi->next());
|
||||
|
||||
/* Move the string, kill the original string. */
|
||||
u_strcpy(movedStr, testStr);
|
||||
u_memset(testStr, 0x20, u_strlen(testStr));
|
||||
utext_openUChars(&ut2, movedStr, -1, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
RuleBasedBreakIterator *returnedBI = &bi->refreshInputText(&ut2, status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT(bi == returnedBI);
|
||||
|
||||
/* Find the following matches, now working in the moved string. */
|
||||
TEST_ASSERT(5 == bi->next());
|
||||
TEST_ASSERT(7 == bi->next());
|
||||
TEST_ASSERT(8 == bi->next());
|
||||
TEST_ASSERT(UBRK_DONE == bi->next());
|
||||
|
||||
utext_close(&ut1);
|
||||
utext_close(&ut2);
|
||||
}
|
||||
delete bi;
|
||||
utext_close(&ut1);
|
||||
utext_close(&ut2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -620,7 +620,7 @@ void RBBITest::TestJapaneseWordBreak() {
|
|||
Locale("ja"), status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
errcheckln(status, "Failed to create the BreakIterator for Japanese locale in TestJapaneseWordBreak.\n");
|
||||
errcheckln(status, "Failed to create the BreakIterator for Japanese locale in TestJapaneseWordBreak.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue