ICU-3053 Porting changes for MPRAS

X-SVN-Rev: 12552
This commit is contained in:
George Rhoten 2003-06-23 23:16:10 +00:00
parent 7f089f902c
commit 6c952cb83d
11 changed files with 66 additions and 28 deletions

View file

@ -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

View file

@ -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

View file

@ -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));

View file

@ -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");

View file

@ -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 +

View file

@ -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};

View file

@ -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");

View file

@ -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));
}
}

View file

@ -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;
}
// -------------------------------------

View file

@ -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
}

View file

@ -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))
{