mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ticket: 4092: revert the changes
X-SVN-Rev: 16665
This commit is contained in:
parent
be1919a36a
commit
a0611c7e7a
13 changed files with 49 additions and 359 deletions
|
@ -201,17 +201,6 @@ void AstroTest::TestCoverage(void) {
|
|||
|
||||
closeAstro(status);
|
||||
ASSERT_OK(status);
|
||||
|
||||
CalendarAstronomer::AUTUMN_EQUINOX();
|
||||
CalendarAstronomer::FIRST_QUARTER();
|
||||
CalendarAstronomer::LAST_QUARTER();
|
||||
CalendarAstronomer::NEW_MOON();
|
||||
CalendarAstronomer::VERNAL_EQUINOX();
|
||||
CalendarAstronomer::WINTER_SOLSTICE();
|
||||
CalendarAstronomer::Ecliptic ecliptic;
|
||||
CalendarAstronomer::MoonAge moon_age(0);
|
||||
ecliptic.set(0,0);
|
||||
moon_age.set(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -539,21 +539,16 @@ void CalendarRegressionTest::dowTest(UBool lenient)
|
|||
errln("FAIL: actual minimum differs from minimum");
|
||||
}
|
||||
if(cal->getActualMinimum(Calendar::DAY_OF_WEEK, status) != min) {
|
||||
errln("FAIL: actual minimum (Calendar::DAY_OF_WEEK, status) differs from minimum");
|
||||
}
|
||||
if(cal->getActualMinimum(Calendar::DAY_OF_WEEK) != min) {
|
||||
errln("FAIL: actual minimum (Calendar::DAY_OF_WEEK) differs from minimum");
|
||||
}
|
||||
|
||||
Calendar * calendar = cal;
|
||||
if(calendar->getActualMinimum(UCAL_DAY_OF_WEEK, status) != min) {
|
||||
if(((Calendar*)cal)->getActualMinimum(UCAL_DAY_OF_WEEK, status) != min) {
|
||||
errln("FAIL: actual minimum (UCAL_DAY_OF_WEEK, status) differs from minimum");
|
||||
}
|
||||
if(calendar->getActualMinimum(Calendar::DAY_OF_WEEK, status) != min) {
|
||||
errln("FAIL: actual minimum (Calendar::DAY_OF_WEEK, status) differs from minimum");
|
||||
}
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
// NOTE: This function does not exist! jitterbug #3016
|
||||
// if(((Calendar*)cal)->getActualMinimum(Calendar::DAY_OF_WEEK, status) != min) {
|
||||
// errln("FAIL: actual minimum (Calendar::DAY_OF_WEEK, status) differs from minimum");
|
||||
// }
|
||||
if(U_FAILURE(status)) {
|
||||
errln("Error getting actual minimum: %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,11 +12,6 @@
|
|||
#include "unicode/gregocal.h"
|
||||
#include "unicode/smpdtfmt.h"
|
||||
#include "unicode/simpletz.h"
|
||||
#include "buddhcal.h"
|
||||
#include "islamcal.h"
|
||||
#include "japancal.h"
|
||||
#include "hebrwcal.h"
|
||||
#include "gregoimp.h"
|
||||
|
||||
// *****************************************************************************
|
||||
// class CalendarTest
|
||||
|
@ -199,98 +194,11 @@ void CalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
|
|||
TestJD();
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
name = "TestCoverage";
|
||||
if(exec) {
|
||||
logln("TestCoverage---"); logln("");
|
||||
TestCoverage();
|
||||
}
|
||||
break;
|
||||
|
||||
default: name = ""; break;
|
||||
}
|
||||
}
|
||||
|
||||
void CalendarTest::TestCoverage(void){
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
//Calendar::Calendar(UErrorCode& success)
|
||||
Calendar * cal = Calendar::createInstance(status);
|
||||
|
||||
URegistryKey rkey = Calendar::registerFactory(NULL, status);
|
||||
Calendar::unregister(rkey, status);
|
||||
|
||||
//Calendar::roll(EDateFields field, int32_t amount, UErrorCode& status);
|
||||
IslamicCalendar ic(Locale::getEnglish(), status);
|
||||
ic.roll(Calendar::SECOND, 1, status);
|
||||
|
||||
//IslamicCalendar
|
||||
ic.isCivil();
|
||||
ic.setCivil(IslamicCalendar::CIVIL,status);
|
||||
|
||||
////GregorianCalendar
|
||||
//GregorianCalendar gc(Locale::getEnglish(), status);
|
||||
//gc.getActualMaximum(Calendar::SECOND);
|
||||
|
||||
Grego::previousMonthLength(0,0);
|
||||
Grego::millisToJulianDay(0);
|
||||
|
||||
//BuddhistCalendar& operator=(const BuddhistCalendar& right);
|
||||
BuddhistCalendar bc(Locale::getSimplifiedChinese(), status);
|
||||
BuddhistCalendar bc2(Locale::getSimplifiedChinese(), status);
|
||||
bc2 = bc;
|
||||
|
||||
//JapaneseCalendar& operator=(const JapaneseCalendar& right);
|
||||
JapaneseCalendar jc(Locale::getEnglish(), status);
|
||||
JapaneseCalendar jc2(Locale::getEnglish(), status);
|
||||
jc2 = jc;
|
||||
jc.defaultCenturyStart();
|
||||
jc.defaultCenturyStartYear();
|
||||
|
||||
HebrewCalendar hc(Locale::getEnglish(), status);
|
||||
hc.roll(Calendar::SECOND, 1, status);
|
||||
hc.roll(UCAL_MONTH,1,status);
|
||||
hc.add(Calendar::SECOND, 1, status);
|
||||
|
||||
//cal->getActualMaximum(UCAL_DATE, status);
|
||||
//cal->getActualMaximum(UCAL_DAY_OF_YEAR, status);
|
||||
|
||||
//BuddhistCalendar bc(Locale::getSimplifiedChinese(), status);
|
||||
//cal->setTime(0,status);
|
||||
//cal->set(UCAL_HOUR,0);
|
||||
|
||||
// class Calendar_stub : public Calendar{
|
||||
// public:
|
||||
// Calendar_stub::Calendar_stub(UErrorCode& success): Calendar(success){}
|
||||
// public:
|
||||
//virtual Calendar* clone(void) {return NULL};
|
||||
// virtual UBool inDaylightTime(UErrorCode& status) const {return FALSE};
|
||||
// virtual UClassID getDynamicClassID(void) const {return NULL};
|
||||
// virtual const char * getType() const {return NULL};
|
||||
|
||||
// virtual UBool haveDefaultCentury() const {return FALSE};
|
||||
// virtual UDate defaultCenturyStart() const {return 0};
|
||||
//virtual int32_t defaultCenturyStartYear() const {return 0};
|
||||
|
||||
// protected:
|
||||
// virtual int32_t handleGetExtendedYear() {return 0};
|
||||
// virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const {return 0};
|
||||
// virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
|
||||
// UBool useMonth) const {return 0};
|
||||
// };
|
||||
|
||||
// status = U_ZERO_ERROR;
|
||||
// Calendar_stub temp(status);
|
||||
//cal->setTime(0,status);
|
||||
//cal->set(UCAL_HOUR,0);
|
||||
// cal->clear(UCAL_HOUR);
|
||||
delete cal;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
UnicodeString CalendarTest::fieldName(UCalendarDateFields f) {
|
||||
|
@ -1932,9 +1840,6 @@ void CalendarTest::TestYWOY()
|
|||
void CalendarTest::TestJD()
|
||||
{
|
||||
int32_t jd;
|
||||
|
||||
#undef kEpochStartAsJulianDay // because we included "gregoimp.h"
|
||||
|
||||
static const int32_t kEpochStartAsJulianDay = 2440588;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
GregorianCalendar cal(status);
|
||||
|
|
|
@ -20,9 +20,6 @@ public:
|
|||
// IntlTest override
|
||||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
|
||||
public:
|
||||
|
||||
void TestCoverage(void);
|
||||
|
||||
/**
|
||||
* This test confirms the correct behavior of add when incrementing
|
||||
* through subsequent days.
|
||||
|
|
|
@ -34,20 +34,20 @@ class ICUNSubclass : public ICUNotifier {
|
|||
};
|
||||
|
||||
class LKFSubclass : public LocaleKeyFactory {
|
||||
Hashtable table;
|
||||
Hashtable table;
|
||||
|
||||
public:
|
||||
LKFSubclass(UBool visible)
|
||||
: LocaleKeyFactory(visible ? VISIBLE : INVISIBLE, "LKFSubclass")
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
table.put("en_US", this, status);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
table.put("en_US", this, status);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual const Hashtable* getSupportedIDs(UErrorCode &/*status*/) const {
|
||||
return &table;
|
||||
}
|
||||
virtual const Hashtable* getSupportedIDs(UErrorCode &/*status*/) const {
|
||||
return &table;
|
||||
}
|
||||
};
|
||||
|
||||
class Integer : public UObject {
|
||||
|
@ -300,7 +300,7 @@ void
|
|||
ICUServiceTest::msgstr(const UnicodeString& message, UObject* obj, UBool err)
|
||||
{
|
||||
if (obj) {
|
||||
UnicodeString* str = (UnicodeString*)obj;
|
||||
UnicodeString* str = (UnicodeString*)obj;
|
||||
logln(message + *str);
|
||||
delete str;
|
||||
} else if (err) {
|
||||
|
@ -317,7 +317,7 @@ ICUServiceTest::testAPI_One()
|
|||
// register an object with one locale,
|
||||
// search for an object with a more specific locale
|
||||
// should return the original object
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Integer* singleton0 = new Integer(0);
|
||||
service.registerInstance(singleton0, "en_US", status);
|
||||
{
|
||||
|
@ -442,7 +442,7 @@ ICUServiceTest::testAPI_One()
|
|||
confirmEqual("17) get invisible", result, singleton5);
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
||||
// should not be able to locate invisible services
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
@ -532,17 +532,17 @@ class TestMultipleKeyStringFactory : public ICUServiceFactory {
|
|||
|
||||
UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
UnicodeString temp;
|
||||
key.currentID(temp);
|
||||
if (U_SUCCESS(_status)) {
|
||||
if (_ids.contains(&temp)) {
|
||||
if (_ids.contains(&temp)) {
|
||||
return new UnicodeString(_factoryID + temp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
status = _status;
|
||||
}
|
||||
status = _status;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,7 @@ const char TestMultipleKeyStringFactory::fgClassID = '\0';
|
|||
void
|
||||
ICUServiceTest::testAPI_Two()
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
TestStringService service;
|
||||
service.registerFactory(new AnonymousStringFactory(), status);
|
||||
|
||||
|
@ -858,7 +858,7 @@ void
|
|||
ICUServiceTest::testRBF()
|
||||
{
|
||||
// resource bundle factory.
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
TestStringService service;
|
||||
service.registerFactory(new ICUResourceBundleFactory(), status);
|
||||
|
||||
|
@ -1002,7 +1002,7 @@ class TestStringLocaleService : public ICULocaleService {
|
|||
};
|
||||
|
||||
void ICUServiceTest::testLocale() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
TestStringLocaleService service;
|
||||
|
||||
UnicodeString* root = new UnicodeString("root");
|
||||
|
@ -1092,7 +1092,7 @@ void ICUServiceTest::testLocale() {
|
|||
}
|
||||
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UnicodeString english = "en";
|
||||
Locale localeResult;
|
||||
UnicodeString result;
|
||||
|
@ -1184,7 +1184,7 @@ class WrapFactory : public ICUServiceFactory {
|
|||
public:
|
||||
static const UnicodeString& getGreetingID() {
|
||||
if (greetingID == NULL) {
|
||||
greetingID = new UnicodeString("greeting");
|
||||
greetingID = new UnicodeString("greeting");
|
||||
}
|
||||
return *greetingID;
|
||||
}
|
||||
|
@ -1246,7 +1246,7 @@ ICUServiceTest::testWrapFactory()
|
|||
{
|
||||
UnicodeString* greeting = new UnicodeString("Hello There");
|
||||
UnicodeString greetingID = "greeting";
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
TestStringService service;
|
||||
service.registerInstance(greeting, greetingID, status);
|
||||
|
||||
|
@ -1274,22 +1274,6 @@ ICUServiceTest::testWrapFactory()
|
|||
// misc coverage tests
|
||||
void ICUServiceTest::testCoverage()
|
||||
{
|
||||
//ICUService
|
||||
{
|
||||
TestStringService service;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UVector result(status);
|
||||
service.getDisplayNames(result, status);
|
||||
|
||||
class ICUService_stub_sub : public ICUService{
|
||||
virtual UObject* cloneInstance(UObject* instance) const{return NULL;};
|
||||
};
|
||||
|
||||
ICUService_stub_sub service2;
|
||||
service2.createSimpleFactory(NULL,NULL,FALSE,status);
|
||||
service2.createKey(NULL,status);
|
||||
}
|
||||
|
||||
// ICUServiceKey
|
||||
{
|
||||
UnicodeString temp;
|
||||
|
@ -1302,11 +1286,6 @@ void ICUServiceTest::testCoverage()
|
|||
if (key.getDynamicClassID() != ICUServiceKey::getStaticClassID()) {
|
||||
errln("service key rtt failed.");
|
||||
}
|
||||
|
||||
key.currentDescriptor(temp);
|
||||
key.isFallbackOf(NULL);
|
||||
key.parsePrefix(temp);
|
||||
key.prefix(temp);
|
||||
}
|
||||
|
||||
// SimpleFactory
|
||||
|
@ -1330,10 +1309,10 @@ void ICUServiceTest::testCoverage()
|
|||
{
|
||||
UnicodeString* result = (UnicodeString*)service.get("object", status);
|
||||
if (result) {
|
||||
logln("object is: " + *result);
|
||||
delete result;
|
||||
logln("object is: " + *result);
|
||||
delete result;
|
||||
} else {
|
||||
errln("could not get object");
|
||||
errln("could not get object");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -756,7 +756,6 @@ void LocaleTest::doTestDisplayNames(Locale& displayLocale, int32_t compareIndex)
|
|||
UnicodeString testName;
|
||||
|
||||
testLocale.getDisplayLanguage(displayLocale, testLang);
|
||||
testLocale.getDisplayScript(testScript); // for coverage
|
||||
testLocale.getDisplayScript(displayLocale, testScript);
|
||||
testLocale.getDisplayCountry(displayLocale, testCtry);
|
||||
testLocale.getDisplayVariant(displayLocale, testVar);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "unicode/ustring.h"
|
||||
#include "unicode/measfmt.h"
|
||||
#include "unicode/curramt.h"
|
||||
#include "unicode/choicfmt.h"
|
||||
#include "digitlst.h"
|
||||
#include "textfile.h"
|
||||
#include "tokiter.h"
|
||||
|
@ -77,7 +76,6 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
|
|||
CASE(27,TestCases);
|
||||
|
||||
CASE(28,TestCurrencyNames);
|
||||
CASE(29,TestCoverage);
|
||||
|
||||
default: name = ""; break;
|
||||
}
|
||||
|
@ -116,51 +114,6 @@ NumberFormatTest::TestAPI(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
NumberFormatTest::TestCoverage(void)
|
||||
{
|
||||
double limits[] = {1,2,3,4,5,6,7};
|
||||
UnicodeString monthNames[] = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
|
||||
ChoiceFormat cf(limits, monthNames,7);
|
||||
|
||||
int64_t number = 0;
|
||||
UnicodeString r;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
cf.format(number, r, status);
|
||||
|
||||
NumberFormat & nf = cf;
|
||||
UnicodeString text("Wed");
|
||||
Formattable result;
|
||||
ParsePosition pos;
|
||||
|
||||
//NumberFormat::parseCurrency()
|
||||
//NumberFormat::getEffectiveCurrency()
|
||||
nf.parseCurrency(text, result, pos);
|
||||
|
||||
//stuff coverage tests for other format classes
|
||||
status = U_ZERO_ERROR;
|
||||
UnicodeString pattern(UChar(0xa4));
|
||||
DecimalFormat df(pattern, status); //DecimalFormat::setCurrencyForLocale()
|
||||
df.setCurrency(NULL);
|
||||
|
||||
UChar cc[] = {'C', 'N', 'Y'};
|
||||
status = U_ZERO_ERROR;
|
||||
CurrencyAmount ca(0,cc,status);
|
||||
CurrencyAmount ca2(ca);
|
||||
ca2 = ca;
|
||||
delete ca.clone();
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
CurrencyUnit cu(cc, status);
|
||||
CurrencyUnit cu2(cu);
|
||||
cu2 = cu;
|
||||
delete cu.clone();
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
delete MeasureFormat::createCurrencyFormat(status);
|
||||
|
||||
}
|
||||
|
||||
// Test various patterns
|
||||
void
|
||||
NumberFormatTest::TestPatterns(void)
|
||||
|
@ -462,15 +415,7 @@ NumberFormatTest::TestInt64() {
|
|||
expect(fmt, (Formattable)(int64_t)U_INT64_MAX, "9.223372036854775807E18");
|
||||
expect(fmt, (Formattable)(int64_t)U_INT64_MIN, "-9.223372036854775808E18");
|
||||
}
|
||||
|
||||
{ // for coverage
|
||||
NumberFormat & numFmt= fmt;
|
||||
int64_t t = (int64_t) 0;
|
||||
UnicodeString r;
|
||||
numFmt.format(t,r);
|
||||
//FieldPosition f;
|
||||
//numFmt.format(t,r,f);
|
||||
}
|
||||
|
||||
// also test digitlist
|
||||
int64_t int64max = U_INT64_MAX;
|
||||
int64_t int64min = U_INT64_MIN;
|
||||
|
|
|
@ -28,9 +28,6 @@ class NumberFormatTest: public CalendarTimeZoneTest {
|
|||
* Test APIs (to increase code coverage)
|
||||
*/
|
||||
void TestAPI(void);
|
||||
|
||||
void TestCoverage(void);
|
||||
|
||||
/**
|
||||
* Test the handling of quotes
|
||||
**/
|
||||
|
|
|
@ -501,7 +501,7 @@ int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
|
|||
logln(UnicodeString() + msg + " = [" + buf + "] (" + toString(i) + ")");
|
||||
#else
|
||||
logln(UnicodeString() + msg + " = [" + buf + "] (??? NO_FORMATTING)");
|
||||
#endif
|
||||
#endif
|
||||
assertTrue("count verified", i==n);
|
||||
// did we see all expected strings?
|
||||
if (((1<<expectedCount)-1) != seenMask) {
|
||||
|
@ -545,7 +545,6 @@ void CollationServiceTest::TestSeparateTree() {
|
|||
if (!assertTrue("getKeywords != NULL", iter!=NULL)) return;
|
||||
if (!assertSuccess("getKeywords", ec)) return;
|
||||
checkStringEnumeration("getKeywords", *iter, KW, KW_COUNT);
|
||||
iter->reset(ec);
|
||||
delete iter;
|
||||
|
||||
iter = Collator::getKeywordValues(KW[0], ec);
|
||||
|
|
|
@ -159,12 +159,8 @@ void test_FieldPosition( void )
|
|||
|
||||
void test_Formattable( void )
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Formattable* ftp = new Formattable();
|
||||
if (!ftp || !(ftp->getType() == Formattable::kLong)
|
||||
|| !(ftp->getLong() == 0)
|
||||
|| !(ftp->getLong(status) == 0)
|
||||
|| !(ftp->getLong(&status) == 0)) {
|
||||
if (!ftp || !(ftp->getType() == Formattable::kLong) || !(ftp->getLong() == 0)) {
|
||||
it_errln("*** Formattable constructor or getType or getLong");
|
||||
}
|
||||
delete ftp;
|
||||
|
@ -183,39 +179,23 @@ void test_Formattable( void )
|
|||
it_errln("*** FT operator= or operator== or operator!=");
|
||||
}
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
fta.setDouble( 3.0 );
|
||||
if ((fta.getType() == Formattable::kDouble)
|
||||
&& (fta.getDouble() == 3.0)
|
||||
&& (fta.getDouble(status) == 3.0)) {
|
||||
if ((fta.getType() == Formattable::kDouble) && (fta.getDouble() == 3.0)) {
|
||||
it_logln("FT set- and getDouble tested.");
|
||||
}else{
|
||||
it_errln("*** FT set- or getDouble");
|
||||
}
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
const Formattable ftd(4.0, Formattable::kIsDate);
|
||||
fta.setDate( 4.0 );
|
||||
if ((fta.getType() == Formattable::kDate)
|
||||
&& (fta.getDate() == 4.0)
|
||||
&& (fta.getDate(status) == 4.0)
|
||||
&& (ftd.getDate(status) == 4.0)) { // const
|
||||
if ((fta.getType() == Formattable::kDate) && (fta.getDate() == 4.0)) {
|
||||
it_logln("FT set- and getDate tested.");
|
||||
}else{
|
||||
it_errln("*** FT set- or getDate");
|
||||
}
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
const Formattable ftc("abc");
|
||||
fta.setString("abc");
|
||||
UnicodeString res;
|
||||
if ((fta.getType() == Formattable::kString)
|
||||
&& (fta.getString(res) == "abc")
|
||||
&& (fta.getString(res,status) == "abc")
|
||||
&& (fta.getString() == "abc")
|
||||
&& (ftc.getString() == "abc") // const
|
||||
&& (fta.getString(status) == "abc")
|
||||
&& (ftc.getString(status) == "abc")) { // const
|
||||
if ((fta.getType() == Formattable::kString) && (fta.getString(res) == "abc")) {
|
||||
it_logln("FT set- and getString tested.");
|
||||
}else{
|
||||
it_errln("*** FT set- or getString");
|
||||
|
@ -246,15 +226,6 @@ void test_Formattable( void )
|
|||
it_errln("*** FT constr. for date, double, long, ustring, ustring* or array");
|
||||
}
|
||||
|
||||
{
|
||||
status = U_ZERO_ERROR;
|
||||
int32_t res_cnt;
|
||||
const Formattable* res_array2 = ft_arr.getArray(res_cnt ,status );
|
||||
|
||||
Formattable a(0);
|
||||
a.getString(status); //test getBogus();
|
||||
}
|
||||
|
||||
int32_t i, res_cnt;
|
||||
const Formattable* res_array = ft_arr.getArray( res_cnt );
|
||||
if (res_cnt == ft_cnt) {
|
||||
|
|
|
@ -845,7 +845,7 @@ void TransliteratorAPITest::TestGetAdoptFilter(){
|
|||
got = data;
|
||||
t->transliterate(got);
|
||||
doTest("transliteration using (o,w) filter", got, exp);
|
||||
delete t->orphanFilter(); // for coverage
|
||||
|
||||
delete t;
|
||||
|
||||
}
|
||||
|
|
|
@ -3643,10 +3643,10 @@ void TransliteratorTest::TestMulticharStringSet() {
|
|||
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
// BEGIN TestUserFunction support factory
|
||||
|
||||
Transliterator* _TUFF[5];
|
||||
UnicodeString* _TUFID[5];
|
||||
Transliterator* _TUFF[4];
|
||||
UnicodeString* _TUFID[4];
|
||||
|
||||
static Transliterator* _TUFFactory(const UnicodeString& /*ID*/,
|
||||
static Transliterator* U_EXPORT2 _TUFFactory(const UnicodeString& /*ID*/,
|
||||
Transliterator::Token context) {
|
||||
return _TUFF[context.integer]->clone();
|
||||
}
|
||||
|
@ -3665,19 +3665,6 @@ static void _TUFUnreg(int32_t n) {
|
|||
}
|
||||
}
|
||||
|
||||
static Transliterator* _TUFFactory2(const UnicodeString& /*ID*/,
|
||||
Transliterator::Token context) {
|
||||
int32_t i = * (int32_t *)context.pointer;
|
||||
return _TUFF[i]->clone();
|
||||
}
|
||||
|
||||
static void _TUFReg2(const UnicodeString& ID, Transliterator* t, int32_t* p) {
|
||||
int32_t n = *p;
|
||||
_TUFF[n] = t;
|
||||
_TUFID[n] = new UnicodeString(ID);
|
||||
Transliterator::registerFactory(ID, _TUFFactory2, Transliterator::pointerToken(p));
|
||||
}
|
||||
|
||||
// END TestUserFunction support factory
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -3692,9 +3679,8 @@ void TransliteratorTest::TestUserFunction() {
|
|||
UErrorCode ec = U_ZERO_ERROR;
|
||||
|
||||
// Setup our factory
|
||||
int32_t temp = 4;
|
||||
int32_t i;
|
||||
for (i=0; i<5; ++i) {
|
||||
for (i=0; i<4; ++i) {
|
||||
_TUFF[i] = NULL;
|
||||
}
|
||||
|
||||
|
@ -3707,7 +3693,7 @@ void TransliteratorTest::TestUserFunction() {
|
|||
return;
|
||||
}
|
||||
_TUFReg("Any-gif", t, 0);
|
||||
|
||||
|
||||
t = Transliterator::createFromRules("RemoveCurly",
|
||||
"[\\{\\}] > ; '\\N' > ;",
|
||||
UTRANS_FORWARD, pe, ec);
|
||||
|
@ -3755,7 +3741,7 @@ void TransliteratorTest::TestUserFunction() {
|
|||
"<img src=\"http://www.unicode.org/gifs/24/00/U0062.gif\">");
|
||||
delete t;
|
||||
|
||||
// Test that filters are allowed after &
|
||||
// Test that filters are allowed after &
|
||||
t = Transliterator::createFromRules("test",
|
||||
"(.) > &Hex($1) ' ' &RemoveCurly(&Name($1)) ' ';",
|
||||
UTRANS_FORWARD, pe, ec);
|
||||
|
@ -3763,20 +3749,12 @@ void TransliteratorTest::TestUserFunction() {
|
|||
errln((UnicodeString)"FAIL: createFromRules test " + u_errorName(ec));
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
logln("Registering");
|
||||
_TUFReg2("test", t, &temp);
|
||||
t = Transliterator::createInstance("test", UTRANS_FORWARD, ec);
|
||||
if (t == NULL || U_FAILURE(ec)) {
|
||||
errln((UnicodeString)"FAIL: createInstance test " + u_errorName(ec));
|
||||
goto FAIL;
|
||||
}
|
||||
expect(*t, "abc",
|
||||
"\\u0061 LATIN SMALL LETTER A \\u0062 LATIN SMALL LETTER B \\u0063 LATIN SMALL LETTER C ");
|
||||
delete t;
|
||||
|
||||
FAIL:
|
||||
for (i=0; i<5; ++i) {
|
||||
for (i=0; i<4; ++i) {
|
||||
_TUFUnreg(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ const char *ids_class[MAX_CLASS_ID];
|
|||
uint32_t ids_count = 0;
|
||||
|
||||
UObject *UObjectTest::testClass(UObject *obj,
|
||||
const char *className, const char *factory,
|
||||
UClassID staticID)
|
||||
const char *className, const char *factory,
|
||||
UClassID staticID)
|
||||
{
|
||||
uint32_t i;
|
||||
UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
|
||||
|
@ -94,11 +94,11 @@ UObject *UObjectTest::testClass(UObject *obj,
|
|||
for(i=0;i<ids_count;i++) {
|
||||
if(staticID == ids[i]) {
|
||||
if(!strcmp(ids_class[i], className)) {
|
||||
logln("OK: ID found is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
|
||||
return obj;
|
||||
logln("OK: ID found is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
|
||||
return obj;
|
||||
} else {
|
||||
errln("FAIL: ID is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
|
||||
return obj;
|
||||
errln("FAIL: ID is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,10 +151,6 @@ UObject *UObjectTest::testClass(UObject *obj,
|
|||
#include "uni2name.h"
|
||||
#include "uvector.h"
|
||||
#include "islamcal.h"
|
||||
#include "gregoimp.h"
|
||||
#include "currfmt.h"
|
||||
#include "iculserv.h"
|
||||
#include "transreg.h"
|
||||
|
||||
// External Things
|
||||
#include "unicode/brkiter.h"
|
||||
|
@ -343,66 +339,6 @@ void UObjectTest::testIDs()
|
|||
logln(UnicodeString(junk));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Coverage Tests
|
||||
//
|
||||
|
||||
//ServiceEnumeration
|
||||
StringEnumeration* localeEnum = Collator::getAvailableLocales();
|
||||
localeEnum->getDynamicClassID();
|
||||
delete localeEnum;
|
||||
|
||||
//UStringEnumeration
|
||||
status = U_ZERO_ERROR;
|
||||
StringEnumeration *iter = Collator::getKeywords(status);
|
||||
iter->getDynamicClassID();
|
||||
delete iter;
|
||||
|
||||
//SimpleLocaleKeyFactory
|
||||
SimpleLocaleKeyFactory temp_slkf (NULL, UnicodeString("bar"), 8, 12);
|
||||
temp_slkf.getDynamicClassID();
|
||||
|
||||
//StringMatcher
|
||||
//StringMatcher temp_sm (UnicodeString("test string"), 0,0,0,TransliterationRuleData(status));
|
||||
//temp_sm.getDynamicClassID();
|
||||
|
||||
//StringReplacer
|
||||
//status = U_ZERO_ERROR;
|
||||
//StringReplacer temp_sr(UnicodeString(),new TransliterationRuleData(status));
|
||||
|
||||
//CalendarData
|
||||
status = U_ZERO_ERROR;
|
||||
CalendarData temp_cd(Locale::getEnglish(),NULL,status);
|
||||
temp_cd.getDynamicClassID();
|
||||
|
||||
//CurrencyFormat
|
||||
status = U_ZERO_ERROR;
|
||||
CurrencyFormat temp_cf(Locale::getEnglish(),status);
|
||||
temp_cf.getDynamicClassID();
|
||||
|
||||
//FunctionReplacer
|
||||
FunctionReplacer temp_fr(NULL, NULL);
|
||||
temp_fr.getDynamicClassID();
|
||||
|
||||
ICUResourceBundleFactory temp_irbf;
|
||||
temp_irbf.getDynamicClassID();
|
||||
|
||||
//LocaleKeyFactory temp_lkf(0);
|
||||
//temp_lkf.getDynamicClassID();
|
||||
|
||||
//status = U_ZERO_ERROR;
|
||||
//NFSubstitution* temp_nfs = NFSubstitution::makeSubstitution(0, NULL, NULL, NULL, NULL, NULL, status);
|
||||
//temp_nfs->getDynamicClassID();
|
||||
//delete temp_nfs;
|
||||
|
||||
//status = U_ZERO_ERROR;
|
||||
//NumeratorSubstitution temp_ns(0, 0, NULL, NULL, NULL,status);
|
||||
//temp_ns.getDynamicClassID();
|
||||
|
||||
//Quantifier temp_q(NULL, 0, 0);
|
||||
//temp_q.getDynamicClassID();
|
||||
|
||||
//TransliteratorRegistry::Enumeration temp_tre(NULL);
|
||||
}
|
||||
|
||||
void UObjectTest::testUMemory() {
|
||||
|
|
Loading…
Add table
Reference in a new issue