mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-10786 Ensure ICU 53 passes without data
X-SVN-Rev: 35462
This commit is contained in:
parent
2f0f40c29a
commit
c70512bdfe
10 changed files with 66 additions and 42 deletions
|
@ -284,6 +284,14 @@ TimeUnitFormat::parseObject(const UnicodeString& source,
|
|||
|
||||
void
|
||||
TimeUnitFormat::create(UTimeUnitFormatStyle style, UErrorCode& status) {
|
||||
// fTimeUnitToCountToPatterns[] must have its elements initialized to NULL first
|
||||
// before checking for failure status.
|
||||
for (TimeUnit::UTimeUnitFields i = TimeUnit::UTIMEUNIT_YEAR;
|
||||
i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
|
||||
i = (TimeUnit::UTimeUnitFields)(i+1)) {
|
||||
fTimeUnitToCountToPatterns[i] = NULL;
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
@ -292,11 +300,6 @@ TimeUnitFormat::create(UTimeUnitFormatStyle style, UErrorCode& status) {
|
|||
return;
|
||||
}
|
||||
fStyle = style;
|
||||
for (TimeUnit::UTimeUnitFields i = TimeUnit::UTIMEUNIT_YEAR;
|
||||
i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
|
||||
i = (TimeUnit::UTimeUnitFields)(i+1)) {
|
||||
fTimeUnitToCountToPatterns[i] = NULL;
|
||||
}
|
||||
|
||||
//TODO: format() and parseObj() are const member functions,
|
||||
//so, can not do lazy initialization in C++.
|
||||
|
|
|
@ -3161,7 +3161,7 @@ void CalendarTest::TestAddAcrossZoneTransition() {
|
|||
char buf[32];
|
||||
const char *optDisp = AAZTDATA[i].skippedWTOpt == UCAL_WALLTIME_FIRST ? "FIRST" :
|
||||
AAZTDATA[i].skippedWTOpt == UCAL_WALLTIME_LAST ? "LAST" : "NEXT_VALID";
|
||||
errln(UnicodeString("Error: base:") + AAZTDATA[i].base.toString(buf, sizeof(buf)) + ", tz:" + AAZTDATA[i].zone
|
||||
dataerrln(UnicodeString("Error: base:") + AAZTDATA[i].base.toString(buf, sizeof(buf)) + ", tz:" + AAZTDATA[i].zone
|
||||
+ ", delta:" + AAZTDATA[i].deltaDays + " day(s), opt:" + optDisp
|
||||
+ ", result:" + res.toString(buf, sizeof(buf))
|
||||
+ " - expected:" + AAZTDATA[i].expected.toString(buf, sizeof(buf)));
|
||||
|
|
|
@ -192,7 +192,7 @@ void CollationTest::TestImplicits() {
|
|||
IcuTestErrorCode errorCode(*this, "TestImplicits");
|
||||
|
||||
const CollationData *cd = CollationRoot::getData(errorCode);
|
||||
if(errorCode.logIfFailureAndReset("CollationRoot::getBaseData()")) {
|
||||
if(errorCode.logDataIfFailureAndReset("CollationRoot::getBaseData()")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ void CollationTest::TestImplicits() {
|
|||
void CollationTest::TestNulTerminated() {
|
||||
IcuTestErrorCode errorCode(*this, "TestNulTerminated");
|
||||
const CollationData *data = CollationRoot::getData(errorCode);
|
||||
if(errorCode.logIfFailureAndReset("CollationRoot::getData()")) {
|
||||
if(errorCode.logDataIfFailureAndReset("CollationRoot::getData()")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -343,24 +343,25 @@ void CollationTest::TestShortFCDData() {
|
|||
diff = lccc;
|
||||
diff.removeAll(expectedLccc);
|
||||
diff.toPattern(diffString, TRUE);
|
||||
assertEquals("CollationFCD::hasLccc() actual-expected", empty, diffString);
|
||||
assertEquals("CollationFCD::hasLccc() actual-expected", empty, diffString, TRUE);
|
||||
|
||||
UnicodeSet expectedTccc("[:^tccc=0:]", errorCode);
|
||||
errorCode.assertSuccess();
|
||||
addLeadSurrogatesForSupplementary(expectedLccc, expectedTccc);
|
||||
addLeadSurrogatesForSupplementary(expectedTccc, expectedTccc);
|
||||
UnicodeSet tccc; // actual
|
||||
for(UChar32 c = 0; c <= 0xffff; ++c) {
|
||||
if(CollationFCD::hasTccc(c)) { tccc.add(c); }
|
||||
if (errorCode.isSuccess()) {
|
||||
addLeadSurrogatesForSupplementary(expectedLccc, expectedTccc);
|
||||
addLeadSurrogatesForSupplementary(expectedTccc, expectedTccc);
|
||||
UnicodeSet tccc; // actual
|
||||
for(UChar32 c = 0; c <= 0xffff; ++c) {
|
||||
if(CollationFCD::hasTccc(c)) { tccc.add(c); }
|
||||
}
|
||||
diff = expectedTccc;
|
||||
diff.removeAll(tccc);
|
||||
diff.remove(0x10000, 0x10ffff); // hasTccc() only works for the BMP
|
||||
assertEquals("CollationFCD::hasTccc() expected-actual", empty, diffString);
|
||||
diff = tccc;
|
||||
diff.removeAll(expectedTccc);
|
||||
diff.toPattern(diffString, TRUE);
|
||||
assertEquals("CollationFCD::hasTccc() actual-expected", empty, diffString);
|
||||
}
|
||||
diff = expectedTccc;
|
||||
diff.removeAll(tccc);
|
||||
diff.remove(0x10000, 0x10ffff); // hasTccc() only works for the BMP
|
||||
assertEquals("CollationFCD::hasTccc() expected-actual", empty, diffString);
|
||||
diff = tccc;
|
||||
diff.removeAll(expectedTccc);
|
||||
diff.toPattern(diffString, TRUE);
|
||||
assertEquals("CollationFCD::hasTccc() actual-expected", empty, diffString);
|
||||
}
|
||||
|
||||
class CodePointIterator {
|
||||
|
@ -432,7 +433,7 @@ void CollationTest::checkFCD(const char *name,
|
|||
void CollationTest::TestFCD() {
|
||||
IcuTestErrorCode errorCode(*this, "TestFCD");
|
||||
const CollationData *data = CollationRoot::getData(errorCode);
|
||||
if(errorCode.logIfFailureAndReset("CollationRoot::getData()")) {
|
||||
if(errorCode.logDataIfFailureAndReset("CollationRoot::getData()")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -737,7 +738,7 @@ private:
|
|||
void CollationTest::TestRootElements() {
|
||||
IcuTestErrorCode errorCode(*this, "TestRootElements");
|
||||
const CollationData *root = CollationRoot::getData(errorCode);
|
||||
if(errorCode.logIfFailureAndReset("CollationRoot::getData()")) {
|
||||
if(errorCode.logDataIfFailureAndReset("CollationRoot::getData()")) {
|
||||
return;
|
||||
}
|
||||
CollationRootElements rootElements(root->rootElements, root->rootElementsLength);
|
||||
|
@ -840,7 +841,7 @@ void CollationTest::TestRootElements() {
|
|||
void CollationTest::TestTailoredElements() {
|
||||
IcuTestErrorCode errorCode(*this, "TestTailoredElements");
|
||||
const CollationData *root = CollationRoot::getData(errorCode);
|
||||
if(errorCode.logIfFailureAndReset("CollationRoot::getData()")) {
|
||||
if(errorCode.logDataIfFailureAndReset("CollationRoot::getData()")) {
|
||||
return;
|
||||
}
|
||||
CollationRootElements rootElements(root->rootElements, root->rootElementsLength);
|
||||
|
@ -1712,7 +1713,7 @@ void CollationTest::TestDataDriven() {
|
|||
|
||||
fcd = Normalizer2Factory::getFCDInstance(errorCode);
|
||||
nfd = Normalizer2Factory::getNFDInstance(errorCode);
|
||||
if(errorCode.logIfFailureAndReset("Normalizer2Factory::getFCDInstance() or getNFDInstance()")) {
|
||||
if(errorCode.logDataIfFailureAndReset("Normalizer2Factory::getFCDInstance() or getNFDInstance()")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -803,7 +803,10 @@ void IntlTestDecimalFormatAPI::TestBadFastpath() {
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
LocalPointer<DecimalFormat> df(new DecimalFormat("###", status));
|
||||
TEST_ASSERT_STATUS(status);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating new DecimalFormat - %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
UnicodeString fmt;
|
||||
fmt.remove();
|
||||
|
|
|
@ -4373,7 +4373,11 @@ void DateFormatTest::TestParseMultiPatternMatch() {
|
|||
}
|
||||
const TestMultiPatternMatchItem * itemPtr;
|
||||
DateFormat* sdmft = DateFormat::createDateInstance();
|
||||
for (itemPtr = items; itemPtr->parseString != "--end--"; itemPtr++ ) {
|
||||
if (sdmft == NULL) {
|
||||
dataerrln(UnicodeString("FAIL: Unable to create DateFormat"));
|
||||
return;
|
||||
}
|
||||
for (itemPtr = items; itemPtr->parseString != "--end--"; itemPtr++ ) {
|
||||
status = U_ZERO_ERROR;
|
||||
ParsePosition pos(0);
|
||||
((SimpleDateFormat*) sdmft)->applyPattern(itemPtr->pattern);
|
||||
|
|
|
@ -729,8 +729,10 @@ void IntlTestSpoof::testRestrictionLevel() {
|
|||
uspoof_setRestrictionLevel(sc, levelSetInSpoofChecker);
|
||||
int32_t result = uspoof_checkUnicodeString(sc, testString, NULL, &status);
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_EQ(expectedLevel, result & USPOOF_RESTRICTION_LEVEL_MASK);
|
||||
TEST_ASSERT_EQ(expectedValue, result & USPOOF_ALL_CHECKS);
|
||||
if (U_SUCCESS(status)) {
|
||||
TEST_ASSERT_EQ(expectedLevel, result & USPOOF_RESTRICTION_LEVEL_MASK);
|
||||
TEST_ASSERT_EQ(expectedValue, result & USPOOF_ALL_CHECKS);
|
||||
}
|
||||
uspoof_close(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -428,7 +428,8 @@ void MeasureFormatTest::TestFormatPeriodEn() {
|
|||
|
||||
Locale en(Locale::getEnglish());
|
||||
LocalPointer<NumberFormat> nf(NumberFormat::createInstance(en, status));
|
||||
if (!assertSuccess("Error creating number format en object", status)) {
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating number format en object - %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
nf->setMaximumFractionDigits(4);
|
||||
|
@ -495,7 +496,8 @@ void MeasureFormatTest::Test10219FractionalPlurals() {
|
|||
for (int i = 0; i < LENGTHOF(expected[j]); i++) {
|
||||
DecimalFormat *df =
|
||||
(DecimalFormat *) NumberFormat::createInstance(en, status);
|
||||
if (!assertSuccess("Error creating Number format", status)) {
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating Number format - %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
df->setRoundingMode(DecimalFormat::kRoundDown);
|
||||
|
@ -844,12 +846,15 @@ void MeasureFormatTest::TestEquality() {
|
|||
NumberFormat* nfeq = NumberFormat::createInstance("en", status);
|
||||
NumberFormat* nfne = NumberFormat::createInstance("fr", status);
|
||||
MeasureFormat fmt("en", UMEASFMT_WIDTH_SHORT, status);
|
||||
MeasureFormat fmtEq(fmt);
|
||||
MeasureFormat fmtEq2("en", UMEASFMT_WIDTH_SHORT, nfeq, status);
|
||||
MeasureFormat fmtne1("en", UMEASFMT_WIDTH_WIDE, status);
|
||||
MeasureFormat fmtne2("fr", UMEASFMT_WIDTH_SHORT, status);
|
||||
MeasureFormat fmtne3("en", UMEASFMT_WIDTH_SHORT, nfne, status);
|
||||
assertSuccess("Error creating MeasureFormats", status);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating MeasureFormats - %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
MeasureFormat fmtEq(fmt);
|
||||
assertTrue("Equal", fmt == fmtEq);
|
||||
assertTrue("Equal2", fmt == fmtEq2);
|
||||
assertFalse("Equal Neg", fmt != fmtEq);
|
||||
|
@ -867,13 +872,17 @@ void MeasureFormatTest::TestDoubleZero() {
|
|||
Measure(16, MeasureUnit::createSecond(status), status)};
|
||||
Locale en("en");
|
||||
NumberFormat *nf = NumberFormat::createInstance(en, status);
|
||||
nf->setMinimumFractionDigits(2);
|
||||
nf->setMaximumFractionDigits(2);
|
||||
MeasureFormat fmt("en", UMEASFMT_WIDTH_WIDE, nf, status);
|
||||
UnicodeString appendTo;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating formatter - %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
nf->setMinimumFractionDigits(2);
|
||||
nf->setMaximumFractionDigits(2);
|
||||
fmt.formatMeasures(measures, LENGTHOF(measures), appendTo, pos, status);
|
||||
if (!assertSuccess("Error creating formatter and formatting", status)) {
|
||||
if (!assertSuccess("Error formatting", status)) {
|
||||
return;
|
||||
}
|
||||
assertEquals(
|
||||
|
|
|
@ -1558,7 +1558,7 @@ void MultithreadTest::TestAnyTranslit() {
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
LocalPointer<Transliterator> tx(Transliterator::createInstance("Any-Latin", UTRANS_FORWARD, status));
|
||||
if (U_FAILURE(status)) {
|
||||
errln("File %s, Line %d: Error, status = %s", __FILE__, __LINE__, u_errorName(status));
|
||||
dataerrln("File %s, Line %d: Error, status = %s", __FILE__, __LINE__, u_errorName(status));
|
||||
return;
|
||||
}
|
||||
TxThread * threads[4];
|
||||
|
|
|
@ -50,7 +50,9 @@ UCAConformanceTest::~UCAConformanceTest()
|
|||
{
|
||||
delete UCA;
|
||||
delete rbUCA;
|
||||
fclose(testFile);
|
||||
if (testFile) {
|
||||
fclose(testFile);
|
||||
}
|
||||
}
|
||||
|
||||
void UCAConformanceTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par */)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 2002-2010, International Business Machines Corporation and
|
||||
* Copyright (c) 2002-2014, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
|
@ -62,7 +62,7 @@ void IcuTestErrorCode::handleFailure() const {
|
|||
UnicodeString msg(testName, -1, US_INV);
|
||||
msg.append(UNICODE_STRING_SIMPLE(" failure: ")).append(UnicodeString(errorName(), -1, US_INV));
|
||||
|
||||
if (get() == U_MISSING_RESOURCE_ERROR) {
|
||||
if (get() == U_MISSING_RESOURCE_ERROR || get() == U_FILE_ACCESS_ERROR) {
|
||||
testClass.dataerrln(msg);
|
||||
} else {
|
||||
testClass.errln(msg);
|
||||
|
|
Loading…
Add table
Reference in a new issue