本文整理汇总了C++中dataerrln函数的典型用法代码示例。如果您正苦于以下问题:C++ dataerrln函数的具体用法?C++ dataerrln怎么用?C++ dataerrln使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dataerrln函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: uldn_openForContext
void LocaleDisplayNamesTest::TestUldnDisplayContext() {
const LocNameDispContextItem * ctxtItemPtr;
for (ctxtItemPtr = ctxtItems; ctxtItemPtr->displayLocale != NULL; ctxtItemPtr++) {
UDisplayContext contexts[2] = {ctxtItemPtr->dialectHandling, ctxtItemPtr->capitalization};
UErrorCode status = U_ZERO_ERROR;
ULocaleDisplayNames * uldn = uldn_openForContext(ctxtItemPtr->displayLocale, contexts, 2, &status);
if (U_FAILURE(status)) {
errln(UnicodeString("FAIL: uldn_openForContext failed for locale ") + ctxtItemPtr->displayLocale +
", dialectHandling " + ctxtItemPtr->dialectHandling + ", capitalization " + ctxtItemPtr->capitalization);
} else {
UDisplayContext dialectHandling = uldn_getContext(uldn, UDISPCTX_TYPE_DIALECT_HANDLING, &status);
UDisplayContext capitalization = uldn_getContext(uldn, UDISPCTX_TYPE_CAPITALIZATION, &status);
if (U_FAILURE(status)) {
errln(UnicodeString("FAIL: uldn_getContext status ") + (int)status);
} else if (dialectHandling != ctxtItemPtr->dialectHandling || capitalization != ctxtItemPtr->capitalization) {
errln("FAIL: uldn_getContext retrieved incorrect dialectHandling or capitalization");
} else {
UChar nameBuf[ULOC_FULLNAME_CAPACITY];
int32_t len = uldn_localeDisplayName(uldn, ctxtItemPtr->localeToBeNamed, nameBuf, ULOC_FULLNAME_CAPACITY, &status);
if (U_FAILURE(status)) {
dataerrln(UnicodeString("FAIL: uldn_localeDisplayName status: ") + u_errorName(status));
} else if (u_strcmp(ctxtItemPtr->result, nameBuf) != 0) {
UnicodeString exp(ctxtItemPtr->result, u_strlen(ctxtItemPtr->result));
UnicodeString got(nameBuf, len);
dataerrln(UnicodeString("FAIL: uldn_localeDisplayName, capitalization ") + ctxtItemPtr->capitalization +
", expected " + exp + ", got " + got );
}
}
uldn_close(uldn);
}
}
}
开发者ID:Distrotech,项目名称:icu,代码行数:32,代码来源:locnmtst.cpp
示例2: logln
void
TimeZoneBoundaryTest::verifyDST(UDate d, TimeZone* time_zone, UBool expUseDaylightTime, UBool expInDaylightTime, UDate expZoneOffset, UDate expDSTOffset)
{
UnicodeString str;
UErrorCode status = U_ZERO_ERROR;
logln("-- Verifying time " + dateToString(d) + " in zone " + time_zone->getID(str));
if (time_zone->inDaylightTime(d, status) == expInDaylightTime)
logln(UnicodeString("PASS: inDaylightTime = ") + (time_zone->inDaylightTime(d, status)?"true":"false"));
else
dataerrln(UnicodeString("FAIL: inDaylightTime = ") + (time_zone->inDaylightTime(d, status)?"true":"false"));
if (failure(status, "TimeZone::inDaylightTime", TRUE))
return;
if (time_zone->useDaylightTime() == expUseDaylightTime)
logln(UnicodeString("PASS: useDaylightTime = ") + (time_zone->useDaylightTime()?"true":"false"));
else
dataerrln(UnicodeString("FAIL: useDaylightTime = ") + (time_zone->useDaylightTime()?"true":"false"));
if (time_zone->getRawOffset() == expZoneOffset)
logln(UnicodeString("PASS: getRawOffset() = ") + (expZoneOffset / ONE_HOUR));
else
dataerrln(UnicodeString("FAIL: getRawOffset() = ") + (time_zone->getRawOffset() / ONE_HOUR) + "; expected " + (expZoneOffset / ONE_HOUR));
GregorianCalendar *gc = new GregorianCalendar(time_zone->clone(), status);
gc->setTime(d, status);
if (failure(status, "GregorianCalendar::setTime")) return;
int32_t offset = time_zone->getOffset((uint8_t)gc->get(UCAL_ERA, status),
gc->get(UCAL_YEAR, status), gc->get(UCAL_MONTH, status),
gc->get(UCAL_DATE, status), (uint8_t)gc->get(UCAL_DAY_OF_WEEK, status),
((gc->get(UCAL_HOUR_OF_DAY, status) * 60 + gc->get(UCAL_MINUTE, status)) * 60 + gc->get(UCAL_SECOND, status)) * 1000 + gc->get(UCAL_MILLISECOND, status),
status);
if (failure(status, "GregorianCalendar::get")) return;
if (offset == expDSTOffset) logln(UnicodeString("PASS: getOffset() = ") + (offset / ONE_HOUR));
else dataerrln(UnicodeString("FAIL: getOffset() = ") + (offset / ONE_HOUR) + "; expected " + (expDSTOffset / ONE_HOUR));
delete gc;
}
开发者ID:icu-project,项目名称:icu4c,代码行数:34,代码来源:tzbdtest.cpp
示例3: index
void AlphabeticIndexTest::TestChineseUnihan() {
UErrorCode status = U_ZERO_ERROR;
AlphabeticIndex index("zh-u-co-unihan", status);
if(U_FAILURE(status)) {
dataerrln("unable create an AlphabeticIndex for Chinese/unihan: %s", u_errorName(status));
return;
}
index.setMaxLabelCount(500, status); // ICU 54 default is 99.
LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status));
TEST_CHECK_STATUS;
int32_t bucketCount = immIndex->getBucketCount();
if(bucketCount < 216) {
// There should be at least an underflow and overflow label,
// and one for each of 214 radicals,
// and maybe additional labels for simplified radicals.
dataerrln("too few buckets/labels for Chinese/unihan: %d (is zh/unihan data available?)",
bucketCount);
return;
} else {
logln("Chinese/unihan has %d buckets/labels", bucketCount);
}
// bucketIndex = radical number, adjusted for simplified radicals in lower buckets.
int32_t bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x4e5d), status);
assertEquals("getBucketIndex(U+4E5D)", 5, bucketIndex);
// radical 100, and there is a 90' since Unicode 8
bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x7527), status);
assertEquals("getBucketIndex(U+7527)", 101, bucketIndex);
}
开发者ID:Cyril2004,项目名称:proto-quic,代码行数:28,代码来源:alphaindextst.cpp
示例4: usLocale
void TimeUnitTest::test10219Plurals() {
Locale usLocale("en_US");
double values[2] = {1.588, 1.011};
UnicodeString expected[2][3] = {
{"1 minute", "1.5 minutes", "1.58 minutes"},
{"1 minute", "1.0 minutes", "1.01 minutes"}
};
UErrorCode status = U_ZERO_ERROR;
TimeUnitFormat tuf(usLocale, status);
if (U_FAILURE(status)) {
dataerrln("generating TimeUnitFormat Object failed: %s", u_errorName(status));
return;
}
LocalPointer<DecimalFormat> nf((DecimalFormat *) NumberFormat::createInstance(usLocale, status));
if (U_FAILURE(status)) {
dataerrln("generating NumberFormat Object failed: %s", u_errorName(status));
return;
}
for (int32_t j = 0; j < UPRV_LENGTHOF(values); ++j) {
for (int32_t i = 0; i < UPRV_LENGTHOF(expected[j]); ++i) {
nf->setMinimumFractionDigits(i);
nf->setMaximumFractionDigits(i);
nf->setRoundingMode(DecimalFormat::kRoundDown);
tuf.setNumberFormat(*nf, status);
if (U_FAILURE(status)) {
dataerrln("setting NumberFormat failed: %s", u_errorName(status));
return;
}
UnicodeString actual;
Formattable fmt;
LocalPointer<TimeUnitAmount> tamt(
new TimeUnitAmount(values[j], TimeUnit::UTIMEUNIT_MINUTE, status), status);
if (U_FAILURE(status)) {
dataerrln("generating TimeUnitAmount Object failed: %s", u_errorName(status));
return;
}
fmt.adoptObject(tamt.orphan());
tuf.format(fmt, actual, status);
if (U_FAILURE(status)) {
dataerrln("Actual formatting failed: %s", u_errorName(status));
return;
}
if (expected[j][i] != actual) {
errln("Expected " + expected[j][i] + ", got " + actual);
}
}
}
// test parsing
Formattable result;
ParsePosition pos;
UnicodeString formattedString = "1 minutes";
tuf.parseObject(formattedString, result, pos);
if (formattedString.length() != pos.getIndex()) {
errln("Expect parsing to go all the way to the end of the string.");
}
}
开发者ID:icu-project,项目名称:icu4c,代码行数:57,代码来源:tufmtts.cpp
示例5: ucol_openFromShortString
void SSearchTest::sharpSTest()
{
UErrorCode status = U_ZERO_ERROR;
UCollator *coll = NULL;
UnicodeString lp = "fuss";
UnicodeString sp = "fu\\u00DF";
UnicodeString targets[] = {"fu\\u00DF", "fu\\u00DFball", "1fu\\u00DFball", "12fu\\u00DFball", "123fu\\u00DFball", "1234fu\\u00DFball",
"ffu\\u00DF", "fufu\\u00DF", "fusfu\\u00DF",
"fuss", "ffuss", "fufuss", "fusfuss", "1fuss", "12fuss", "123fuss", "1234fuss", "fu\\u00DF", "1fu\\u00DF", "12fu\\u00DF", "123fu\\u00DF", "1234fu\\u00DF"};
int32_t start = -1, end = -1;
coll = ucol_openFromShortString("LEN_S1", FALSE, NULL, &status);
TEST_ASSERT_SUCCESS(status);
UnicodeString lpUnescaped = lp.unescape();
UnicodeString spUnescaped = sp.unescape();
LocalUStringSearchPointer ussLong(usearch_openFromCollator(lpUnescaped.getBuffer(), lpUnescaped.length(),
lpUnescaped.getBuffer(), lpUnescaped.length(), // actual test data will be set later
coll,
NULL, // the break iterator
&status));
LocalUStringSearchPointer ussShort(usearch_openFromCollator(spUnescaped.getBuffer(), spUnescaped.length(),
spUnescaped.getBuffer(), spUnescaped.length(), // actual test data will be set later
coll,
NULL, // the break iterator
&status));
TEST_ASSERT_SUCCESS(status);
for (uint32_t t = 0; t < (sizeof(targets)/sizeof(targets[0])); t += 1) {
UBool bFound;
UnicodeString target = targets[t].unescape();
start = end = -1;
usearch_setText(ussLong.getAlias(), target.getBuffer(), target.length(), &status);
bFound = usearch_search(ussLong.getAlias(), 0, &start, &end, &status);
TEST_ASSERT_SUCCESS(status);
if (bFound) {
logln("Test %d: found long pattern at [%d, %d].", t, start, end);
} else {
dataerrln("Test %d: did not find long pattern.", t);
}
usearch_setText(ussShort.getAlias(), target.getBuffer(), target.length(), &status);
bFound = usearch_search(ussShort.getAlias(), 0, &start, &end, &status);
TEST_ASSERT_SUCCESS(status);
if (bFound) {
logln("Test %d: found long pattern at [%d, %d].", t, start, end);
} else {
dataerrln("Test %d: did not find long pattern.", t);
}
}
ucol_close(coll);
}
开发者ID:Distrotech,项目名称:icu,代码行数:56,代码来源:ssearch.cpp
示例6: UnicodeString
void TransliteratorAPITest::TestTransliterate1(){
UnicodeString Data[]={
//ID, input string, transliterated string
"Any-Hex", "hello", UnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F", "") ,
"Hex-Any", UnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F", ""), "hello" ,
"Latin-Devanagari",CharsToUnicodeString("bha\\u0304rata"), CharsToUnicodeString("\\u092D\\u093E\\u0930\\u0924") ,
"Latin-Devanagari",UnicodeString("kra ksha khra gra cra dya dhya",""), CharsToUnicodeString("\\u0915\\u094D\\u0930 \\u0915\\u094D\\u0936 \\u0916\\u094D\\u0930 \\u0917\\u094D\\u0930 \\u091a\\u094D\\u0930 \\u0926\\u094D\\u092F \\u0927\\u094D\\u092F") ,
"Devanagari-Latin", CharsToUnicodeString("\\u092D\\u093E\\u0930\\u0924"), CharsToUnicodeString("bh\\u0101rata"),
// "Contracted-Expanded", CharsToUnicodeString("\\u00C0\\u00C1\\u0042"), CharsToUnicodeString("\\u0041\\u0300\\u0041\\u0301\\u0042") ,
// "Expanded-Contracted", CharsToUnicodeString("\\u0041\\u0300\\u0041\\u0301\\u0042"), CharsToUnicodeString("\\u00C0\\u00C1\\u0042") ,
//"Latin-Arabic", "aap", CharsToUnicodeString("\\u0627\\u06A4") ,
//"Arabic-Latin", CharsToUnicodeString("\\u0627\\u06A4"), "aap"
};
UnicodeString gotResult;
UnicodeString temp;
UnicodeString message;
Transliterator* t;
logln("Testing transliterate");
UErrorCode status = U_ZERO_ERROR;
UParseError parseError;
for(uint32_t i=0;i<sizeof(Data)/sizeof(Data[0]); i=i+3){
t=Transliterator::createInstance(Data[i+0], UTRANS_FORWARD, parseError, status);
if(t==0){
dataerrln("FAIL: construction: " + Data[i+0] + " Error: " + u_errorName(status));
dataerrln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
status = U_ZERO_ERROR;
continue;
}
gotResult = Data[i+1];
t->transliterate(gotResult);
message=t->getID() + "->transliterate(UnicodeString, UnicodeString) for\n\t Source:" + prettify(Data[i+1]);
doTest(message, gotResult, Data[i+2]);
//doubt here
temp=Data[i+1];
t->transliterate(temp);
message.remove();
message.append(t->getID());
message.append("->transliterate(Replaceable) for \n\tSource:");
message.append(Data[i][1]);
doTest(message, temp, Data[i+2]);
callEverything(t, __LINE__);
delete t;
}
}
开发者ID:LittoCats,项目名称:OT_4010D,代码行数:50,代码来源:transapi.cpp
示例7: SimpleDateFormat
/**
* @bug 4103341
*/
void DateFormatRegressionTest::Test4103341(void)
{
TimeZone *saveZone =TimeZone::createDefault();
//try {
// {sfb} changed from setDefault to adoptDefault
TimeZone::adoptDefault(TimeZone::createTimeZone("CST"));
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat *simple = new SimpleDateFormat(UnicodeString("MM/dd/yyyy HH:mm"), status);
if(U_FAILURE(status)) {
dataerrln("Couldn't create SimpleDateFormat, error %s", u_errorName(status));
delete simple;
return;
}
failure(status, "new SimpleDateFormat");
TimeZone *temp = TimeZone::createDefault();
if(simple->getTimeZone() != *temp)
errln("Fail: SimpleDateFormat not using default zone");
//}
//finally {
TimeZone::adoptDefault(saveZone);
//}
delete temp;
delete simple;
}
开发者ID:Abocer,项目名称:android-4.2_r1,代码行数:29,代码来源:dtfmrgts.cpp
示例8: SimpleTimeZone
/**
* @bug 4089106
*/
void DateFormatRegressionTest::Test4089106(void)
{
TimeZone *def = TimeZone::createDefault();
//try {
TimeZone *z = new SimpleTimeZone((int)(1.25 * 3600000), "FAKEZONE");
TimeZone::setDefault(*z);
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat *f = new SimpleDateFormat(status);
if(U_FAILURE(status)) {
dataerrln("Couldn't create SimpleDateFormat, error %s", u_errorName(status));
delete f;
delete def;
delete z;
return;
}
failure(status, "new SimpleDateFormat");
if (f->getTimeZone()!= *z)
errln("Fail: SimpleTimeZone should use TimeZone.getDefault()");
//}
//finally {
TimeZone::setDefault(*def);
//}
delete z;
delete f;
delete def;
}
开发者ID:Abocer,项目名称:android-4.2_r1,代码行数:31,代码来源:dtfmrgts.cpp
示例9: fmt
/**
* @bug 4073003
*/
void DateFormatRegressionTest::Test4073003(void)
{
//try {
UErrorCode ec = U_ZERO_ERROR;
SimpleDateFormat fmt("MM/dd/yy", Locale::getUK(), ec);
if (U_FAILURE(ec)) {
dataerrln("FAIL: SimpleDateFormat constructor - %s", u_errorName(ec));
return;
}
UnicodeString tests [] = {
(UnicodeString) "12/25/61",
(UnicodeString) "12/25/1961",
(UnicodeString) "4/3/2010",
(UnicodeString) "4/3/10"
};
UErrorCode status = U_ZERO_ERROR;
for(int i= 0; i < 4; i+=2) {
UDate d = fmt.parse(tests[i], status);
failure(status, "fmt.parse");
UDate dd = fmt.parse(tests[i+1], status);
failure(status, "fmt.parse");
UnicodeString s;
s = fmt.format(d, s);
UnicodeString ss;
ss = fmt.format(dd, ss);
if (d != dd)
errln((UnicodeString) "Fail: " + d + " != " + dd);
if (s != ss)
errln((UnicodeString)"Fail: " + s + " != " + ss);
logln("Ok: " + s + " " + d);
}
}
开发者ID:Abocer,项目名称:android-4.2_r1,代码行数:35,代码来源:dtfmrgts.cpp
示例10: SimpleDateFormat
DateFormat* CalendarTimeZoneTest::getDateFormat()
{
DateFormat *theFormat = 0;
if (fgDateFormat != 0) // if there's something in the cache
{
Mutex lock;
if (fgDateFormat != 0) // Someone might have grabbed it.
{
theFormat = fgDateFormat;
fgDateFormat = 0; // We have exclusive right to this formatter.
}
}
if(theFormat == 0) // If we weren't able to pull it out of the cache, then we have to create it.
{
UErrorCode status = U_ZERO_ERROR;
theFormat = new SimpleDateFormat(UnicodeString("EEE MMM dd HH:mm:ss zzz yyyy"), status);
if (U_FAILURE(status))
{
delete theFormat;
theFormat = 0;
dataerrln("FAIL: Could not create SimpleDateFormat - %s", u_errorName(status));
}
}
return theFormat;
}
开发者ID:icu-project,项目名称:icu4c,代码行数:29,代码来源:caltztst.cpp
示例11: coll
void AlphabeticIndexTest::TestPinyinFirst() {
UErrorCode status = U_ZERO_ERROR;
LocalPointer<RuleBasedCollator> coll(
static_cast<RuleBasedCollator *>(Collator::createInstance(Locale::getChinese(), status)));
if (U_FAILURE(status)) {
dataerrln("Failed Collator::createInstance call - %s", u_errorName(status));
return;
}
int32_t reorderCodes[] = { USCRIPT_HAN };
coll->setReorderCodes(reorderCodes, LENGTHOF(reorderCodes), status);
TEST_CHECK_STATUS;
AlphabeticIndex index(coll.orphan(), status);
TEST_CHECK_STATUS;
assertEquals("getBucketCount()", 28, index.getBucketCount(status)); // ... A-Z ...
index.addLabels(Locale::getChinese(), status);
assertEquals("getBucketCount()", 28, index.getBucketCount(status)); // ... A-Z ...
int32_t bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x897f), status);
assertEquals("getBucketIndex(U+897F)", (int32_t)((UChar)0x0058/*X*/ - (UChar)0x0041/*A*/ + 1), (int32_t)bucketIndex);
bucketIndex = index.getBucketIndex("i", status);
assertEquals("getBucketIndex(i)", 9, bucketIndex);
bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x03B1), status);
assertEquals("getBucketIndex(Greek alpha)", (int32_t)27, bucketIndex);
// U+50005 is an unassigned code point which sorts at the end, independent of the Hani group.
bucketIndex = index.getBucketIndex(UnicodeString(0x50005), status);
assertEquals("getBucketIndex(U+50005)", 27, bucketIndex);
bucketIndex = index.getBucketIndex(UnicodeString((UChar)0xFFFF), status);
assertEquals("getBucketIndex(U+FFFF)", 27, bucketIndex);
}
开发者ID:CoherentLabs,项目名称:CoherentWebCoreDependencies,代码行数:28,代码来源:alphaindextst.cpp
示例12: loadTestData
void
NewResourceBundleTest::TestResourceBundles()
{
UErrorCode status = U_ZERO_ERROR;
loadTestData(status);
if(U_FAILURE(status))
{
dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
return;
}
/* Make sure that users using te_IN for the default locale don't get test failures. */
Locale originalDefault;
if (Locale::getDefault() == Locale("te_IN")) {
Locale::setDefault(Locale("en_US"), status);
}
testTag("only_in_Root", TRUE, FALSE, FALSE);
testTag("only_in_te", FALSE, TRUE, FALSE);
testTag("only_in_te_IN", FALSE, FALSE, TRUE);
testTag("in_Root_te", TRUE, TRUE, FALSE);
testTag("in_Root_te_te_IN", TRUE, TRUE, TRUE);
testTag("in_Root_te_IN", TRUE, FALSE, TRUE);
testTag("in_te_te_IN", FALSE, TRUE, TRUE);
testTag("nonexistent", FALSE, FALSE, FALSE);
logln("Passed: %d\nFailed: %d", pass, fail);
/* Restore the default locale for the other tests. */
Locale::setDefault(originalDefault, status);
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:30,代码来源:restsnew.cpp
示例13: it
void CanonicalIteratorTest::TestExhaustive() {
UErrorCode status = U_ZERO_ERROR;
CanonicalIterator it("", status);
if (U_FAILURE(status)) {
dataerrln("Error creating CanonicalIterator: %s", u_errorName(status));
return;
}
UChar32 i = 0;
UnicodeString s;
// Test static and dynamic class IDs
if(it.getDynamicClassID() != CanonicalIterator::getStaticClassID()){
errln("CanonicalIterator::getStaticClassId ! = CanonicalIterator.getDynamicClassID");
}
for (i = 0; i < 0x10FFFF; quick?i+=0x10:++i) {
//for (i = 0xae00; i < 0xaf00; ++i) {
if ((i % 0x100) == 0) {
logln("Testing U+%06X", i);
}
// skip characters we know don't have decomps
int8_t type = u_charType(i);
if (type == U_UNASSIGNED || type == U_PRIVATE_USE_CHAR
|| type == U_SURROGATE) continue;
s = i;
characterTest(s, i, it);
s += (UChar32)0x0345; //"\\u0345";
characterTest(s, i, it);
}
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:32,代码来源:canittst.cpp
示例14: start
void CanonicalIteratorTest::TestAPI() {
UErrorCode status = U_ZERO_ERROR;
// Test reset and getSource
UnicodeString start("ljubav");
logln("Testing CanonicalIterator::getSource");
logln("Instantiating canonical iterator with string "+start);
CanonicalIterator can(start, status);
if (U_FAILURE(status)) {
dataerrln("Error creating CanonicalIterator: %s", u_errorName(status));
return;
}
UnicodeString source = can.getSource();
logln("CanonicalIterator::getSource returned "+source);
if(start != source) {
errln("CanonicalIterator.getSource() didn't return the starting string. Expected "+start+", got "+source);
}
logln("Testing CanonicalIterator::reset");
UnicodeString next = can.next();
logln("CanonicalIterator::next returned "+next);
can.reset();
UnicodeString afterReset = can.next();
logln("After reset, CanonicalIterator::next returned "+afterReset);
if(next != afterReset) {
errln("Next after instantiation ("+next+") is different from next after reset ("+afterReset+").");
}
logln("Testing getStaticClassID and getDynamicClassID");
if(can.getDynamicClassID() != CanonicalIterator::getStaticClassID()){
errln("RTTI failed for CanonicalIterator getDynamicClassID != getStaticClassID");
}
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:34,代码来源:canittst.cpp
示例15: UnicodeString
UObject *UObjectTest::testClassNoClassID(UObject *obj, const char *className, const char *factory)
{
if (!obj) {
return NULL;
}
UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
UClassID dynamicID = obj->getDynamicClassID();
{
char tmp[500];
sprintf(tmp, " [dynamic=%p] ", dynamicID);
logln(what + tmp);
}
if(factory != NULL) { /* NULL factory means: abstract */
if(!obj) {
dataerrln( "FAIL: ==NULL! " + what);
return obj;
}
if(dynamicID != NULL) {
errln("FAIL: dynamicID != NULL! for non-poor-man's-RTTI " + what);
}
}
return obj;
}
开发者ID:ACSOP,项目名称:android_external_icu4c,代码行数:27,代码来源:uobjtest.cpp
示例16: loadTestData
void
ResourceBundleTest::TestGetLocaleByType(void)
{
const struct {
const char *requestedLocale;
const char *resourceKey;
const char *validLocale;
const char *actualLocale;
} test[] = {
{ "te_IN_BLAH", "string_only_in_te_IN", "te_IN", "te_IN" },
{ "te_IN_BLAH", "string_only_in_te", "te_IN", "te" },
{ "te_IN_BLAH", "string_only_in_Root", "te_IN", "root" },
{ "te_IN_BLAH_01234567890_01234567890_01234567890_01234567890_01234567890_01234567890", "array_2d_only_in_Root", "te_IN", "root" },
{ "[email protected]=euro", "array_2d_only_in_te_IN", "te_IN", "te_IN" },
{ "[email protected]=thai;collation=phonebook", "array_2d_only_in_te", "te_IN", "te" }
};
UErrorCode status = U_ZERO_ERROR;
const char* testdatapath = loadTestData(status);
int32_t i = 0;
Locale locale;
if(U_FAILURE(status))
{
dataerrln("Could not load testdata.dat %s\n", u_errorName(status));
return;
}
for(i = 0; i < (int32_t)(sizeof(test)/sizeof(test[0])); i++) {
ResourceBundle rb(testdatapath, test[i].requestedLocale, status);
if(U_FAILURE(status))
{
err("Could not open resource bundle %s (error %s)\n", test[i].requestedLocale, u_errorName(status));
status = U_ZERO_ERROR;
continue;
}
ResourceBundle res = rb.get(test[i].resourceKey, status);
if(U_FAILURE(status))
{
err("Couldn't find the key %s. Error: %s\n", test[i].resourceKey, u_errorName(status));
status = U_ZERO_ERROR;
continue;
}
locale = res.getLocale(ULOC_REQUESTED_LOCALE, status);
if(locale != Locale::getDefault()) {
err("Expected requested locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
}
locale = res.getLocale(ULOC_VALID_LOCALE, status);
if(strcmp(locale.getName(), test[i].validLocale) != 0) {
err("Expected valid locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
}
locale = res.getLocale(ULOC_ACTUAL_LOCALE, status);
if(strcmp(locale.getName(), test[i].actualLocale) != 0) {
err("Expected actual locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
}
}
}
开发者ID:LittoCats,项目名称:OT_4010D,代码行数:60,代码来源:restest.cpp
示例17: log
void DataDrivenCalendarTest::runIndexedTest(int32_t index, UBool exec,
const char* &name, char* /*par */) {
if (driver != NULL) {
if (exec) {
// logln("Begin ");
}
const DataMap *info= NULL;
UErrorCode status= U_ZERO_ERROR;
TestData *testData = driver->createTestData(index, status);
if (U_SUCCESS(status)) {
name = testData->getName();
if (testData->getInfo(info, status)) {
log(info->getString("Description", status));
}
if (exec) {
log(name);
logln("---");
logln("");
processTest(testData);
}
delete testData;
} else {
name = "";
}
} else {
dataerrln("format/DataDriven*Test data (calendar.res) not initialized!");
name = "";
}
}
开发者ID:Epictetus,项目名称:build-couchdb,代码行数:31,代码来源:dadrcal.cpp
示例18: fmt
void RelativeDateTimeFormatterTest::TestCustomNumberFormat() {
NumberFormat *nf;
UErrorCode status = U_ZERO_ERROR;
{
RelativeDateTimeFormatter fmt("en", status);
if (U_FAILURE(status)) {
dataerrln(
"Failure creating format object - %s", u_errorName(status));
return;
}
nf = (NumberFormat *) fmt.getNumberFormat().clone();
}
nf->setMinimumFractionDigits(1);
nf->setMaximumFractionDigits(1);
RelativeDateTimeFormatter fmt("en", nf, status);
// Test copy constructor.
RelativeDateTimeFormatter fmt2(fmt);
RunTest(fmt2, kEnglishDecimal, UPRV_LENGTHOF(kEnglishDecimal), "en decimal digits");
// Test assignment
fmt = RelativeDateTimeFormatter("es", status);
RunTest(fmt, kSpanishNoQuantity, UPRV_LENGTHOF(kSpanishNoQuantity), "assignment operator");
}
开发者ID:CedarLogic,项目名称:arangodb,代码行数:25,代码来源:reldatefmttest.cpp
示例19: heRes
void
NewResourceBundleTest::TestGetByFallback() {
UErrorCode status = U_ZERO_ERROR;
ResourceBundle heRes(NULL, "he", status);
heRes.getWithFallback("calendar", status).getWithFallback("islamic-civil", status).getWithFallback("DateTime", status);
if(U_SUCCESS(status)) {
errln("he locale's Islamic-civil DateTime resource exists. How did it get here?\n");
}
status = U_ZERO_ERROR;
heRes.getWithFallback("calendar", status).getWithFallback("islamic-civil", status).getWithFallback("eras", status);
if(U_FAILURE(status)) {
dataerrln("Didn't get Islamic Eras. I know they are there! - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
ResourceBundle rootRes(NULL, "root", status);
rootRes.getWithFallback("calendar", status).getWithFallback("islamic-civil", status).getWithFallback("DateTime", status);
if(U_SUCCESS(status)) {
errln("Root's Islamic-civil's DateTime resource exists. How did it get here?\n");
}
status = U_ZERO_ERROR;
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:26,代码来源:restsnew.cpp
示例20: dataerrln
Calendar* CalendarTimeZoneTest::getCalendar()
{
Calendar *theCalendar = 0;
if (fgCalendar != 0) // if there's something in the cache
{
Mutex lock;
if (fgCalendar != 0) // Someone might have grabbed it.
{
theCalendar = fgCalendar;
fgCalendar = 0; // We have exclusive right to this calendar.
}
}
if(theCalendar == 0) // If we weren't able to pull it out of the cache, then we have to create it.
{
UErrorCode status = U_ZERO_ERROR;
theCalendar = Calendar::createInstance(status);
if (U_FAILURE(status))
{
delete theCalendar;
theCalendar = 0;
dataerrln("FAIL: Calendar::createInstance failed: %s", u_errorName(status));
}
}
return theCalendar;
}
开发者ID:icu-project,项目名称:icu4c,代码行数:28,代码来源:caltztst.cpp
注:本文中的dataerrln函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论