From 6c952cb83d2f5f677411097791ef0f65154838d8 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Mon, 23 Jun 2003 23:16:10 +0000 Subject: [PATCH] ICU-3053 Porting changes for MPRAS X-SVN-Rev: 12552 --- icu4c/source/aclocal.m4 | 1 + icu4c/source/configure.in | 5 +++-- icu4c/source/test/intltest/apicoll.cpp | 2 +- icu4c/source/test/intltest/calregts.cpp | 16 ++++++++++------ icu4c/source/test/intltest/numfmtst.cpp | 8 +++++--- icu4c/source/test/intltest/transapi.cpp | 14 +++++++++----- icu4c/source/test/intltest/transrt.cpp | 6 +++--- icu4c/source/test/intltest/transtst.cpp | 11 +++++++++-- icu4c/source/test/intltest/tzbdtest.cpp | 6 +++++- icu4c/source/test/intltest/tzregts.cpp | 18 ++++++++++++++---- icu4c/source/test/intltest/tztest.cpp | 7 ++++++- 11 files changed, 66 insertions(+), 28 deletions(-) diff --git a/icu4c/source/aclocal.m4 b/icu4c/source/aclocal.m4 index c1313455b12..255dd0a7a88 100644 --- a/icu4c/source/aclocal.m4 +++ b/icu4c/source/aclocal.m4 @@ -55,6 +55,7 @@ alpha*-*-linux-gnu) *-*-irix*) icu_cv_host_frag=mh-irix ;; *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;; *-*-nto*) icu_cv_host_frag=mh-qnx ;; +*-ncr-*) icu_cv_host_frag=mh-mpras ;; *-sequent-*) icu_cv_host_frag=mh-ptx ;; *) icu_cv_host_frag=mh-unknown ;; esac diff --git a/icu4c/source/configure.in b/icu4c/source/configure.in index bf2041d3bbc..d7095f3b6db 100644 --- a/icu4c/source/configure.in +++ b/icu4c/source/configure.in @@ -4,7 +4,7 @@ dnl Copyright (c) 1999-2003, International Business Machines Corporation and dnl others. All Rights Reserved. dnl Stephen F. Booth, heavily modified by Yves and others -dnl $Id: configure.in,v 1.193 2003/06/23 03:11:06 grhoten-oss Exp $ +dnl $Id: configure.in,v 1.194 2003/06/23 23:16:10 grhoten-oss Exp $ dnl Process this file with autoconf to produce a configure script AC_INIT(common/unicode/utypes.h) @@ -826,7 +826,8 @@ case "${host}" in *-*-nto*) platform=U_QNX ;; *-dec-osf*) platform=U_OSF ;; *-*-beos) platform=U_BEOS ;; - *-*-irix*) platform=IRIX ;; + *-*-irix*) platform=IRIX ;; + *-ncr-*) platform=U_MPRAS ;; *-sequent-*) platform=PTX ;; *) platform=U_UNKNOWN_PLATFORM ;; esac diff --git a/icu4c/source/test/intltest/apicoll.cpp b/icu4c/source/test/intltest/apicoll.cpp index 360817a58dd..f07b5a0d4bf 100644 --- a/icu4c/source/test/intltest/apicoll.cpp +++ b/icu4c/source/test/intltest/apicoll.cpp @@ -1498,7 +1498,7 @@ void CollationAPITest::TestGetLocale() { /* completely non-existant locale for collator should get a default collator */ { - Collator *defaultColl = Collator::createInstance(NULL, status); + Collator *defaultColl = Collator::createInstance((const Locale)NULL, status); coll = Collator::createInstance("blahaha", status); if(U_FAILURE(status)) { log("Failed to open collator with %s\n", u_errorName(status)); diff --git a/icu4c/source/test/intltest/calregts.cpp b/icu4c/source/test/intltest/calregts.cpp index 5310e9c8700..9615b8b9c86 100644 --- a/icu4c/source/test/intltest/calregts.cpp +++ b/icu4c/source/test/intltest/calregts.cpp @@ -1068,9 +1068,14 @@ void CalendarRegressionTest::test4103271() UDate got = testCal->getTime(status); str.remove(); str2.remove(); - log((ADDROLL_bool[i/2]? UnicodeString("add(WOY,"):UnicodeString("roll(WOY,")) + - amount + ") " + sdf.format(before, str) + " => " + - sdf.format(got, str2)); + UnicodeString opTypeStr; + if (ADDROLL_bool[i/2]) { + opTypeStr = UnicodeString("add(WOY,", ""); + } else { + opTypeStr = UnicodeString("roll(WOY,", ""); + } + log(opTypeStr + amount + ") " + sdf.format(before, str) + " => " + + sdf.format(got, str2)); if (after != got) { str.remove(); logln(UnicodeString(" exp:") + sdf.format(after, str) + " FAIL"); @@ -1086,9 +1091,8 @@ void CalendarRegressionTest::test4103271() got = testCal->getTime(status); str.remove(); str2.remove(); - log((ADDROLL_bool[i/2]?UnicodeString("add(WOY,"):UnicodeString("roll(WOY,")) + - (-amount) + ") " + sdf.format(after, str) + " => " + - sdf.format(got, str2)); + log(opTypeStr + (-amount) + ") " + sdf.format(after, str) + " => " + + sdf.format(got, str2)); if (before != got) { str.remove(); logln(UnicodeString(" exp:") + sdf.format(before, str) + " FAIL"); diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp index 5a5998808a6..4946e52d08f 100644 --- a/icu4c/source/test/intltest/numfmtst.cpp +++ b/icu4c/source/test/intltest/numfmtst.cpp @@ -1503,9 +1503,11 @@ void NumberFormatTest::expectPad(DecimalFormat& fmt, const UnicodeString& pat, apadStr = pad; } if (apos == pos && awidth == width && apadStr == pad) { - logln(UnicodeString("Ok \"") + pat + "\" pos=" + apos + - ((pos == ILLEGAL) ? UnicodeString() : - (UnicodeString(" width=") + awidth + " pad=" + apadStr))); + UnicodeString infoStr; + if (pos == ILLEGAL) { + infoStr = UnicodeString(" width=", "") + awidth + UnicodeString(" pad=", "") + apadStr; + } + logln(UnicodeString("Ok \"") + pat + "\" pos=" + apos + infoStr); } else { errln(UnicodeString("FAIL \"") + pat + "\" pos=" + apos + " width=" + awidth + " pad=" + apadStr + diff --git a/icu4c/source/test/intltest/transapi.cpp b/icu4c/source/test/intltest/transapi.cpp index 5146784c22c..092c7ba1a16 100644 --- a/icu4c/source/test/intltest/transapi.cpp +++ b/icu4c/source/test/intltest/transapi.cpp @@ -408,12 +408,16 @@ void TransliteratorAPITest::TestSimpleKeyboardTransliterator(){ UParseError parseError; Transliterator* t=Transliterator::createInstance("Any-Hex", UTRANS_FORWARD, parseError, status); if(t == 0) { + UnicodeString context; + + if (parseError.preContext[0]) { + context += (UnicodeString)" at " + parseError.preContext; + } + if (parseError.postContext[0]) { + context += (UnicodeString)" | " + parseError.postContext; + } errln((UnicodeString)"FAIL: can't create Any-Hex, " + - (UnicodeString)u_errorName(status) + - (parseError.preContext[0] ? - ((UnicodeString)" at " + parseError.preContext + - (parseError.postContext[0] ? - ((UnicodeString)" | " + parseError.postContext) : (UnicodeString)"")) : (UnicodeString)"")); + (UnicodeString)u_errorName(status) + context); return; } UTransPosition index={19,20,20,20}; diff --git a/icu4c/source/test/intltest/transrt.cpp b/icu4c/source/test/intltest/transrt.cpp index b29dc7dfc18..4e724c77df5 100644 --- a/icu4c/source/test/intltest/transrt.cpp +++ b/icu4c/source/test/intltest/transrt.cpp @@ -564,7 +564,7 @@ void RTTest::test2(UBool quickRt, int32_t density) { TransliteratorPointer sourceToTarget( Transliterator::createInstance(transliteratorID, UTRANS_FORWARD, parseError, status)); - if (sourceToTarget == NULL) { + if ((const Transliterator *)sourceToTarget == NULL) { parent->errln("FAIL: createInstance(" + transliteratorID + ") returned NULL. Error: " + u_errorName(status) + "\n\tpreContext : " + prettify(parseError.preContext) @@ -573,7 +573,7 @@ void RTTest::test2(UBool quickRt, int32_t density) { return; } TransliteratorPointer targetToSource(sourceToTarget->createInverse(status)); - if (targetToSource == NULL) { + if ((const Transliterator *)targetToSource == NULL) { parent->errln("FAIL: " + transliteratorID + ".createInverse() returned NULL. Error:" + u_errorName(status) + "\n\tpreContext : " + prettify(parseError.preContext) @@ -1174,7 +1174,7 @@ void TransliteratorRoundTripTest::TestDevanagariLatin() { { UErrorCode status = U_ZERO_ERROR; TransliteratorPointer t1(Transliterator::createInstance("[\\u0000-\\u00FE \\u0982\\u0983 [:Bengali:][:nonspacing mark:]];NFD;Bengali-InterIndic;InterIndic-Gujarati;NFC;( [ \\u0000-\\u00FE [:Gujarati:][[:nonspacing mark:]])",UTRANS_FORWARD, status)); - if(t1){ + if((const Transliterator *)t1 != NULL){ TransliteratorPointer t2(t1->createInverse(status)); if(U_FAILURE(status)){ errln("FAIL: could not create the Inverse:-( \n"); diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index 7793f48dd01..91dd717a824 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -2250,15 +2250,22 @@ void TransliteratorTest::TestCompoundFilterID(void) { t = Transliterator::createInstance(id, direction, pe, ec); } UBool ok = (t != NULL && U_SUCCESS(ec)); + UnicodeString transID; + if (t!=0) { + transID = t->getID(); + } + else { + transID = UnicodeString("NULL", ""); + } if (ok == expOk) { - logln((UnicodeString)"Ok: " + id + " => " + (t!=0?t->getID():(UnicodeString)"NULL") + ", " + + logln((UnicodeString)"Ok: " + id + " => " + transID + ", " + u_errorName(ec)); if (source.length() != 0) { expect(*t, source, exp); } delete t; } else { - errln((UnicodeString)"FAIL: " + id + " => " + (t!=0?t->getID():(UnicodeString)"NULL") + ", " + + errln((UnicodeString)"FAIL: " + id + " => " + transID + ", " + u_errorName(ec)); } } diff --git a/icu4c/source/test/intltest/tzbdtest.cpp b/icu4c/source/test/intltest/tzbdtest.cpp index 887226cec16..3e5c281d52f 100644 --- a/icu4c/source/test/intltest/tzbdtest.cpp +++ b/icu4c/source/test/intltest/tzbdtest.cpp @@ -175,7 +175,11 @@ TimeZoneBoundaryTest::showDate(UDate d) UnicodeString TimeZoneBoundaryTest::showNN(int32_t n) { - return ((n < 10) ? UnicodeString("0"): UnicodeString("")) + n; + UnicodeString nStr; + if (n < 10) { + nStr += UnicodeString("0", ""); + } + return nStr + n; } // ------------------------------------- diff --git a/icu4c/source/test/intltest/tzregts.cpp b/icu4c/source/test/intltest/tzregts.cpp index dc07ddf102d..47519e4b2fe 100644 --- a/icu4c/source/test/intltest/tzregts.cpp +++ b/icu4c/source/test/intltest/tzregts.cpp @@ -486,7 +486,7 @@ void TimeZoneRegressionTest:: Test4151406() { // h is in half-hours from GMT; rawoffset is in millis int32_t rawoffset = h * 1800000; int32_t hh = (h<0) ? -h : h; - UnicodeString hname = ((h<0) ? UnicodeString("GMT-") : UnicodeString("GMT+")) + + UnicodeString hname = UnicodeString((h<0) ? "GMT-" : "GMT+") + ((hh/2 < 10) ? "0" : "") + (hh/2) + ':' + ((hh%2==0) ? "00" : "30"); @@ -497,8 +497,11 @@ void TimeZoneRegressionTest:: Test4151406() { count = ids->count(ec); if (count> max) max = count; - logln(hname + ' ' + count + - ((count > 0) ? (" e.g. " + *ids->snext(ec)) : UnicodeString(""))); + if (count > 0) { + logln(hname + ' ' + (UnicodeString)count + (UnicodeString)" e.g. " + *ids->snext(ec)); + } else { + logln(hname + ' ' + count); + } // weiv 11/27/2002: why uprv_free? This should be a delete delete ids; //delete [] ids; @@ -795,10 +798,17 @@ TimeZoneRegressionTest::Test4154650() // e = ex; //} if(good != U_SUCCESS(status)) { + UnicodeString errMsg; + if (good) { + errMsg = (UnicodeString(") threw ") + u_errorName(status)); + } + else { + errMsg = UnicodeString(") accepts invalid args", ""); + } errln(UnicodeString("Fail: getOffset(") + DATA[i+1] + ", " + DATA[i+2] + ", " + DATA[i+3] + ", " + DATA[i+4] + ", " + DATA[i+5] + ", " + DATA[i+6] + - (good ? (UnicodeString(") threw ") + u_errorName(status)) : UnicodeString(") accepts invalid args"))); + errMsg); } status = U_ZERO_ERROR; // reset } diff --git a/icu4c/source/test/intltest/tztest.cpp b/icu4c/source/test/intltest/tztest.cpp index 89f87f6cafa..5cff2b4eed6 100644 --- a/icu4c/source/test/intltest/tztest.cpp +++ b/icu4c/source/test/intltest/tztest.cpp @@ -795,7 +795,12 @@ TimeZoneTest::TestDisplayName() zone2->setStartRule(UCAL_JANUARY, 1, 0, 0, status); zone2->setEndRule(UCAL_DECEMBER, 31, 0, 0, status); - UnicodeString inDaylight = (zone2->inDaylightTime(UDate(0), status)? UnicodeString("TRUE"):UnicodeString("FALSE")); + UnicodeString inDaylight; + if (zone2->inDaylightTime(UDate(0), status)) { + inDaylight = UnicodeString("TRUE"); + } else { + inDaylight = UnicodeString("FALSE"); + } logln(UnicodeString("Modified PST inDaylightTime->") + inDaylight ); if(U_FAILURE(status)) {