本文整理汇总了C++中errln函数的典型用法代码示例。如果您正苦于以下问题:C++ errln函数的具体用法?C++ errln怎么用?C++ errln使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了errln函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test1684Data
void DateFormatRegressionTest::Test1684(void)
{
// July 2001 August 2001 January 2002
// Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
// 1 2 3 4 5 6 7 1 2 3 4 1 2 3 4 5
// 8 9 10 11 12 13 14 5 6 7 8 9 10 11 6 7 8 9 10 11 12
// 15 16 17 18 19 20 21 12 13 14 15 16 17 18 13 14 15 16 17 18 19
// 22 23 24 25 26 27 28 19 20 21 22 23 24 25 20 21 22 23 24 25 26
// 29 30 31 26 27 28 29 30 31 27 28 29 30 31
Test1684Data *tests[] = {
new Test1684Data(2001, 8, 6, 2001,8,2,UCAL_MONDAY, "2001 08 02 Mon", NULL),
new Test1684Data(2001, 8, 7, 2001,8,2,UCAL_TUESDAY, "2001 08 02 Tue", NULL),
new Test1684Data(2001, 8, 5,/*12,*/ 2001,8,2,UCAL_SUNDAY, "2001 08 02 Sun", NULL),
new Test1684Data(2001, 8,6, /*7, 30,*/ 2001,7,6,UCAL_MONDAY, "2001 07 06 Mon", "2001 08 02 Mon"),
new Test1684Data(2001, 8,7, /*7, 31,*/ 2001,7,6,UCAL_TUESDAY, "2001 07 06 Tue", "2001 08 02 Tue"),
new Test1684Data(2001, 8, 5, 2001,7,6,UCAL_SUNDAY, "2001 07 06 Sun", "2001 08 02 Sun"),
new Test1684Data(2001, 7, 30, 2001,8,1,UCAL_MONDAY, "2001 08 01 Mon", "2001 07 05 Mon"),
new Test1684Data(2001, 7, 31, 2001,8,1,UCAL_TUESDAY, "2001 08 01 Tue", "2001 07 05 Tue"),
new Test1684Data(2001, 7,29, /*8, 5,*/ 2001,8,1,UCAL_SUNDAY, "2001 08 01 Sun", "2001 07 05 Sun"),
new Test1684Data(2001, 12, 31, 2001,12,6,UCAL_MONDAY, "2001 12 06 Mon", NULL),
new Test1684Data(2002, 1, 1, 2002,1,1,UCAL_TUESDAY, "2002 01 01 Tue", NULL),
new Test1684Data(2002, 1, 2, 2002,1,1,UCAL_WEDNESDAY, "2002 01 01 Wed", NULL),
new Test1684Data(2002, 1, 3, 2002,1,1,UCAL_THURSDAY, "2002 01 01 Thu", NULL),
new Test1684Data(2002, 1, 4, 2002,1,1,UCAL_FRIDAY, "2002 01 01 Fri", NULL),
new Test1684Data(2002, 1, 5, 2002,1,1,UCAL_SATURDAY, "2002 01 01 Sat", NULL),
new Test1684Data(2001,12,30, /*2002, 1, 6,*/ 2002,1,1,UCAL_SUNDAY, "2002 01 01 Sun", "2001 12 06 Sun")
};
#define kTest1684Count ((int32_t)(sizeof(tests)/sizeof(tests[0])))
int32_t pass = 0, error = 0, warning = 0;
int32_t i;
UErrorCode status = U_ZERO_ERROR;
UnicodeString pattern("yyyy MM WW EEE","");
Calendar *cal = new GregorianCalendar(status);
SimpleDateFormat *sdf = new SimpleDateFormat(pattern,status);
if (U_FAILURE(status)) {
dataerrln("Error constructing SimpleDateFormat");
for(i=0;i<kTest1684Count;i++) {
delete tests[i];
}
delete cal;
delete sdf;
return;
}
cal->setFirstDayOfWeek(UCAL_SUNDAY);
cal->setMinimalDaysInFirstWeek(1);
sdf->adoptCalendar(cal);
cal = sdf->getCalendar()->clone(); // sdf may have deleted calendar
if(!cal || !sdf || U_FAILURE(status)) {
errln(UnicodeString("Error setting up test: ") + u_errorName(status));
}
for (i = 0; i < kTest1684Count; ++i) {
Test1684Data &test = *(tests[i]);
logln(UnicodeString("#") + i + UnicodeString("\n-----\nTesting round trip of ") + test.year +
" " + (test.month + 1) +
" " + test.date +
" (written as) " + test.data);
cal->clear();
cal->set(test.year, test.month, test.date);
UDate ms = cal->getTime(status);
cal->clear();
cal->set(UCAL_YEAR, test.womyear);
cal->set(UCAL_MONTH, test.wommon);
cal->set(UCAL_WEEK_OF_MONTH, test.wom);
cal->set(UCAL_DAY_OF_WEEK, test.dow);
UDate ms2 = cal->getTime(status);
if (ms2 != ms) {
errln((UnicodeString)"\nError: GregorianUCAL_DOM gave " + ms +
"\n GregorianUCAL_WOM gave " + ms2);
error++;
} else {
pass++;
}
ms2 = sdf->parse(test.data, status);
if(U_FAILURE(status)) {
errln("parse exception: " + UnicodeString(u_errorName(status)));
}
if (ms2!=ms) {
errln((UnicodeString)"\nError: GregorianCalendar gave " + ms +
"\n SimpleDateFormat.parse gave " + ms2);
error++;
} else {
pass++;
}
UnicodeString result;
sdf->format(ms, result);
if (result != test.normalized) {
errln("\nWarning: format of '" + test.data + "' gave" +
//.........这里部分代码省略.........
示例2: init_inode_xattrs
static int init_inode_xattrs(struct inode *inode)
{
struct erofs_vnode *const vi = EROFS_V(inode);
struct xattr_iter it;
unsigned int i;
struct erofs_xattr_ibody_header *ih;
struct super_block *sb;
struct erofs_sb_info *sbi;
bool atomic_map;
int ret = 0;
/* the most case is that xattrs of this inode are initialized. */
if (test_bit(EROFS_V_EA_INITED_BIT, &vi->flags))
return 0;
if (wait_on_bit_lock(&vi->flags, EROFS_V_BL_XATTR_BIT, TASK_KILLABLE))
return -ERESTARTSYS;
/* someone has initialized xattrs for us? */
if (test_bit(EROFS_V_EA_INITED_BIT, &vi->flags))
goto out_unlock;
/*
* bypass all xattr operations if ->xattr_isize is not greater than
* sizeof(struct erofs_xattr_ibody_header), in detail:
* 1) it is not enough to contain erofs_xattr_ibody_header then
* ->xattr_isize should be 0 (it means no xattr);
* 2) it is just to contain erofs_xattr_ibody_header, which is on-disk
* undefined right now (maybe use later with some new sb feature).
*/
if (vi->xattr_isize == sizeof(struct erofs_xattr_ibody_header)) {
errln("xattr_isize %d of nid %llu is not supported yet",
vi->xattr_isize, vi->nid);
ret = -ENOTSUPP;
goto out_unlock;
} else if (vi->xattr_isize < sizeof(struct erofs_xattr_ibody_header)) {
if (unlikely(vi->xattr_isize)) {
DBG_BUGON(1);
ret = -EIO;
goto out_unlock; /* xattr ondisk layout error */
}
ret = -ENOATTR;
goto out_unlock;
}
sb = inode->i_sb;
sbi = EROFS_SB(sb);
it.blkaddr = erofs_blknr(iloc(sbi, vi->nid) + vi->inode_isize);
it.ofs = erofs_blkoff(iloc(sbi, vi->nid) + vi->inode_isize);
it.page = erofs_get_inline_page(inode, it.blkaddr);
if (IS_ERR(it.page)) {
ret = PTR_ERR(it.page);
goto out_unlock;
}
/* read in shared xattr array (non-atomic, see kmalloc below) */
it.kaddr = kmap(it.page);
atomic_map = false;
ih = (struct erofs_xattr_ibody_header *)(it.kaddr + it.ofs);
vi->xattr_shared_count = ih->h_shared_count;
vi->xattr_shared_xattrs = kmalloc_array(vi->xattr_shared_count,
sizeof(uint), GFP_KERNEL);
if (!vi->xattr_shared_xattrs) {
xattr_iter_end(&it, atomic_map);
ret = -ENOMEM;
goto out_unlock;
}
/* let's skip ibody header */
it.ofs += sizeof(struct erofs_xattr_ibody_header);
for (i = 0; i < vi->xattr_shared_count; ++i) {
if (unlikely(it.ofs >= EROFS_BLKSIZ)) {
/* cannot be unaligned */
BUG_ON(it.ofs != EROFS_BLKSIZ);
xattr_iter_end(&it, atomic_map);
it.page = erofs_get_meta_page(sb, ++it.blkaddr,
S_ISDIR(inode->i_mode));
if (IS_ERR(it.page)) {
kfree(vi->xattr_shared_xattrs);
vi->xattr_shared_xattrs = NULL;
ret = PTR_ERR(it.page);
goto out_unlock;
}
it.kaddr = kmap_atomic(it.page);
atomic_map = true;
it.ofs = 0;
}
vi->xattr_shared_xattrs[i] =
le32_to_cpu(*(__le32 *)(it.kaddr + it.ofs));
it.ofs += sizeof(__le32);
}
xattr_iter_end(&it, atomic_map);
set_bit(EROFS_V_EA_INITED_BIT, &vi->flags);
//.........这里部分代码省略.........
示例3: greg
//.........这里部分代码省略.........
cal.setTime(greg.getTime(status), status);
cal.setMinimalDaysInFirstWeek(1);
if (failure(status, "Calendar set/getTime")) {
return;
}
for (j = 0; fieldsToTest[j] >= 0; ++j) {
UCalendarDateFields f = (UCalendarDateFields)fieldsToTest[j];
int32_t v = cal.get(f, status);
int32_t minActual = cal.getActualMinimum(f, status);
int32_t maxActual = cal.getActualMaximum(f, status);
int32_t minLow = cal.getMinimum(f);
int32_t minHigh = cal.getGreatestMinimum(f);
int32_t maxLow = cal.getLeastMaximum(f);
int32_t maxHigh = cal.getMaximum(f);
if (limits[j][0] > minActual) {
// the minimum
limits[j][0] = minActual;
}
if (limits[j][1] < minActual) {
// the greatest minimum
limits[j][1] = minActual;
}
if (limits[j][2] > maxActual) {
// the least maximum
limits[j][2] = maxActual;
}
if (limits[j][3] < maxActual) {
// the maximum
limits[j][3] = maxActual;
}
if (minActual < minLow || minActual > minHigh) {
errln((UnicodeString)"Fail: [" + cal.getType() + "] " +
ymdToString(cal, ymd) +
" Range for min of " + FIELD_NAME[f] + "(" + f +
")=" + minLow + ".." + minHigh +
", actual_min=" + minActual);
}
if (maxActual < maxLow || maxActual > maxHigh) {
errln((UnicodeString)"Fail: [" + cal.getType() + "] " +
ymdToString(cal, ymd) +
" Range for max of " + FIELD_NAME[f] + "(" + f +
")=" + maxLow + ".." + maxHigh +
", actual_max=" + maxActual);
}
if (v < minActual || v > maxActual) {
errln((UnicodeString)"Fail: [" + cal.getType() + "] " +
ymdToString(cal, ymd) +
" " + FIELD_NAME[f] + "(" + f + ")=" + v +
", actual range=" + minActual + ".." + maxActual +
", allowed=(" + minLow + ".." + minHigh + ")..(" +
maxLow + ".." + maxHigh + ")");
}
}
greg.add(UCAL_DAY_OF_YEAR, 1, status);
if (failure(status, "Calendar::add")) {
return;
}
}
// Check actual maxima and minima seen against ranges returned
// by API.
UnicodeString buf;
for (j = 0; fieldsToTest[j] >= 0; ++j) {
int32_t rangeLow, rangeHigh;
示例4: UnicodeString
/**
* Test various generic API methods of PluralFormat for Basic usage.
*/
void PluralFormatTest::pluralFormatBasicTest(/*char *par*/)
{
UErrorCode status[8];
PluralFormat* plFmt[8];
Locale locale = Locale::getDefault();
UnicodeString otherPattern = UnicodeString("other{#}");
UnicodeString message=UnicodeString("ERROR: PluralFormat basic test");
// ========= Test constructors
logln(" Testing PluralFormat constructors ...");
status[0] = U_ZERO_ERROR;
PluralRules* plRules = PluralRules::createDefaultRules(status[0]);
status[0] = U_ZERO_ERROR;
NumberFormat *numFmt = NumberFormat::createInstance(status[0]);
if (U_FAILURE(status[0])) {
dataerrln("ERROR: Could not create NumberFormat instance with default locale ");
}
for (int32_t i=0; i< 8; ++i) {
status[i] = U_ZERO_ERROR;
}
plFmt[0] = new PluralFormat(status[0]);
plFmt[1] = new PluralFormat(*plRules, status[1]);
plFmt[2] = new PluralFormat(locale, status[2]);
plFmt[3] = new PluralFormat(locale, *plRules, status[3]);
plFmt[4] = new PluralFormat(otherPattern, status[4]);
plFmt[5] = new PluralFormat(*plRules, otherPattern, status[5]);
plFmt[6] = new PluralFormat(locale, otherPattern, status[6]);
plFmt[7] = new PluralFormat(locale, *plRules, otherPattern, status[7]);
for (int32_t i=0; i< 8; ++i) {
if (U_SUCCESS(status[i])) {
numberFormatTest(plFmt[i], numFmt, 1, 12, NULL, NULL, FALSE, &message);
numberFormatTest(plFmt[i], numFmt, 100, 112, NULL, NULL, FALSE, &message);
}
else {
dataerrln("ERROR: PluralFormat constructor failed!");
}
delete plFmt[i];
}
// ======= Test clone, assignment operator && == operator.
plFmt[0]= new PluralFormat(status[0]);
plFmt[0]->setNumberFormat(numFmt,status[0]);
UnicodeString us = UnicodeString("");
plFmt[0]->toPattern(us);
plFmt[1]= new PluralFormat(locale, status[1]);
if ( U_SUCCESS(status[0]) && U_SUCCESS(status[1]) ) {
*plFmt[1] = *plFmt[0];
if (plFmt[1]!=NULL) {
if ( *plFmt[1] != *plFmt[0] ) {
errln("ERROR: clone plural format test failed!");
}
}
}
else {
dataerrln("ERROR: PluralFormat constructor failed! - [0]%s [1]%s", u_errorName(status[0]), u_errorName(status[1]));
}
delete plFmt[0];
status[0] = U_ZERO_ERROR;
plFmt[0]= new PluralFormat(locale, status[0]);
if ( U_SUCCESS(status[0]) ) {
*plFmt[1] = *plFmt[0];
if (plFmt[1]!=NULL) {
if ( *plFmt[1] != *plFmt[0] ) {
errln("ERROR: assignment operator test failed!");
}
}
}
else {
dataerrln("ERROR: PluralFormat constructor failed! - %s", u_errorName(status[1]));
}
if ( U_SUCCESS(status[1]) ) {
plFmt[2] = (PluralFormat*) plFmt[1]->clone();
if (plFmt[1]!=NULL) {
if ( *plFmt[1] != *plFmt[2] ) {
errln("ERROR: clone function test failed!");
}
}
delete plFmt[1];
delete plFmt[2];
}
else {
dataerrln("ERROR: PluralFormat clone failed! - %s", u_errorName(status[1]));
}
delete plFmt[0];
delete numFmt;
delete plRules;
// Tests parseObject
UErrorCode stat = U_ZERO_ERROR;
PluralFormat *pf = new PluralFormat(stat);
Formattable *f = new Formattable();
//.........这里部分代码省略.........
示例5: US_FOO
void CollationServiceTest::TestRegister()
{
#if !UCONFIG_NO_SERVICE
// register a singleton
const Locale& FR = Locale::getFrance();
const Locale& US = Locale::getUS();
const Locale US_FOO("en", "US", "FOO");
UErrorCode status = U_ZERO_ERROR;
Collator* frcol = Collator::createInstance(FR, status);
Collator* uscol = Collator::createInstance(US, status);
if(U_FAILURE(status)) {
errcheckln(status, "Failed to create collators with %s", u_errorName(status));
delete frcol;
delete uscol;
return;
}
{ // try override en_US collator
Collator *clone = frcol->clone();
URegistryKey key = Collator::registerInstance(frcol, US, status);
// frcol has been adopted. We must not use it any more, nor rely on its attributes.
frcol = NULL;
Collator* ncol = Collator::createInstance(US_FOO, status);
if (*clone != *ncol) {
errln("register of french collator for en_US failed on request for en_US_FOO");
}
delete clone;
// The requested locale may be the same as the valid locale,
// or may not be supported at all. See ticket #10477.
Locale loc = ncol->getLocale(ULOC_REQUESTED_LOCALE, status);
if (U_SUCCESS(status) && loc != US_FOO && loc != US) {
errln(UnicodeString("requested locale for en_US_FOO is not en_US_FOO nor en_US but ") + loc.getName());
}
status = U_ZERO_ERROR;
loc = ncol->getLocale(ULOC_VALID_LOCALE, status);
if (loc != US) {
errln(UnicodeString("valid locale for en_US_FOO is not en_US but ") + loc.getName());
}
loc = ncol->getLocale(ULOC_ACTUAL_LOCALE, status);
if (loc != US) {
errln(UnicodeString("actual locale for en_US_FOO is not en_US but ") + loc.getName());
}
delete ncol; ncol = NULL;
if (!Collator::unregister(key, status)) {
errln("failed to unregister french collator");
}
ncol = Collator::createInstance(US, status);
if (*uscol != *ncol) {
errln("collator after unregister does not match original");
}
delete ncol; ncol = NULL;
}
// recreate frcol
frcol = Collator::createInstance(FR, status);
LocalUCollatorPointer frFR(ucol_open("fr_FR", &status));
{ // try create collator for new locale
Locale fu_FU_FOO("fu", "FU", "FOO");
Locale fu_FU("fu", "FU", "");
Collator* fucol = Collator::createInstance(fu_FU, status);
Collator *clone = frcol->clone();
URegistryKey key = Collator::registerInstance(frcol, fu_FU, status);
frcol = NULL; // frcol has been adopted.
Collator* ncol = Collator::createInstance(fu_FU_FOO, status);
if (*clone != *ncol) {
errln("register of fr collator for fu_FU failed");
}
delete clone;
UnicodeString locName = fu_FU.getName();
StringEnumeration* localeEnum = Collator::getAvailableLocales();
UBool found = FALSE;
const UnicodeString* locStr, *ls2;
for (locStr = localeEnum->snext(status);
!found && locStr != NULL;
locStr = localeEnum->snext(status)) {
//
if (locName == *locStr) {
found = TRUE;
}
}
StringEnumeration *le2 = NULL;
localeEnum->reset(status);
int32_t i, count;
count = localeEnum->count(status);
for(i = 0; i < count; ++i) {
if(i == count / 2) {
le2 = localeEnum->clone();
if(le2 == NULL || count != le2->count(status)) {
errln("ServiceEnumeration.clone() failed");
//.........这里部分代码省略.........
示例6: logln
/**
* This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
* NumberFormat.
*/
void IntlTestNumberFormatAPI::testAPI(/* char* par */)
{
UErrorCode status = U_ZERO_ERROR;
// ======= Test constructors
logln("Testing NumberFormat constructors");
NumberFormat *def = NumberFormat::createInstance(status);
if(U_FAILURE(status)) {
dataerrln("ERROR: Could not create NumberFormat (default) - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
NumberFormat *fr = NumberFormat::createInstance(Locale::getFrench(), status);
if(U_FAILURE(status)) {
dataerrln("ERROR: Could not create NumberFormat (French) - %s", u_errorName(status));
}
NumberFormat *cur = NumberFormat::createCurrencyInstance(status);
if(U_FAILURE(status)) {
dataerrln("ERROR: Could not create NumberFormat (currency, default) - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
NumberFormat *cur_fr = NumberFormat::createCurrencyInstance(Locale::getFrench(), status);
if(U_FAILURE(status)) {
dataerrln("ERROR: Could not create NumberFormat (currency, French) - %s", u_errorName(status));
}
NumberFormat *per = NumberFormat::createPercentInstance(status);
if(U_FAILURE(status)) {
dataerrln("ERROR: Could not create NumberFormat (percent, default) - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
NumberFormat *per_fr = NumberFormat::createPercentInstance(Locale::getFrench(), status);
if(U_FAILURE(status)) {
dataerrln("ERROR: Could not create NumberFormat (percent, French) - %s", u_errorName(status));
}
// ======= Test equality
if (per_fr != NULL && cur_fr != NULL)
{
logln("Testing equality operator");
if( *per_fr == *cur_fr || ! ( *per_fr != *cur_fr) ) {
errln("ERROR: == failed");
}
}
// ======= Test various format() methods
if (cur_fr != NULL)
{
logln("Testing various format() methods");
double d = -10456.0037;
int32_t l = 100000000;
Formattable fD(d);
Formattable fL(l);
UnicodeString res1, res2, res3, res4, res5, res6;
FieldPosition pos1(0), pos2(0), pos3(0), pos4(0);
res1 = cur_fr->format(d, res1);
logln( (UnicodeString) "" + (int32_t) d + " formatted to " + res1);
res2 = cur_fr->format(l, res2);
logln((UnicodeString) "" + (int32_t) l + " formatted to " + res2);
res3 = cur_fr->format(d, res3, pos1);
logln( (UnicodeString) "" + (int32_t) d + " formatted to " + res3);
res4 = cur_fr->format(l, res4, pos2);
logln((UnicodeString) "" + (int32_t) l + " formatted to " + res4);
status = U_ZERO_ERROR;
res5 = cur_fr->format(fD, res5, pos3, status);
if(U_FAILURE(status)) {
errln("ERROR: format(Formattable [double]) failed");
}
logln((UnicodeString) "" + (int32_t) fD.getDouble() + " formatted to " + res5);
status = U_ZERO_ERROR;
res6 = cur_fr->format(fL, res6, pos4, status);
if(U_FAILURE(status)) {
errln("ERROR: format(Formattable [long]) failed");
}
logln((UnicodeString) "" + fL.getLong() + " formatted to " + res6);
}
// ======= Test parse()
if (fr != NULL)
{
logln("Testing parse()");
//.........这里部分代码省略.........
示例7: errorCode
// Use LocalXyzPointer types that are not covered elsewhere in the intltest suite.
void LocalPointerTest::TestLocalXyzPointer() {
IcuTestErrorCode errorCode(*this, "TestLocalXyzPointer");
static const char *const encoding="ISO-8859-1";
LocalUConverterSelectorPointer sel(
ucnvsel_open(&encoding, 1, NULL, UCNV_ROUNDTRIP_SET, errorCode));
if(errorCode.logIfFailureAndReset("ucnvsel_open()")) {
return;
}
if(sel.isNull()) {
errln("LocalUConverterSelectorPointer failure");
return;
}
#if !UCONFIG_NO_FORMATTING
LocalUCalendarPointer cal(ucal_open(NULL, 0, "root", UCAL_GREGORIAN, errorCode));
if(errorCode.logDataIfFailureAndReset("ucal_open()")) {
return;
}
if(cal.isNull()) {
errln("LocalUCalendarPointer failure");
return;
}
LocalUDateTimePatternGeneratorPointer patgen(udatpg_open("root", errorCode));
if(errorCode.logIfFailureAndReset("udatpg_open()")) {
return;
}
if(patgen.isNull()) {
errln("LocalUDateTimePatternGeneratorPointer failure");
return;
}
LocalULocaleDisplayNamesPointer ldn(uldn_open("de-CH", ULDN_STANDARD_NAMES, errorCode));
if(errorCode.logIfFailureAndReset("uldn_open()")) {
return;
}
if(ldn.isNull()) {
errln("LocalULocaleDisplayNamesPointer failure");
return;
}
UnicodeString hello=UNICODE_STRING_SIMPLE("Hello {0}!");
LocalUMessageFormatPointer msg(
umsg_open(hello.getBuffer(), hello.length(), "root", NULL, errorCode));
if(errorCode.logIfFailureAndReset("umsg_open()")) {
return;
}
if(msg.isNull()) {
errln("LocalUMessageFormatPointer failure");
return;
}
#endif /* UCONFIG_NO_FORMATTING */
#if !UCONFIG_NO_NORMALIZATION
const UNormalizer2 *nfc=unorm2_getInstance(NULL, "nfc", UNORM2_COMPOSE, errorCode);
UnicodeSet emptySet;
LocalUNormalizer2Pointer fn2(unorm2_openFiltered(nfc, emptySet.toUSet(), errorCode));
if(errorCode.logIfFailureAndReset("unorm2_openFiltered()")) {
return;
}
if(fn2.isNull()) {
errln("LocalUNormalizer2Pointer failure");
return;
}
#endif /* !UCONFIG_NO_NORMALIZATION */
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
UnicodeString pattern=UNICODE_STRING_SIMPLE("abc|xy+z");
LocalURegularExpressionPointer regex(
uregex_open(pattern.getBuffer(), pattern.length(), 0, NULL, errorCode));
if(errorCode.logIfFailureAndReset("uregex_open()")) {
return;
}
if(regex.isNull()) {
errln("LocalURegularExpressionPointer failure");
return;
}
#endif /* UCONFIG_NO_REGULAR_EXPRESSIONS */
#if !UCONFIG_NO_TRANSLITERATION
UnicodeString id=UNICODE_STRING_SIMPLE("Grek-Latn");
LocalUTransliteratorPointer trans(
utrans_openU(id.getBuffer(), id.length(), UTRANS_FORWARD, NULL, 0, NULL, errorCode));
if(errorCode.logIfFailureAndReset("utrans_open()")) {
return;
}
if(trans.isNull()) {
errln("LocalUTransliteratorPointer failure");
return;
}
#endif /* !UCONFIG_NO_TRANSLITERATION */
// destructors
}
示例8: errln
void DataDrivenCalendarTest::testConvert(int32_t n,
const CalendarFieldsSet &fromSet, Calendar *fromCalendar,
const CalendarFieldsSet &toSet, Calendar *toCalendar, UBool forward) {
UErrorCode status = U_ZERO_ERROR;
UnicodeString thisString = (UnicodeString)"#"+n+" "+(forward ? "forward"
: "reverse")+" "+fromCalendar->getType()+"->"+toCalendar->getType();
fromCalendar->clear();
fromSet.setOnCalendar(fromCalendar, status);
if (U_FAILURE(status)) {
errln("FAIL: Failed to set on Source calendar: %s", u_errorName(status));
return;
}
CalendarFieldsSet diffSet;
diffSet.clear();
// Is the calendar sane at the first?
if (!fromSet.matches(fromCalendar, diffSet, status)) {
UnicodeString diffs = diffSet.diffFrom(fromSet, status);
errln((UnicodeString)"FAIL: "+thisString
+", SOURCE calendar was not set: Differences: "+ diffs
+"', status: "+ u_errorName(status));
} else if (U_FAILURE(status)) {
errln("FAIL: "+thisString+" SOURCE calendar Failed to match: "
+u_errorName(status));
} else {
logln("PASS: "+thisString+" SOURCE calendar match.");
}
//logln("Set Source calendar: " + from);
UDate fromTime = fromCalendar->getTime(status);
if (U_FAILURE(status)) {
errln("FAIL: Failed to get Source time: %s", u_errorName(status));
return;
}
diffSet.clear();
// Is the calendar sane after being set?
if (!fromSet.matches(fromCalendar, diffSet, status)) {
UnicodeString diffs = diffSet.diffFrom(fromSet, status);
errln((UnicodeString)"FAIL: "+thisString
+", SET SOURCE calendar was not set: Differences: "+ diffs
+"', status: "+ u_errorName(status));
} else if (U_FAILURE(status)) {
errln("FAIL: "+thisString+" SET SOURCE calendar Failed to match: "
+u_errorName(status));
} else {
logln("PASS: "+thisString+" SET SOURCE calendar match.");
}
toCalendar->clear();
toCalendar->setTime(fromTime, status);
if (U_FAILURE(status)) {
errln("FAIL: Failed to set Target time: %s", u_errorName(status));
return;
}
diffSet.clear();
if (!toSet.matches(toCalendar, diffSet, status)) {
UnicodeString diffs = diffSet.diffFrom(toSet, status);
errln((UnicodeString)"FAIL: "+thisString+", Differences: "+ diffs
+"', status: "+ u_errorName(status));
SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy G"), status);
UnicodeString fromString;
fmt.format(fromTime, fromString);
logln("Source Time: "+fromString+", Source Calendar: "
+fromCalendar->getType());
} else if (U_FAILURE(status)) {
errln("FAIL: "+thisString+" Failed to match: "+u_errorName(status));
} else {
logln("PASS: "+thisString+" match.");
}
}
示例9: dataerrln
void DataDrivenCalendarTest::testConvert(TestData *testData,
const DataMap *settings, UBool forward) {
UErrorCode status = U_ZERO_ERROR;
Calendar *toCalendar= NULL;
const DataMap *currentCase= NULL;
char toCalLoc[256] = "";
char fromCalLoc[256] = "";
// build to calendar
UnicodeString testSetting = settings->getString("ToCalendar", status);
if (U_SUCCESS(status)) {
testSetting.extract(0, testSetting.length(), toCalLoc, (const char*)0);
toCalendar = Calendar::createInstance(toCalLoc, status);
if (U_FAILURE(status)) {
dataerrln(UnicodeString("Unable to instantiate ToCalendar for ")+testSetting);
return;
}
}
CalendarFieldsSet fromSet, toSet, diffSet;
SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"),
status);
if (U_FAILURE(status)) {
errcheckln(status, "FAIL: Couldn't create SimpleDateFormat: %s",
u_errorName(status));
return;
}
// Start the processing
int n = 0;
while (testData->nextCase(currentCase, status)) {
++n;
Calendar *fromCalendar= NULL;
UnicodeString locale = currentCase->getString("locale", status);
if (U_SUCCESS(status)) {
locale.extract(0, locale.length(), fromCalLoc, (const char*)0); // default codepage. Invariant codepage doesn't have '@'!
fromCalendar = Calendar::createInstance(fromCalLoc, status);
if (U_FAILURE(status)) {
errln("Unable to instantiate fromCalendar for "+locale);
return;
}
} else {
errln("No 'locale' line.");
continue;
}
fromSet.clear();
toSet.clear();
UnicodeString from = currentCase->getString("from", status);
if (U_FAILURE(status)) {
errln("No 'from' line.");
continue;
}
fromSet.parseFrom(from, status);
if (U_FAILURE(status)) {
errln("Failed to parse 'from' parameter: "+from);
continue;
}
UnicodeString to = currentCase->getString("to", status);
if (U_FAILURE(status)) {
errln("No 'to' line.");
continue;
}
toSet.parseFrom(to, &fromSet, status);
if (U_FAILURE(status)) {
errln("Failed to parse 'to' parameter: "+to);
continue;
}
// now, do it.
if (forward) {
logln((UnicodeString)"#"+n+" "+locale+"/"+from+" >>> "+toCalLoc+"/"
+to);
testConvert(n, fromSet, fromCalendar, toSet, toCalendar, forward);
} else {
logln((UnicodeString)"#"+n+" "+locale+"/"+from+" <<< "+toCalLoc+"/"
+to);
testConvert(n, toSet, toCalendar, fromSet, fromCalendar, forward);
}
delete fromCalendar;
}
delete toCalendar;
}
示例10: symbols
void DecimalFormatTest::execFormatTest(int32_t lineNum,
const UnicodeString &pattern, // Pattern
const UnicodeString &round, // rounding mode
const UnicodeString &input, // input decimal number
const UnicodeString &expected, // expected formatted result
UErrorCode &status) {
if (U_FAILURE(status)) {
return;
}
DecimalFormatSymbols symbols(Locale::getUS(), status);
// printf("Pattern = %s\n", UnicodeStringPiece(pattern).data());
DecimalFormat fmtr(pattern, symbols, status);
if (U_FAILURE(status)) {
dataerrln("file dcfmtest.txt, line %d: %s error creating the formatter.",
lineNum, u_errorName(status));
return;
}
if (round=="ceiling") {
fmtr.setRoundingMode(DecimalFormat::kRoundCeiling);
} else if (round=="floor") {
fmtr.setRoundingMode(DecimalFormat::kRoundFloor);
} else if (round=="down") {
fmtr.setRoundingMode(DecimalFormat::kRoundDown);
} else if (round=="up") {
fmtr.setRoundingMode(DecimalFormat::kRoundUp);
} else if (round=="halfeven") {
fmtr.setRoundingMode(DecimalFormat::kRoundHalfEven);
} else if (round=="halfdown") {
fmtr.setRoundingMode(DecimalFormat::kRoundHalfDown);
} else if (round=="halfup") {
fmtr.setRoundingMode(DecimalFormat::kRoundHalfUp);
} else if (round=="default") {
// don't set any value.
} else if (round=="unnecessary") {
fmtr.setRoundingMode(DecimalFormat::kRoundUnnecessary);
} else {
fmtr.setRoundingMode(DecimalFormat::kRoundFloor);
errln("file dcfmtest.txt, line %d: Bad rounding mode \"%s\"",
lineNum, UnicodeStringPiece(round).data());
}
UnicodeString result;
UnicodeStringPiece spInput(input);
//fmtr.format(spInput, result, NULL, status);
Formattable fmtbl;
fmtbl.setDecimalNumber(spInput, status);
//NumberFormat &nfmtr = fmtr;
fmtr.format(fmtbl, result, NULL, status);
if ((status == U_FORMAT_INEXACT_ERROR) && (result == "") && (expected == "Inexact")) {
// Test succeeded.
status = U_ZERO_ERROR;
return;
}
if (U_FAILURE(status)) {
errln("file dcfmtest.txt, line %d: format() returned %s.",
lineNum, u_errorName(status));
status = U_ZERO_ERROR;
return;
}
if (result != expected) {
errln("file dcfmtest.txt, line %d: expected \"%s\", got \"%s\"",
lineNum, UnicodeStringPiece(expected).data(), UnicodeStringPiece(result).data());
}
}
示例11: fopen
//-------------------------------------------------------------------------------
//
// Read a text data file, convert it from UTF-8 to UChars, and return the data
// in one big UChar * buffer, which the caller must delete.
//
// (Lightly modified version of a similar function in regextst.cpp)
//
//--------------------------------------------------------------------------------
UChar *DecimalFormatTest::ReadAndConvertFile(const char *fileName, int32_t &ulen,
UErrorCode &status) {
UChar *retPtr = NULL;
char *fileBuf = NULL;
const char *fileBufNoBOM = NULL;
FILE *f = NULL;
ulen = 0;
if (U_FAILURE(status)) {
return retPtr;
}
//
// Open the file.
//
f = fopen(fileName, "rb");
if (f == 0) {
dataerrln("Error opening test data file %s\n", fileName);
status = U_FILE_ACCESS_ERROR;
return NULL;
}
//
// Read it in
//
int32_t fileSize;
int32_t amtRead;
int32_t amtReadNoBOM;
fseek( f, 0, SEEK_END);
fileSize = ftell(f);
fileBuf = new char[fileSize];
fseek(f, 0, SEEK_SET);
amtRead = fread(fileBuf, 1, fileSize, f);
if (amtRead != fileSize || fileSize <= 0) {
errln("Error reading test data file.");
goto cleanUpAndReturn;
}
//
// Look for a UTF-8 BOM on the data just read.
// The test data file is UTF-8.
// The BOM needs to be there in the source file to keep the Windows &
// EBCDIC machines happy, so force an error if it goes missing.
// Many Linux editors will silently strip it.
//
fileBufNoBOM = fileBuf + 3;
amtReadNoBOM = amtRead - 3;
if (fileSize<3 || uprv_strncmp(fileBuf, "\xEF\xBB\xBF", 3) != 0) {
// TODO: restore this check.
errln("Test data file %s is missing its BOM", fileName);
fileBufNoBOM = fileBuf;
amtReadNoBOM = amtRead;
}
//
// Find the length of the input in UTF-16 UChars
// (by preflighting the conversion)
//
u_strFromUTF8(NULL, 0, &ulen, fileBufNoBOM, amtReadNoBOM, &status);
//
// Convert file contents from UTF-8 to UTF-16
//
if (status == U_BUFFER_OVERFLOW_ERROR) {
// Buffer Overflow is expected from the preflight operation.
status = U_ZERO_ERROR;
retPtr = new UChar[ulen+1];
u_strFromUTF8(retPtr, ulen+1, NULL, fileBufNoBOM, amtReadNoBOM, &status);
}
cleanUpAndReturn:
fclose(f);
delete[] fileBuf;
if (U_FAILURE(status)) {
errln("ICU Error \"%s\"\n", u_errorName(status));
delete retPtr;
retPtr = NULL;
};
return retPtr;
}
示例12: ReadAndConvertFile
void DecimalFormatTest::DataDrivenTests() {
char tdd[2048];
const char *srcPath;
UErrorCode status = U_ZERO_ERROR;
int32_t lineNum = 0;
//
// Open and read the test data file.
//
srcPath=getPath(tdd, "dcfmtest.txt");
if(srcPath==NULL) {
return; /* something went wrong, error already output */
}
int32_t len;
UChar *testData = ReadAndConvertFile(srcPath, len, status);
if (U_FAILURE(status)) {
return; /* something went wrong, error already output */
}
//
// Put the test data into a UnicodeString
//
UnicodeString testString(FALSE, testData, len);
RegexMatcher parseLineMat(UnicodeString(
"(?i)\\s*parse\\s+"
"\"([^\"]*)\"\\s+" // Capture group 1: input text
"([ild])\\s+" // Capture group 2: expected parsed type
"\"([^\"]*)\"\\s+" // Capture group 3: expected parsed decimal
"\\s*(?:#.*)?"), // Trailing comment
0, status);
RegexMatcher formatLineMat(UnicodeString(
"(?i)\\s*format\\s+"
"(\\S+)\\s+" // Capture group 1: pattern
"(ceiling|floor|down|up|halfeven|halfdown|halfup|default|unnecessary)\\s+" // Capture group 2: Rounding Mode
"\"([^\"]*)\"\\s+" // Capture group 3: input
"\"([^\"]*)\"" // Capture group 4: expected output
"\\s*(?:#.*)?"), // Trailing comment
0, status);
RegexMatcher commentMat (UNICODE_STRING_SIMPLE("\\s*(#.*)?$"), 0, status);
RegexMatcher lineMat(UNICODE_STRING_SIMPLE("(?m)^(.*?)$"), testString, 0, status);
if (U_FAILURE(status)){
dataerrln("Construct RegexMatcher() error.");
delete [] testData;
return;
}
//
// Loop over the test data file, once per line.
//
while (lineMat.find()) {
lineNum++;
if (U_FAILURE(status)) {
dataerrln("File dcfmtest.txt, line %d: ICU Error \"%s\"", lineNum, u_errorName(status));
}
status = U_ZERO_ERROR;
UnicodeString testLine = lineMat.group(1, status);
// printf("%s\n", UnicodeStringPiece(testLine).data());
if (testLine.length() == 0) {
continue;
}
//
// Parse the test line. Skip blank and comment only lines.
// Separate out the three main fields - pattern, flags, target.
//
commentMat.reset(testLine);
if (commentMat.lookingAt(status)) {
// This line is a comment, or blank.
continue;
}
//
// Handle "parse" test case line from file
//
parseLineMat.reset(testLine);
if (parseLineMat.lookingAt(status)) {
execParseTest(lineNum,
parseLineMat.group(1, status), // input
parseLineMat.group(2, status), // Expected Type
parseLineMat.group(3, status), // Expected Decimal String
status
);
continue;
}
//
// Handle "format" test case line
//
formatLineMat.reset(testLine);
if (formatLineMat.lookingAt(status)) {
execFormatTest(lineNum,
formatLineMat.group(1, status), // Pattern
//.........这里部分代码省略.........
示例13: logln
void UCAConformanceTest::testConformance(const Collator *coll)
{
if(testFile == 0) {
return;
}
uint32_t skipFlags = 0;
if(coll->getAttribute(UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED) {
skipFlags |= IS_SHIFTED;
}
if(coll == rbUCA) {
skipFlags |= FROM_RULES;
}
logln("-prop:ucaconfnosortkeys=1 turns off getSortKey() in UCAConformanceTest");
UBool withSortKeys = getProperty("ucaconfnosortkeys") == NULL;
int32_t line = 0;
UChar b1[1024], b2[1024];
UChar *buffer = b1, *oldB = NULL;
char lineB1[1024], lineB2[1024];
char *lineB = lineB1, *oldLineB = lineB2;
uint8_t sk1[1024], sk2[1024];
uint8_t *oldSk = NULL, *newSk = sk1;
int32_t oldLen = 0;
int32_t oldBlen = 0;
uint32_t first = 0;
while (fgets(lineB, 1024, testFile) != NULL) {
// remove trailing whitespace
u_rtrim(lineB);
line++;
if(*lineB == 0 || lineB[0] == '#') {
continue;
}
int32_t buflen = u_parseString(lineB, buffer, 1024, &first, &status);
if(U_FAILURE(status)) {
errln("Error parsing line %ld (%s): %s\n",
(long)line, u_errorName(status), lineB);
status = U_ZERO_ERROR;
}
buffer[buflen] = 0;
if(skipLineBecauseOfBug(buffer, buflen, skipFlags)) {
logln("Skipping line %i because of a known bug", line);
continue;
}
int32_t resLen = withSortKeys ? coll->getSortKey(buffer, buflen, newSk, 1024) : 0;
if(oldSk != NULL) {
UBool ok=TRUE;
int32_t skres = withSortKeys ? strcmp((char *)oldSk, (char *)newSk) : 0;
int32_t cmpres = coll->compare(oldB, oldBlen, buffer, buflen, status);
int32_t cmpres2 = coll->compare(buffer, buflen, oldB, oldBlen, status);
if(cmpres != -cmpres2) {
errln("Compare result not symmetrical on line %i: "
"previous vs. current (%d) / current vs. previous (%d)",
line, cmpres, cmpres2);
ok = FALSE;
}
// TODO: Compare with normalization turned off if the input passes the FCD test.
if(withSortKeys && cmpres != normalizeResult(skres)) {
errln("Difference between coll->compare (%d) and sortkey compare (%d) on line %i",
cmpres, skres, line);
ok = FALSE;
}
int32_t res = cmpres;
if(res == 0 && !isAtLeastUCA62) {
// Up to UCA 6.1, the collation test files use a custom tie-breaker,
// comparing the raw input strings.
res = u_strcmpCodePointOrder(oldB, buffer);
// Starting with UCA 6.2, the collation test files use the standard UCA tie-breaker,
// comparing the NFD versions of the input strings,
// which we do via setting strength=identical.
}
if(res > 0) {
errln("Line %i is not greater or equal than previous line", line);
ok = FALSE;
}
if(!ok) {
errln(" Previous data line %s", oldLineB);
errln(" Current data line %s", lineB);
if(withSortKeys) {
UnicodeString oldS, newS;
prettify(CollationKey(oldSk, oldLen), oldS);
prettify(CollationKey(newSk, resLen), newS);
errln(" Previous key: "+oldS);
errln(" Current key: "+newS);
}
}
//.........这里部分代码省略.........
示例14: kPATTERN
void DataDrivenFormatTest::testConvertDate(TestData *testData,
const DataMap * /* settings */, UBool fmt) {
UnicodeString kPATTERN("PATTERN="); // TODO: static
UnicodeString kMILLIS("MILLIS="); // TODO: static
UnicodeString kRELATIVE_MILLIS("RELATIVE_MILLIS="); // TODO: static
UnicodeString kRELATIVE_ADD("RELATIVE_ADD:"); // TODO: static
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat basicFmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"),
status);
if (U_FAILURE(status)) {
dataerrln("FAIL: Couldn't create basic SimpleDateFormat: %s",
u_errorName(status));
return;
}
const DataMap *currentCase= NULL;
// Start the processing
int n = 0;
while (testData->nextCase(currentCase, status)) {
char calLoc[256] = "";
DateTimeStyleSet styleSet;
UnicodeString pattern;
UBool usePattern = FALSE;
(void)usePattern; // Suppress unused warning.
CalendarFieldsSet fromSet;
UDate fromDate = 0;
UBool useDate = FALSE;
UDate now = Calendar::getNow();
++n;
char theCase[200];
sprintf(theCase, "case %d:", n);
UnicodeString caseString(theCase, "");
// load params
UnicodeString locale = currentCase->getString("locale", status);
if (U_FAILURE(status)) {
errln("case %d: No 'locale' line.", n);
continue;
}
UnicodeString zone = currentCase->getString("zone", status);
if (U_FAILURE(status)) {
errln("case %d: No 'zone' line.", n);
continue;
}
UnicodeString spec = currentCase->getString("spec", status);
if(U_FAILURE(status)) {
errln("case %d: No 'spec' line.", n);
continue;
}
UnicodeString date = currentCase->getString("date", status);
if(U_FAILURE(status)) {
errln("case %d: No 'date' line.", n);
continue;
}
UnicodeString expectStr= currentCase->getString("str", status);
if(U_FAILURE(status)) {
errln("case %d: No 'str' line.", n);
continue;
}
DateFormat *format = NULL;
// Process: 'locale'
locale.extract(0, locale.length(), calLoc, (const char*)0); // default codepage. Invariant codepage doesn't have '@'!
Locale loc(calLoc);
if(spec.startsWith(kPATTERN)) {
pattern = UnicodeString(spec,kPATTERN.length());
usePattern = TRUE;
format = new SimpleDateFormat(pattern, loc, status);
if(U_FAILURE(status)) {
errln("case %d: could not create SimpleDateFormat from pattern: %s", n, u_errorName(status));
continue;
}
} else {
if(styleSet.parseFrom(spec, status)<0 || U_FAILURE(status)) {
errln("case %d: could not parse spec as style fields: %s", n, u_errorName(status));
continue;
}
format = DateFormat::createDateTimeInstance((DateFormat::EStyle)styleSet.getDateStyle(), (DateFormat::EStyle)styleSet.getTimeStyle(), loc);
if(format == NULL ) {
errln("case %d: could not create SimpleDateFormat from styles.", n);
continue;
}
}
Calendar *cal = Calendar::createInstance(loc, status);
if(U_FAILURE(status)) {
errln("case %d: could not create calendar from %s", n, calLoc);
}
if (zone.length() > 0) {
TimeZone * tz = TimeZone::createTimeZone(zone);
cal->setTimeZone(*tz);
format->setTimeZone(*tz);
delete tz;
}
//.........这里部分代码省略.........
示例15: kMILLIS
void DataDrivenCalendarTest::testOps(TestData *testData,
const DataMap * /*settings*/) {
UErrorCode status = U_ZERO_ERROR;
UBool useDate = FALSE; // TODO
UnicodeString kMILLIS("MILLIS="); // TODO: static
UDate fromDate = 0; // TODO
UDate toDate = 0;
const DataMap *currentCase= NULL;
char toCalLoc[256] = "";
// TODO: static strings?
const UnicodeString kADD("add", "");
const UnicodeString kROLL("roll", "");
// Get 'from' time
CalendarFieldsSet fromSet, toSet, paramsSet, diffSet;
SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"),
status);
if (U_FAILURE(status)) {
dataerrln("FAIL: Couldn't create SimpleDateFormat: %s",
u_errorName(status));
return;
}
// Start the processing
int n = 0;
while (testData->nextCase(currentCase, status)) {
++n;
Calendar *toCalendar= NULL;
Calendar *fromCalendar= NULL;
// load parameters
char theCase[200];
sprintf(theCase, "[case %d]", n);
UnicodeString caseString(theCase, "");
// build to calendar
// Headers { "locale","from","operation","params","to" }
// #1 locale
const char *param = "locale";
UnicodeString locale;
UnicodeString testSetting = currentCase->getString(param, status);
if (U_FAILURE(status)) {
errln(caseString+": Unable to get param '"+param+"' "
+ UnicodeString(" - "));
continue;
}
testSetting.extract(0, testSetting.length(), toCalLoc, (const char*)0);
fromCalendar = Calendar::createInstance(toCalLoc, status);
if (U_FAILURE(status)) {
errln(caseString+": Unable to instantiate calendar for "
+testSetting);
continue;
}
fromSet.clear();
// #2 'from' info
param = "from";
UnicodeString from = testSetting=currentCase->getString(param, status);
if (U_FAILURE(status)) {
errln(caseString+": Unable to get parameter '"+param+"' "
+ UnicodeString(" - "));
continue;
}
if(from.startsWith(kMILLIS)){
UnicodeString millis = UnicodeString(from, kMILLIS.length());
useDate = TRUE;
fromDate = udbg_stod(millis);
} else if(fromSet.parseFrom(testSetting, status)<0 || U_FAILURE(status)){
errln(caseString+": Failed to parse '"+param+"' parameter: "
+testSetting);
continue;
}
// #4 'operation' info
param = "operation";
UnicodeString operation = testSetting=currentCase->getString(param,
status);
if (U_FAILURE(status)) {
errln(caseString+": Unable to get parameter '"+param+"' "
+ UnicodeString(" - "));
continue;
}
if (U_FAILURE(status)) {
errln(caseString+": Failed to parse '"+param+"' parameter: "
+testSetting);
continue;
}
paramsSet.clear();
// #3 'params' info
param = "params";
UnicodeString params = testSetting
=currentCase->getString(param, status);
if (U_FAILURE(status)) {
errln(caseString+": Unable to get parameter '"+param+"' "
+ UnicodeString(" - "));
continue;
}
paramsSet.parseFrom(testSetting, status); // parse with inheritance.
//.........这里部分代码省略.........