+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2010, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
}
UBool
-ParsePositionTest::failure(UErrorCode status, const char* msg)
+ParsePositionTest::failure(UErrorCode status, const char* msg, UBool possibleDataError)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ } else {
+ errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ }
return TRUE;
}
errln("*** PP operator= operator== or operator != result");
}
+ ParsePosition *ppp = pp5.clone();
+ if(ppp == &pp5 || *ppp != pp5) {
+ errln("ParsePosition.clone() failed");
+ }
+ delete ppp;
}
void ParsePositionTest::TestFieldPosition()
}
logln("");
+
+ FieldPosition *pfp = fp.clone();
+ if(pfp == &fp || *pfp != fp) {
+ errln("FieldPosition.clone() failed");
+ }
+ delete pfp;
}
void ParsePositionTest::TestFieldPosition_example()
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nf = NumberFormat::createInstance(status);
- failure(status, "NumberFormat::createInstance");
+ if (failure(status, "NumberFormat::createInstance", TRUE)){
+ delete nf;
+ return;
+ }
- if(nf->getDynamicClassID() != DecimalFormat::getStaticClassID()) {
+ DecimalFormat *fmt = dynamic_cast<DecimalFormat *>(nf);
+ if(fmt == NULL) {
errln("NumberFormat::createInstance returned unexpected class type");
return;
}
- DecimalFormat *fmt = (DecimalFormat*) nf;
fmt->setDecimalSeparatorAlwaysShown(TRUE);
const int tempLen = 20;