]> granicus.if.org Git - icu/commitdiff
ICU-8716 Fix some rbbi and number format test so that it will pass without data
authorMichael Ow <mow@svn.icu-project.org>
Tue, 30 Aug 2011 19:11:32 +0000 (19:11 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Tue, 30 Aug 2011 19:11:32 +0000 (19:11 +0000)
X-SVN-Rev: 30598

icu4c/source/test/cintltst/cbiapts.c
icu4c/source/test/intltest/numfmtst.cpp
icu4c/source/test/intltest/rbbiapts.cpp
icu4c/source/test/intltest/rbbitst.cpp

index 18c9aa1523803f5bd57a678db07ea36abd3d79ed..9c491ae64735644ce1d8e71d30bca06b5211258c 100644 (file)
@@ -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 */
index 398202a4c388c222d344232a127868ba2aef02aa..b101553bf2222fde33c55e756dda41e824239a7c 100644 (file)
@@ -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 ) {
index cb40076b4b8f5aa8b3105284bf435a7ab01f14ed..3704311bda229782503e43d539d641929f3fd89e 100644 (file)
@@ -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());
-    
-    /* 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);
+    if (U_SUCCESS(status)) {
+        bi->setText(&ut1, status);
+        TEST_ASSERT_SUCCESS(status);
 
-    /* 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());
+        /* 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());
+    
+        utext_close(&ut1);
+        utext_close(&ut2);
+    }
     delete bi;
-    utext_close(&ut1);
-    utext_close(&ut2);
 
 }
 
index 9b63b312c2f94298c533b2fb72648087a5df530b..e9bb6b1435e44bc1729e715d95ba98df6e504f83 100644 (file)
@@ -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;
     }