2004-11-01 18:56:24 +00:00
|
|
|
/***********************************************************************
|
2000-01-15 02:00:06 +00:00
|
|
|
* COPYRIGHT:
|
2009-06-12 19:34:21 +00:00
|
|
|
* Copyright (c) 1997-2009, International Business Machines Corporation
|
2004-11-01 18:56:24 +00:00
|
|
|
* and others. All Rights Reserved.
|
|
|
|
***********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/utypes.h"
|
2002-09-21 00:43:14 +00:00
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "nmfmapts.h"
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/numfmt.h"
|
|
|
|
#include "unicode/decimfmt.h"
|
|
|
|
#include "unicode/locid.h"
|
2003-02-25 23:36:48 +00:00
|
|
|
#include "unicode/unum.h"
|
|
|
|
#include "unicode/strenum.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// This is an API test, not a unit test. It doesn't test very many cases, and doesn't
|
|
|
|
// try to test the full functionality. It just calls each function in the class and
|
|
|
|
// verifies that it works on a basic level.
|
|
|
|
|
2000-08-23 19:11:16 +00:00
|
|
|
void IntlTestNumberFormatAPI::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
|
1999-08-16 21:50:52 +00:00
|
|
|
{
|
|
|
|
if (exec) logln("TestSuite NumberFormatAPI");
|
|
|
|
switch (index) {
|
|
|
|
case 0: name = "NumberFormat API test";
|
|
|
|
if (exec) {
|
|
|
|
logln("NumberFormat API test---"); logln("");
|
1999-10-07 00:07:53 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
2004-12-22 19:28:42 +00:00
|
|
|
Locale saveLocale;
|
2002-08-21 00:16:30 +00:00
|
|
|
Locale::setDefault(Locale::getEnglish(), status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
1999-08-16 21:50:52 +00:00
|
|
|
errln("ERROR: Could not set default locale, test may not give correct results");
|
|
|
|
}
|
2000-08-23 19:11:16 +00:00
|
|
|
testAPI(/* par */);
|
2004-12-22 19:28:42 +00:00
|
|
|
Locale::setDefault(saveLocale, status);
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-02-25 23:36:48 +00:00
|
|
|
case 1: name = "NumberFormatRegistration";
|
|
|
|
if (exec) {
|
|
|
|
logln("NumberFormat Registration test---"); logln("");
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
2004-12-22 19:28:42 +00:00
|
|
|
Locale saveLocale;
|
2003-02-25 23:36:48 +00:00
|
|
|
Locale::setDefault(Locale::getEnglish(), status);
|
|
|
|
if(U_FAILURE(status)) {
|
|
|
|
errln("ERROR: Could not set default locale, test may not give correct results");
|
|
|
|
}
|
|
|
|
testRegistration();
|
2004-12-22 19:28:42 +00:00
|
|
|
Locale::setDefault(saveLocale, status);
|
2003-02-25 23:36:48 +00:00
|
|
|
}
|
|
|
|
break;
|
1999-08-16 21:50:52 +00:00
|
|
|
default: name = ""; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
|
|
|
|
* NumberFormat.
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void IntlTestNumberFormatAPI::testAPI(/* char* par */)
|
1999-08-16 21:50:52 +00:00
|
|
|
{
|
1999-10-07 00:07:53 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// ======= Test constructors
|
|
|
|
|
|
|
|
logln("Testing NumberFormat constructors");
|
|
|
|
|
|
|
|
NumberFormat *def = NumberFormat::createInstance(status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
2009-06-12 19:34:21 +00:00
|
|
|
dataerrln("ERROR: Could not create NumberFormat (default) - %s", u_errorName(status));
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 00:07:53 +00:00
|
|
|
status = U_ZERO_ERROR;
|
2002-08-21 00:16:30 +00:00
|
|
|
NumberFormat *fr = NumberFormat::createInstance(Locale::getFrench(), status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
2009-06-12 19:34:21 +00:00
|
|
|
dataerrln("ERROR: Could not create NumberFormat (French) - %s", u_errorName(status));
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NumberFormat *cur = NumberFormat::createCurrencyInstance(status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
2009-06-12 19:34:21 +00:00
|
|
|
dataerrln("ERROR: Could not create NumberFormat (currency, default) - %s", u_errorName(status));
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 00:07:53 +00:00
|
|
|
status = U_ZERO_ERROR;
|
2002-08-21 00:16:30 +00:00
|
|
|
NumberFormat *cur_fr = NumberFormat::createCurrencyInstance(Locale::getFrench(), status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
2009-06-12 19:34:21 +00:00
|
|
|
dataerrln("ERROR: Could not create NumberFormat (currency, French) - %s", u_errorName(status));
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NumberFormat *per = NumberFormat::createPercentInstance(status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
2009-06-12 19:34:21 +00:00
|
|
|
dataerrln("ERROR: Could not create NumberFormat (percent, default) - %s", u_errorName(status));
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 00:07:53 +00:00
|
|
|
status = U_ZERO_ERROR;
|
2002-08-21 00:16:30 +00:00
|
|
|
NumberFormat *per_fr = NumberFormat::createPercentInstance(Locale::getFrench(), status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
2009-06-12 19:34:21 +00:00
|
|
|
dataerrln("ERROR: Could not create NumberFormat (percent, French) - %s", u_errorName(status));
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ======= Test equality
|
2005-07-05 18:39:00 +00:00
|
|
|
if (per_fr != NULL && cur_fr != NULL)
|
|
|
|
{
|
1999-08-16 21:50:52 +00:00
|
|
|
logln("Testing equality operator");
|
|
|
|
|
|
|
|
if( *per_fr == *cur_fr || ! ( *per_fr != *cur_fr) ) {
|
|
|
|
errln("ERROR: == failed");
|
|
|
|
}
|
2005-07-05 18:39:00 +00:00
|
|
|
}
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// ======= Test various format() methods
|
2005-07-05 18:39:00 +00:00
|
|
|
if (cur_fr != NULL)
|
|
|
|
{
|
1999-08-16 21:50:52 +00:00
|
|
|
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);
|
|
|
|
|
1999-10-07 00:07:53 +00:00
|
|
|
status = U_ZERO_ERROR;
|
1999-08-16 21:50:52 +00:00
|
|
|
res5 = cur_fr->format(fD, res5, pos3, status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
1999-08-16 21:50:52 +00:00
|
|
|
errln("ERROR: format(Formattable [double]) failed");
|
|
|
|
}
|
|
|
|
logln((UnicodeString) "" + (int32_t) fD.getDouble() + " formatted to " + res5);
|
|
|
|
|
1999-10-07 00:07:53 +00:00
|
|
|
status = U_ZERO_ERROR;
|
1999-08-16 21:50:52 +00:00
|
|
|
res6 = cur_fr->format(fL, res6, pos4, status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
1999-08-16 21:50:52 +00:00
|
|
|
errln("ERROR: format(Formattable [long]) failed");
|
|
|
|
}
|
|
|
|
logln((UnicodeString) "" + fL.getLong() + " formatted to " + res6);
|
2005-07-05 18:39:00 +00:00
|
|
|
}
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// ======= Test parse()
|
2005-07-05 18:39:00 +00:00
|
|
|
if (fr != NULL)
|
|
|
|
{
|
1999-08-16 21:50:52 +00:00
|
|
|
logln("Testing parse()");
|
|
|
|
|
2005-07-05 18:39:00 +00:00
|
|
|
double d = -10456.0037;
|
1999-08-16 21:50:52 +00:00
|
|
|
UnicodeString text("-10,456.0037");
|
|
|
|
Formattable result1, result2, result3;
|
|
|
|
ParsePosition pos(0), pos01(0);
|
|
|
|
fr->parseObject(text, result1, pos);
|
|
|
|
if(result1.getType() != Formattable::kDouble && result1.getDouble() != d) {
|
|
|
|
errln("ERROR: Roundtrip failed (via parse()) for " + text);
|
|
|
|
}
|
|
|
|
logln(text + " parsed into " + (int32_t) result1.getDouble());
|
|
|
|
|
|
|
|
fr->parse(text, result2, pos01);
|
|
|
|
if(result2.getType() != Formattable::kDouble && result2.getDouble() != d) {
|
|
|
|
errln("ERROR: Roundtrip failed (via parse()) for " + text);
|
|
|
|
}
|
|
|
|
logln(text + " parsed into " + (int32_t) result2.getDouble());
|
|
|
|
|
1999-10-07 00:07:53 +00:00
|
|
|
status = U_ZERO_ERROR;
|
1999-08-16 21:50:52 +00:00
|
|
|
fr->parse(text, result3, status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
1999-08-16 21:50:52 +00:00
|
|
|
errln("ERROR: parse() failed");
|
|
|
|
}
|
|
|
|
if(result3.getType() != Formattable::kDouble && result3.getDouble() != d) {
|
|
|
|
errln("ERROR: Roundtrip failed (via parse()) for " + text);
|
|
|
|
}
|
|
|
|
logln(text + " parsed into " + (int32_t) result3.getDouble());
|
2005-07-05 18:39:00 +00:00
|
|
|
}
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// ======= Test getters and setters
|
2005-07-05 18:39:00 +00:00
|
|
|
if (fr != NULL && def != NULL)
|
|
|
|
{
|
1999-08-16 21:50:52 +00:00
|
|
|
logln("Testing getters and setters");
|
|
|
|
|
|
|
|
int32_t count = 0;
|
|
|
|
const Locale *locales = NumberFormat::getAvailableLocales(count);
|
|
|
|
logln((UnicodeString) "Got " + count + " locales" );
|
|
|
|
for(int32_t i = 0; i < count; i++) {
|
2000-04-15 21:28:17 +00:00
|
|
|
UnicodeString name(locales[i].getName(),"");
|
1999-08-16 21:50:52 +00:00
|
|
|
logln(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
fr->setParseIntegerOnly( def->isParseIntegerOnly() );
|
|
|
|
if(fr->isParseIntegerOnly() != def->isParseIntegerOnly() ) {
|
|
|
|
errln("ERROR: setParseIntegerOnly() failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
fr->setGroupingUsed( def->isGroupingUsed() );
|
|
|
|
if(fr->isGroupingUsed() != def->isGroupingUsed() ) {
|
|
|
|
errln("ERROR: setGroupingUsed() failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
fr->setMaximumIntegerDigits( def->getMaximumIntegerDigits() );
|
|
|
|
if(fr->getMaximumIntegerDigits() != def->getMaximumIntegerDigits() ) {
|
|
|
|
errln("ERROR: setMaximumIntegerDigits() failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
fr->setMinimumIntegerDigits( def->getMinimumIntegerDigits() );
|
|
|
|
if(fr->getMinimumIntegerDigits() != def->getMinimumIntegerDigits() ) {
|
|
|
|
errln("ERROR: setMinimumIntegerDigits() failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
fr->setMaximumFractionDigits( def->getMaximumFractionDigits() );
|
|
|
|
if(fr->getMaximumFractionDigits() != def->getMaximumFractionDigits() ) {
|
|
|
|
errln("ERROR: setMaximumFractionDigits() failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
fr->setMinimumFractionDigits( def->getMinimumFractionDigits() );
|
|
|
|
if(fr->getMinimumFractionDigits() != def->getMinimumFractionDigits() ) {
|
|
|
|
errln("ERROR: setMinimumFractionDigits() failed");
|
|
|
|
}
|
2005-07-05 18:39:00 +00:00
|
|
|
}
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// ======= Test getStaticClassID()
|
|
|
|
|
|
|
|
logln("Testing getStaticClassID()");
|
|
|
|
|
1999-10-07 00:07:53 +00:00
|
|
|
status = U_ZERO_ERROR;
|
1999-08-16 21:50:52 +00:00
|
|
|
NumberFormat *test = new DecimalFormat(status);
|
1999-10-18 22:48:32 +00:00
|
|
|
if(U_FAILURE(status)) {
|
2009-06-12 19:34:21 +00:00
|
|
|
errcheckln(status, "ERROR: Couldn't create a NumberFormat - %s", u_errorName(status));
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(test->getDynamicClassID() != DecimalFormat::getStaticClassID()) {
|
|
|
|
errln("ERROR: getDynamicClassID() didn't return the expected value");
|
|
|
|
}
|
|
|
|
|
|
|
|
delete test;
|
|
|
|
delete def;
|
|
|
|
delete fr;
|
|
|
|
delete cur;
|
|
|
|
delete cur_fr;
|
|
|
|
delete per;
|
|
|
|
delete per_fr;
|
|
|
|
}
|
2002-09-21 00:43:14 +00:00
|
|
|
|
2004-11-13 02:33:36 +00:00
|
|
|
#if !UCONFIG_NO_SERVICE
|
|
|
|
|
2003-02-25 23:36:48 +00:00
|
|
|
#define SRC_LOC Locale::getFrance()
|
|
|
|
#define SWAP_LOC Locale::getUS()
|
|
|
|
|
2003-05-02 22:17:14 +00:00
|
|
|
class NFTestFactory : public SimpleNumberFormatFactory {
|
2004-11-11 23:34:58 +00:00
|
|
|
NumberFormat* currencyStyle;
|
2003-02-25 23:36:48 +00:00
|
|
|
|
|
|
|
public:
|
2004-11-11 23:34:58 +00:00
|
|
|
NFTestFactory()
|
|
|
|
: SimpleNumberFormatFactory(SRC_LOC, TRUE)
|
|
|
|
{
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
currencyStyle = NumberFormat::createInstance(SWAP_LOC, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~NFTestFactory()
|
|
|
|
{
|
|
|
|
delete currencyStyle;
|
|
|
|
}
|
|
|
|
|
2003-12-02 01:55:53 +00:00
|
|
|
virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType)
|
2004-11-11 23:34:58 +00:00
|
|
|
{
|
|
|
|
if (formatType == UNUM_CURRENCY) {
|
|
|
|
return (NumberFormat*)currencyStyle->clone();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-02-25 23:36:48 +00:00
|
|
|
|
|
|
|
virtual inline UClassID getDynamicClassID() const
|
|
|
|
{
|
2004-11-11 23:34:58 +00:00
|
|
|
return (UClassID)&gID;
|
2003-02-25 23:36:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline UClassID getStaticClassID()
|
|
|
|
{
|
2004-11-11 23:34:58 +00:00
|
|
|
return (UClassID)&gID;
|
2003-02-25 23:36:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
static char gID;
|
|
|
|
};
|
|
|
|
|
2003-05-02 22:17:14 +00:00
|
|
|
char NFTestFactory::gID = 0;
|
2004-11-13 02:33:36 +00:00
|
|
|
#endif
|
2003-02-25 23:36:48 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
IntlTestNumberFormatAPI::testRegistration()
|
|
|
|
{
|
2004-07-18 02:02:06 +00:00
|
|
|
#if !UCONFIG_NO_SERVICE
|
2004-11-11 23:34:58 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
|
2009-11-20 06:28:25 +00:00
|
|
|
LocalPointer<NumberFormat> f0(NumberFormat::createInstance(SWAP_LOC, status));
|
|
|
|
LocalPointer<NumberFormat> f1(NumberFormat::createInstance(SRC_LOC, status));
|
|
|
|
LocalPointer<NumberFormat> f2(NumberFormat::createCurrencyInstance(SRC_LOC, status));
|
2004-11-11 23:34:58 +00:00
|
|
|
URegistryKey key = NumberFormat::registerFactory(new NFTestFactory(), status);
|
2009-11-20 06:28:25 +00:00
|
|
|
LocalPointer<NumberFormat> f3(NumberFormat::createCurrencyInstance(SRC_LOC, status));
|
|
|
|
LocalPointer<NumberFormat> f3a(NumberFormat::createCurrencyInstance(SRC_LOC, status));
|
|
|
|
LocalPointer<NumberFormat> f4(NumberFormat::createInstance(SRC_LOC, status));
|
2003-02-25 23:36:48 +00:00
|
|
|
|
2004-11-11 23:34:58 +00:00
|
|
|
StringEnumeration* locs = NumberFormat::getAvailableLocales();
|
2003-02-25 23:36:48 +00:00
|
|
|
|
2009-11-20 06:28:25 +00:00
|
|
|
LocalUNumberFormatPointer uf3(unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(), NULL, &status));
|
|
|
|
LocalUNumberFormatPointer uf4(unum_open(UNUM_DEFAULT, NULL, 0, SRC_LOC.getName(), NULL, &status));
|
2003-02-25 23:36:48 +00:00
|
|
|
|
2003-03-14 02:18:40 +00:00
|
|
|
const UnicodeString* res;
|
2004-11-11 23:34:58 +00:00
|
|
|
for (res = locs->snext(status); res; res = locs->snext(status)) {
|
|
|
|
logln(*res); // service is still in synch
|
|
|
|
}
|
|
|
|
|
|
|
|
NumberFormat::unregister(key, status); // restore for other tests
|
2009-11-20 06:28:25 +00:00
|
|
|
LocalPointer<NumberFormat> f5(NumberFormat::createCurrencyInstance(SRC_LOC, status));
|
|
|
|
LocalUNumberFormatPointer uf5(unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(), NULL, &status));
|
2005-07-05 18:39:00 +00:00
|
|
|
|
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
dataerrln("Error creating instnaces.");
|
|
|
|
return;
|
2004-11-11 23:34:58 +00:00
|
|
|
} else {
|
2005-07-05 18:39:00 +00:00
|
|
|
float n = 1234.567f;
|
|
|
|
UnicodeString res0, res1, res2, res3, res4, res5;
|
|
|
|
UChar ures3[50];
|
|
|
|
UChar ures4[50];
|
|
|
|
UChar ures5[50];
|
|
|
|
|
|
|
|
f0->format(n, res0);
|
|
|
|
f1->format(n, res1);
|
|
|
|
f2->format(n, res2);
|
|
|
|
f3->format(n, res3);
|
|
|
|
f4->format(n, res4);
|
|
|
|
f5->format(n, res5);
|
|
|
|
|
2009-11-20 06:28:25 +00:00
|
|
|
unum_formatDouble(uf3.getAlias(), n, ures3, 50, NULL, &status);
|
|
|
|
unum_formatDouble(uf4.getAlias(), n, ures4, 50, NULL, &status);
|
|
|
|
unum_formatDouble(uf5.getAlias(), n, ures5, 50, NULL, &status);
|
2005-07-05 18:39:00 +00:00
|
|
|
|
|
|
|
logln((UnicodeString)"f0 swap int: " + res0);
|
|
|
|
logln((UnicodeString)"f1 src int: " + res1);
|
|
|
|
logln((UnicodeString)"f2 src cur: " + res2);
|
|
|
|
logln((UnicodeString)"f3 reg cur: " + res3);
|
|
|
|
logln((UnicodeString)"f4 reg int: " + res4);
|
|
|
|
logln((UnicodeString)"f5 unreg cur: " + res5);
|
|
|
|
log("uf3 reg cur: ");
|
|
|
|
logln(ures3);
|
|
|
|
log("uf4 reg int: ");
|
|
|
|
logln(ures4);
|
|
|
|
log("uf5 ureg cur: ");
|
|
|
|
logln(ures5);
|
|
|
|
|
2009-11-20 06:28:25 +00:00
|
|
|
if (f3.getAlias() == f3a.getAlias()) {
|
2005-07-05 18:39:00 +00:00
|
|
|
errln("did not get new instance from service");
|
2009-11-20 06:28:25 +00:00
|
|
|
f3a.orphan();
|
2005-07-05 18:39:00 +00:00
|
|
|
}
|
|
|
|
if (res3 != res0) {
|
|
|
|
errln("registered service did not match");
|
|
|
|
}
|
|
|
|
if (res4 != res1) {
|
|
|
|
errln("registered service did not inherit");
|
|
|
|
}
|
|
|
|
if (res5 != res2) {
|
|
|
|
errln("unregistered service did not match original");
|
|
|
|
}
|
2004-11-11 23:34:58 +00:00
|
|
|
|
2005-07-05 18:39:00 +00:00
|
|
|
if (res0 != ures3) {
|
|
|
|
errln("registered service did not match / unum");
|
|
|
|
}
|
|
|
|
if (res1 != ures4) {
|
|
|
|
errln("registered service did not inherit / unum");
|
|
|
|
}
|
|
|
|
if (res2 != ures5) {
|
|
|
|
errln("unregistered service did not match original / unum");
|
|
|
|
}
|
2004-11-11 23:34:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (res = locs->snext(status); res; res = locs->snext(status)) {
|
|
|
|
errln(*res); // service should be out of synch
|
|
|
|
}
|
|
|
|
|
|
|
|
locs->reset(status); // now in synch again, we hope
|
|
|
|
for (res = locs->snext(status); res; res = locs->snext(status)) {
|
|
|
|
logln(*res);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete locs;
|
2004-07-18 02:02:06 +00:00
|
|
|
#endif
|
2003-02-25 23:36:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|