diff --git a/icu4c/source/test/cintltst/cmsccoll.c b/icu4c/source/test/cintltst/cmsccoll.c index 1068c3f83f0..4145eaae148 100644 --- a/icu4c/source/test/cintltst/cmsccoll.c +++ b/icu4c/source/test/cintltst/cmsccoll.c @@ -1435,9 +1435,10 @@ static void RamsRulesTest(void) { uprv_strcmp("zh", locName)==0 || uprv_strcmp("zh_Hant", locName)==0 ) { - log_verbose("Don't know how to test %s. " - "TODO: Fix ticket #6040 and reenable RamsRulesTest for this locale.\n", locName); + if(log_knownIssue("6040", NULL)) { + log_verbose("Can't test %s - TODO: Fix ticket #6040 and reenable RamsRulesTest for this locale.\n", locName); continue; + } } log_verbose("Testing locale %s\n", locName); status = U_ZERO_ERROR; @@ -6775,6 +6776,7 @@ static void TestImportRulesFiWithEor(void) doTestOneTestCase(fiStdTests, LEN(fiStdTests), fiStdRules, LEN(fiStdRules)); doTestOneTestCase(fiEorTests, LEN(fiEorTests), eorFiStdRules, LEN(eorFiStdRules)); + log_knownIssue("8962", NULL); /* TODO: Fix ICU ticket #8962 by uncommenting the following test after fi.txt is updated with the following rule: eor{ Sequence{ diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index ec430ac4d32..888acdb2b0e 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -1064,7 +1064,7 @@ void IntlTest::printErrors() UBool IntlTest::printKnownIssues() { if(knownList != NULL) { - udbg_knownIssue_print(knownList, NULL); + udbg_knownIssue_print(knownList); udbg_knownIssue_close(knownList); return TRUE; } else { diff --git a/icu4c/source/test/intltest/itrbnf.cpp b/icu4c/source/test/intltest/itrbnf.cpp index 3fe067b83e1..1e08e8272d4 100644 --- a/icu4c/source/test/intltest/itrbnf.cpp +++ b/icu4c/source/test/intltest/itrbnf.cpp @@ -1096,9 +1096,9 @@ IntlTestRBNF::TestEnglishSpellout() doTest(formatter, testData, TRUE); #if !UCONFIG_NO_COLLATION - /* Skipping this test until #9503 is fixed. - formatter->setLenient(TRUE); - static const char* lpTestData[][2] = { + if( !logKnownIssue("9503") ) { + formatter->setLenient(TRUE); + static const char* lpTestData[][2] = { { "fifty-7", "57" }, { " fifty-7", "57" }, { " fifty-7", "57" }, @@ -1106,9 +1106,9 @@ IntlTestRBNF::TestEnglishSpellout() { "fifteen hundred and zero", "1,500" }, { "FOurhundred thiRTY six", "436" }, { NULL, NULL} - }; - doLenientParseTest(formatter, lpTestData); - */ + }; + doLenientParseTest(formatter, lpTestData); + } #endif } delete formatter; diff --git a/icu4c/source/test/intltest/transrt.cpp b/icu4c/source/test/intltest/transrt.cpp index eab4c90aa89..30ebbe9e052 100644 --- a/icu4c/source/test/intltest/transrt.cpp +++ b/icu4c/source/test/intltest/transrt.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2000-2011, International Business Machines +* Copyright (C) 2000-2013, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -1127,19 +1127,9 @@ void TransliteratorRoundTripTest::TestHan() { void TransliteratorRoundTripTest::TestGreek() { - - // CLDR bug #1911: This test should be moved into CLDR. + logKnownIssue( "cldrbug:1911"); // It is left in its current state as a regression test. - -// if (isICUVersionAtLeast(ICU_39)) { -// // We temporarily filter against Unicode 4.1, but we only do this -// // before version 3.4. -// errln("FAIL: TestGreek needs to be updated to remove delete the [:Age=4.0:] filter "); -// return; -// } else { -// logln("Warning: TestGreek needs to be updated to remove delete the section marked [:Age=4.0:] filter"); -// } - + RTTest test("Latin-Greek"); LegalGreek *legal = new LegalGreek(TRUE); @@ -1162,19 +1152,9 @@ void TransliteratorRoundTripTest::TestGreek() { void TransliteratorRoundTripTest::TestGreekUNGEGN() { - - // CLDR bug #1911: This test should be moved into CLDR. + logKnownIssue( "cldrbug:1911"); // It is left in its current state as a regression test. -// if (isICUVersionAtLeast(ICU_39)) { -// // We temporarily filter against Unicode 4.1, but we only do this -// // before version 3.4. -// errln("FAIL: TestGreek needs to be updated to remove delete the [:Age=4.0:] filter "); -// return; -// } else { -// logln("Warning: TestGreek needs to be updated to remove delete the section marked [:Age=4.0:] filter"); -// } - RTTest test("Latin-Greek/UNGEGN"); LegalGreek *legal = new LegalGreek(FALSE); @@ -1194,19 +1174,9 @@ void TransliteratorRoundTripTest::TestGreekUNGEGN() { } void TransliteratorRoundTripTest::Testel() { - - // CLDR bug #1911: This test should be moved into CLDR. + logKnownIssue( "cldrbug:1911"); // It is left in its current state as a regression test. -// if (isICUVersionAtLeast(ICU_39)) { -// // We temporarily filter against Unicode 4.1, but we only do this -// // before version 3.4. -// errln("FAIL: TestGreek needs to be updated to remove delete the [:Age=4.0:] filter "); -// return; -// } else { -// logln("Warning: TestGreek needs to be updated to remove delete the section marked [:Age=4.0:] filter"); -// } - RTTest test("Latin-el"); LegalGreek *legal = new LegalGreek(FALSE); @@ -1266,16 +1236,9 @@ UBool LegalHebrew::is(const UnicodeString& sourceString)const{ return TRUE; } void TransliteratorRoundTripTest::TestHebrew() { - // CLDR bug #1911: This test should be moved into CLDR. + logKnownIssue( "cldrbug:1911"); // It is left in its current state as a regression test. -// if (isICUVersionAtLeast(ICU_39)) { -// // We temporarily filter against Unicode 4.1, but we only do this -// // before version 3.4. -// errln("FAIL: TestHebrew needs to be updated to remove delete the [:Age=4.0:] filter "); -// return; -// } else { -// logln("Warning: TestHebrew needs to be updated to remove delete the section marked [:Age=4.0:] filter"); -// } + //long start = System.currentTimeMillis(); UErrorCode error = U_ZERO_ERROR; LegalHebrew* legal = new LegalHebrew(error); @@ -1391,16 +1354,9 @@ void TransliteratorRoundTripTest::TestDevanagariLatin() { } RTTest test("Latin-Devanagari"); Legal *legal = new LegalIndic(); - // CLDR bug #1911: This test should be moved into CLDR. + logKnownIssue( "cldrbug:1911"); // It is left in its current state as a regression test. -// if (isICUVersionAtLeast(ICU_39)) { -// // We temporarily filter against Unicode 4.1, but we only do this -// // before version 3.4. -// errln("FAIL: TestDevanagariLatin needs to be updated to remove delete the [:Age=4.1:] filter "); -// return; -// } else { -// logln("Warning: TestDevanagariLatin needs to be updated to remove delete the section marked [:Age=4.1:] filter"); -// } + test.test(UnicodeString(latinForIndic, ""), UnicodeString("[[[:Devanagari:][\\u094d][\\u0964\\u0965]]&[:Age=4.1:]-[\\u0970]]", ""), "[\\u0965\\u0904]", this, quick, legal, 50); @@ -1668,28 +1624,21 @@ void TransliteratorRoundTripTest::TestInterIndic() { logln("Testing only 5 of %i. Skipping rest (use -e for exhaustive)",num); num = 5; } - // CLDR bug #1911: This test should be moved into CLDR. - // It is left in its current state as a regression test. -// if (isICUVersionAtLeast(ICU_39)) { -// // We temporarily filter against Unicode 4.1, but we only do this -// // before version 3.4. -// errln("FAIL: TestInterIndic needs to be updated to remove delete the [:Age=4.1:] filter "); -// return; -// } else { -// logln("Warning: TestInterIndic needs to be updated to remove delete the section marked [:Age=4.1:] filter"); -// } for(int i = 0; i < num;i++){ RTTest test(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 0]); Legal *legal = new LegalIndic(); logln(UnicodeString("Stress testing ") + interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 0]); - /* Uncomment lines below when transliterator is fixed */ - /* + if( !logKnownIssue( "cldrbug:1911" ) ) { + /* "full test" */ + // CLDR bug #1911: This test should be moved into CLDR. test.test( interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1], interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2], interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions this, quick, legal, 50); - */ - /* comment lines below when transliterator is fixed */ + } else { + // It is left in its current state as a regression test. + // CLDR should test, and remove the age filter. + /* regression test - ""temporary"" until CLDR#1911 is fixed */ // start UnicodeString source("["); source.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1]); @@ -1697,12 +1646,13 @@ void TransliteratorRoundTripTest::TestInterIndic() { UnicodeString target("["); target.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2]); target.append(" & [:Age=4.1:]]"); - test.test( source, - target, + test.test( source, + target, interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions this, quick, legal, 50); // end delete legal; + } } } diff --git a/icu4c/source/tools/ctestfw/ctest.c b/icu4c/source/tools/ctestfw/ctest.c index b6b9b3ccbc5..a09bb19efba 100644 --- a/icu4c/source/tools/ctestfw/ctest.c +++ b/icu4c/source/tools/ctestfw/ctest.c @@ -519,7 +519,7 @@ runTests ( const TestNode *root ) ON_LINE=FALSE; /* just in case */ if(knownList != NULL) { - if( udbg_knownIssue_print(knownList, NULL) ) { + if( udbg_knownIssue_print(knownList) ) { fprintf(stdout, "(To run suppressed tests, use the -K option.) \n\n"); } udbg_knownIssue_close(knownList); @@ -694,7 +694,7 @@ static void vlog_err(const char *prefix, const char *pattern, va_list ap) static UBool vlog_knownIssue(const char *ticket, const char *pattern, va_list ap) { - char buf[2048], url[1024]; + char buf[2048]; UBool firstForTicket; UBool firstForWhere; diff --git a/icu4c/source/tools/toolutil/udbgutil.cpp b/icu4c/source/tools/toolutil/udbgutil.cpp index 8b6e55d9472..8d86115da1c 100644 --- a/icu4c/source/tools/toolutil/udbgutil.cpp +++ b/icu4c/source/tools/toolutil/udbgutil.cpp @@ -11,35 +11,36 @@ #include "putilimp.h" #include "unicode/ulocdata.h" #include "unicode/ucnv.h" +#include "unicode/unistr.h" /* -To add a new enum type +To add a new enum type (For example: UShoeSize with values USHOE_WIDE=0, USHOE_REGULAR, USHOE_NARROW, USHOE_COUNT) 1. udbgutil.h: add UDBG_UShoeSize to the UDebugEnumType enum before UDBG_ENUM_COUNT ( The subsequent steps involve this file, udbgutil.cpp ) 2. Find the marker "Add new enum types above this line" 3. Before that marker, add a #include of any header file you need. - 4. Each enum type has three things in this section: a #define, a count_, and an array of Fields. + 4. Each enum type has three things in this section: a #define, a count_, and an array of Fields. It may help to copy and paste a previous definition. 5. In the case of the USHOE_... strings above, "USHOE_" is common to all values- six characters - " #define LEN_USHOE 6 " + " #define LEN_USHOE 6 " 6 characters will strip off "USHOE_" leaving enum values of WIDE, REGULAR, and NARROW. - 6. Define the 'count_' variable, with the number of enum values. If the enum has a _MAX or _COUNT value, + 6. Define the 'count_' variable, with the number of enum values. If the enum has a _MAX or _COUNT value, that can be helpful for automatically defining the count. Otherwise define it manually. " static const int32_t count_UShoeSize = USHOE_COUNT; " 7. Define the field names, in order. " static const Field names_UShoeSize[] = { - " FIELD_NAME_STR( LEN_USHOE, USHOE_WIDE ), - " FIELD_NAME_STR( LEN_USHOE, USHOE_REGULAR ), - " FIELD_NAME_STR( LEN_USHOE, USHOE_NARROW ), + " FIELD_NAME_STR( LEN_USHOE, USHOE_WIDE ), + " FIELD_NAME_STR( LEN_USHOE, USHOE_REGULAR ), + " FIELD_NAME_STR( LEN_USHOE, USHOE_NARROW ), " }; ( The following command was usedfor converting ucol.h into partially correct entities ) - grep "^[ ]*UCOL" < unicode/ucol.h | - sed -e 's%^[ ]*\([A-Z]*\)_\([A-Z_]*\).*% FIELD_NAME_STR( LEN_\1, \1_\2 ),%g' + grep "^[ ]*UCOL" < unicode/ucol.h | + sed -e 's%^[ ]*\([A-Z]*\)_\([A-Z_]*\).*% FIELD_NAME_STR( LEN_\1, \1_\2 ),%g' 8. Now, a bit farther down, add the name of the enum itself to the end of names_UDebugEnumType ( UDebugEnumType is an enum, too!) - names_UDebugEnumType[] { ... + names_UDebugEnumType[] { ... " FIELD_NAME_STR( LEN_UDBG, UDBG_UShoeSize ), " 9. Find the function _udbg_enumCount and add the count macro: " COUNT_CASE(UShoeSize) @@ -80,7 +81,7 @@ struct Field { // 'UCAL_' = 5 #define LEN_UCAL 5 /* UCAL_ */ static const int32_t count_UCalendarDateFields = UCAL_FIELD_COUNT; -static const Field names_UCalendarDateFields[] = +static const Field names_UCalendarDateFields[] = { FIELD_NAME_STR( LEN_UCAL, UCAL_ERA ), FIELD_NAME_STR( LEN_UCAL, UCAL_YEAR ), @@ -109,7 +110,7 @@ static const Field names_UCalendarDateFields[] = static const int32_t count_UCalendarMonths = UCAL_UNDECIMBER+1; -static const Field names_UCalendarMonths[] = +static const Field names_UCalendarMonths[] = { FIELD_NAME_STR( LEN_UCAL, UCAL_JANUARY ), FIELD_NAME_STR( LEN_UCAL, UCAL_FEBRUARY ), @@ -130,7 +131,7 @@ static const Field names_UCalendarMonths[] = #define LEN_UDAT 5 /* "UDAT_" */ static const int32_t count_UDateFormatStyle = UDAT_SHORT+1; -static const Field names_UDateFormatStyle[] = +static const Field names_UDateFormatStyle[] = { FIELD_NAME_STR( LEN_UDAT, UDAT_FULL ), FIELD_NAME_STR( LEN_UDAT, UDAT_LONG ), @@ -145,12 +146,12 @@ static const Field names_UDateFormatStyle[] = }; #endif - + #include "unicode/uloc.h" #define LEN_UAR 12 /* "ULOC_ACCEPT_" */ static const int32_t count_UAcceptResult = 3; -static const Field names_UAcceptResult[] = +static const Field names_UAcceptResult[] = { FIELD_NAME_STR( LEN_UAR, ULOC_ACCEPT_FAILED ), FIELD_NAME_STR( LEN_UAR, ULOC_ACCEPT_VALID ), @@ -204,7 +205,7 @@ static const Field names_UPlugLevel[] = { #define LEN_UDBG 5 /* "UDBG_" */ static const int32_t count_UDebugEnumType = UDBG_ENUM_COUNT; -static const Field names_UDebugEnumType[] = +static const Field names_UDebugEnumType[] = { FIELD_NAME_STR( LEN_UDBG, UDBG_UDebugEnumType ), #if !UCONFIG_NO_FORMATTING @@ -286,7 +287,7 @@ int32_t udbg_enumExpectedCount(UDebugEnumType type) { } const char * udbg_enumName(UDebugEnumType type, int32_t field) { - if(field<0 || + if(field<0 || field>=_udbg_enumCount(type,FALSE)) { // also will catch unsupported items return NULL; } else { @@ -300,7 +301,7 @@ const char * udbg_enumName(UDebugEnumType type, int32_t field) { } int32_t udbg_enumArrayValue(UDebugEnumType type, int32_t field) { - if(field<0 || + if(field<0 || field>=_udbg_enumCount(type,FALSE)) { // also will catch unsupported items return -1; } else { @@ -310,7 +311,7 @@ int32_t udbg_enumArrayValue(UDebugEnumType type, int32_t field) { } else { return fields[field].num; } - } + } } int32_t udbg_enumByName(UDebugEnumType type, const char *value) { @@ -321,21 +322,21 @@ int32_t udbg_enumByName(UDebugEnumType type, const char *value) { for(int32_t field = 0;field<_udbg_enumCount(type, FALSE);field++) { if(!strcmp(value, fields[field].str + fields[field].prefix)) { return fields[field].num; - } + } } // try with the prefix for(int32_t field = 0;field<_udbg_enumCount(type, FALSE);field++) { if(!strcmp(value, fields[field].str)) { return fields[field].num; - } + } } // fail return -1; } /* platform info */ -/** - * Print the current platform +/** + * Print the current platform */ U_CAPI const char *udbg_getPlatform(void) { @@ -396,7 +397,7 @@ paramStatic(const USystemParams *param, char *target, int32_t targetCapacity, UE static const char *nullString = "(null)"; static int32_t stringToStringBuffer(char *target, int32_t targetCapacity, const char *str, UErrorCode *status) { - if(str==NULL) str=nullString; + if(str==NULL) str=nullString; int32_t len = uprv_strlen(str); if (U_SUCCESS(*status)) { @@ -461,7 +462,7 @@ paramTimezoneDefault(const USystemParams * /* param */, char *target, int32_t ta UChar buf[100]; char buf2[100]; int32_t len; - + len = ucal_getDefaultTimeZone(buf, 100, status); if(U_SUCCESS(*status)&&len>0) { u_UCharsToChars(buf, buf2, len+1); @@ -513,12 +514,12 @@ static const USystemParams systemParams[] = { { "icudata.path", paramIcudataPath, NULL, 0}, { "cldr.version", paramCldrVersion, NULL, 0}, - + #if !UCONFIG_NO_FORMATTING { "tz.version", paramTimezoneVersion, NULL, 0}, { "tz.default", paramTimezoneDefault, NULL, 0}, #endif - + { "cpu.bits", paramInteger, "d", (sizeof(void*))*8}, { "cpu.big_endian", paramInteger, "b", U_IS_BIG_ENDIAN}, { "os.wchar_width", paramInteger, "d", U_SIZEOF_WCHAR_T}, @@ -625,7 +626,7 @@ U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, co return (void*)warning; } -U_CAPI UBool udbg_knownIssue_print(void *ptr, FILE *output) { +U_CAPI UBool udbg_knownIssue_print(void *ptr) { puts(warning); return FALSE; } @@ -647,9 +648,9 @@ public: ~KnownIssues(); void add(const char *ticket, const char *where, const UChar *msg, UBool *firstForTicket, UBool *firstForWhere); void add(const char *ticket, const char *where, const char *msg, UBool *firstForTicket, UBool *firstForWhere); - UBool print(FILE *output) ; + UBool print(); private: - std::map< std::string, + std::map< std::string, std::map < std::string, std::set < std::string > > > fTable; }; @@ -706,7 +707,7 @@ void KnownIssues::add(const char *ticket, const char *where, const char *msg, UB fTable[ticket][where].insert(str); } -UBool KnownIssues::print(FILE *output) +UBool KnownIssues::print() { if(fTable.empty()) { return FALSE; @@ -758,12 +759,12 @@ U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, co return static_cast(t); } -U_CAPI UBool udbg_knownIssue_print(void *ptr, FILE *output) { +U_CAPI UBool udbg_knownIssue_print(void *ptr) { KnownIssues *t = static_cast(ptr); if(t==NULL) { return FALSE; } else { - t->print(output); + t->print(); return TRUE; } } diff --git a/icu4c/source/tools/toolutil/udbgutil.h b/icu4c/source/tools/toolutil/udbgutil.h index b47d4e636ad..e8590b1552f 100644 --- a/icu4c/source/tools/toolutil/udbgutil.h +++ b/icu4c/source/tools/toolutil/udbgutil.h @@ -23,9 +23,9 @@ enum UDebugEnumType { UDBG_UPlugReason, /* Count = UPLUG_REASON_COUNT */ UDBG_UPlugLevel, /* COUNT = UPLUG_LEVEL_COUNT */ UDBG_UAcceptResult, /* Count = ULOC_ACCEPT_FALLBACK+1=3 */ - - /* All following enums may be discontiguous. */ - + + /* All following enums may be discontiguous. */ + #if !UCONFIG_NO_COLLATION UDBG_UColAttributeValue, /* UCOL_ATTRIBUTE_VALUE_COUNT */ #endif @@ -38,7 +38,7 @@ typedef enum UDebugEnumType UDebugEnumType; /** * @param type the type of enum - * Print how many enums are contained for this type. + * Print how many enums are contained for this type. * Should be equal to the appropriate _COUNT constant or there is an error. Return -1 if unsupported. */ U_CAPI int32_t U_EXPORT2 udbg_enumCount(UDebugEnumType type); @@ -54,13 +54,13 @@ U_CAPI const char * U_EXPORT2 udbg_enumName(UDebugEnumType type, int32_t field); /** * for consistency checking * @param type the type of enum - * Print how many enums should be contained for this type. + * Print how many enums should be contained for this type. * This is equal to the appropriate _COUNT constant or there is an error. Returns -1 if unsupported. */ U_CAPI int32_t U_EXPORT2 udbg_enumExpectedCount(UDebugEnumType type); /** - * For consistency checking, returns the expected enum ordinal value for the given index value. + * For consistency checking, returns the expected enum ordinal value for the given index value. * @param type which type * @param field field number * @return should be equal to 'field' or -1 if out of range. @@ -68,7 +68,7 @@ U_CAPI int32_t U_EXPORT2 udbg_enumExpectedCount(UDebugEnumType type); U_CAPI int32_t U_EXPORT2 udbg_enumArrayValue(UDebugEnumType type, int32_t field); /** - * Locate the specified field value by name. + * Locate the specified field value by name. * @param type which type * @param name name of string (case sensitive) * @return should be a field value or -1 if not found. @@ -135,12 +135,11 @@ U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, co UBool *firstForWhere); /** - * Print 'known issue' table. + * Print 'known issue' table, to std::cout. * @param ptr pointer from udbg_knownIssue - * @param output file to print to * @return TRUE if there were any issues. */ -U_CAPI UBool udbg_knownIssue_print(void *ptr, FILE *output); +U_CAPI UBool udbg_knownIssue_print(void *ptr); /** * Close 'known issue' table.