2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2010-01-14 02:23:46 +00:00
|
|
|
* Copyright (c) 1997-2010, International Business Machines
|
2007-07-27 03:12:12 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
2000-01-15 02:00:06 +00:00
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* IntlTestFormat is the medium level test class for everything in the directory "format".
|
|
|
|
*/
|
|
|
|
|
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 "itformat.h"
|
|
|
|
#include "tsdate.h"
|
|
|
|
#include "tsnmfmt.h"
|
|
|
|
#include "caltest.h"
|
|
|
|
#include "callimts.h"
|
|
|
|
#include "tztest.h"
|
|
|
|
#include "tzbdtest.h"
|
|
|
|
#include "tsdcfmsy.h" // DecimalFormatSymbols
|
|
|
|
#include "tchcfmt.h"
|
|
|
|
#include "tsdtfmsy.h" // DateFormatSymbols
|
|
|
|
#include "dcfmapts.h" // DecimalFormatAPI
|
|
|
|
#include "tfsmalls.h" // Format Small Classes
|
|
|
|
#include "nmfmapts.h" // NumberFormatAPI
|
|
|
|
#include "numfmtst.h" // NumberFormatTest
|
|
|
|
#include "sdtfmtts.h" // SimpleDateFormatAPI
|
|
|
|
#include "dtfmapts.h" // DateFormatAPI
|
|
|
|
#include "dtfmttst.h" // DateFormatTest
|
|
|
|
#include "tmsgfmt.h" // TestMessageFormat
|
|
|
|
#include "dtfmrgts.h" // DateFormatRegressionTest
|
1999-10-20 22:08:09 +00:00
|
|
|
#include "msfmrgts.h" // MessageFormatRegressionTest
|
|
|
|
#include "miscdtfm.h" // DateFormatMiscTests
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "nmfmtrt.h" // NumberFormatRoundTripTest
|
|
|
|
#include "numrgts.h" // NumberFormatRegressionTest
|
1999-10-20 22:08:09 +00:00
|
|
|
#include "dtfmtrtts.h" // DateFormatRoundTripTest
|
|
|
|
#include "pptest.h" // ParsePositionTest
|
|
|
|
#include "calregts.h" // CalendarRegressionTest
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "tzregts.h" // TimeZoneRegressionTest
|
2003-11-24 21:36:01 +00:00
|
|
|
#include "astrotst.h" // AstroTest
|
2003-05-16 21:58:37 +00:00
|
|
|
#include "incaltst.h" // IntlCalendarTest
|
2003-12-04 00:47:56 +00:00
|
|
|
#include "calcasts.h" // CalendarCaseTest
|
2007-06-29 03:10:43 +00:00
|
|
|
#include "tzrulets.h" // TimeZoneRuleTest
|
2007-07-12 21:53:20 +00:00
|
|
|
#include "dadrcal.h" // DataDrivenCalendarTest
|
2007-08-10 02:09:24 +00:00
|
|
|
#include "dadrfmt.h" // DataDrivenFormatTest
|
2007-08-03 18:43:04 +00:00
|
|
|
#include "dtptngts.h" // IntlTestDateTimePatternGeneratorAPI
|
2007-11-28 20:49:58 +00:00
|
|
|
#include "tzoffloc.h" // TimeZoneOffsetLocalTest
|
|
|
|
#include "tzfmttst.h" // TimeZoneFormatTest
|
2007-12-17 01:39:55 +00:00
|
|
|
#include "plurults.h" // PluralRulesTest
|
|
|
|
#include "plurfmts.h" // PluralFormatTest
|
2010-01-16 03:07:18 +00:00
|
|
|
#include "selfmts.h" // PluralFormatTest
|
2008-05-28 00:33:44 +00:00
|
|
|
#include "dtifmtts.h" // DateIntervalFormatTest
|
2008-09-19 19:05:37 +00:00
|
|
|
#include "tufmtts.h" // TimeUnitTest
|
2010-01-14 02:23:46 +00:00
|
|
|
#include "locnmtst.h" // LocaleDisplayNamesTest
|
2010-02-26 02:29:00 +00:00
|
|
|
#include "dcfmtest.h" // DecimalFormatTest
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-06-11 17:06:56 +00:00
|
|
|
#define TESTCLASS(id, TestClass) \
|
|
|
|
case id: \
|
|
|
|
name = #TestClass; \
|
|
|
|
if (exec) { \
|
|
|
|
logln(#TestClass " test---"); \
|
|
|
|
logln((UnicodeString)""); \
|
|
|
|
TestClass test; \
|
|
|
|
callTest(test, par); \
|
|
|
|
} \
|
|
|
|
break
|
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
|
1999-08-16 21:50:52 +00:00
|
|
|
{
|
|
|
|
// for all format tests, always set default Locale and TimeZone to ENGLISH and PST.
|
2001-11-20 01:51:19 +00:00
|
|
|
TimeZone* saveDefaultTimeZone = NULL;
|
1999-08-16 21:50:52 +00:00
|
|
|
Locale saveDefaultLocale = Locale::getDefault();
|
|
|
|
if (exec) {
|
|
|
|
saveDefaultTimeZone = TimeZone::createDefault();
|
2006-01-24 22:16:39 +00:00
|
|
|
TimeZone *tz = TimeZone::createTimeZone("PST");
|
1999-08-16 21:50:52 +00:00
|
|
|
TimeZone::setDefault(*tz);
|
|
|
|
delete tz;
|
1999-10-07 00:07:53 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
2001-11-20 01:51:19 +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("itformat: couldn't set default Locale to ENGLISH!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (exec) logln("TestSuite Format: ");
|
|
|
|
switch (index) {
|
2001-06-11 17:06:56 +00:00
|
|
|
TESTCLASS(0,IntlTestDateFormat);
|
|
|
|
TESTCLASS(1,IntlTestNumberFormat);
|
|
|
|
TESTCLASS(2,CalendarTest);
|
|
|
|
TESTCLASS(3,CalendarLimitTest);
|
|
|
|
TESTCLASS(4,TimeZoneTest);
|
|
|
|
TESTCLASS(5,TimeZoneBoundaryTest);
|
|
|
|
TESTCLASS(6,TestChoiceFormat);
|
|
|
|
TESTCLASS(7,IntlTestDecimalFormatSymbols);
|
|
|
|
TESTCLASS(8,IntlTestDateFormatSymbols);
|
|
|
|
TESTCLASS(9,IntlTestDecimalFormatAPI);
|
|
|
|
TESTCLASS(10,TestFormatSmallClasses);
|
|
|
|
TESTCLASS(11,IntlTestNumberFormatAPI);
|
|
|
|
TESTCLASS(12,IntlTestSimpleDateFormatAPI);
|
|
|
|
TESTCLASS(13,IntlTestDateFormatAPI);
|
|
|
|
TESTCLASS(14,DateFormatTest);
|
|
|
|
TESTCLASS(15,TestMessageFormat);
|
|
|
|
TESTCLASS(16,NumberFormatTest);
|
|
|
|
TESTCLASS(17,DateFormatRegressionTest);
|
|
|
|
TESTCLASS(18,MessageFormatRegressionTest);
|
|
|
|
TESTCLASS(19,DateFormatMiscTests);
|
|
|
|
TESTCLASS(20,NumberFormatRoundTripTest);
|
|
|
|
TESTCLASS(21,NumberFormatRegressionTest);
|
|
|
|
TESTCLASS(22,DateFormatRoundTripTest);
|
|
|
|
TESTCLASS(23,ParsePositionTest);
|
|
|
|
TESTCLASS(24,CalendarRegressionTest);
|
|
|
|
TESTCLASS(25,TimeZoneRegressionTest);
|
2003-12-04 00:47:56 +00:00
|
|
|
TESTCLASS(26,IntlCalendarTest);
|
|
|
|
TESTCLASS(27,AstroTest);
|
|
|
|
TESTCLASS(28,CalendarCaseTest);
|
2007-06-29 03:10:43 +00:00
|
|
|
TESTCLASS(29,TimeZoneRuleTest);
|
2009-08-04 21:09:17 +00:00
|
|
|
#if !UCONFIG_NO_FILE_IO && !UCONFIG_NO_LEGACY_CONVERSION
|
2007-07-12 21:53:20 +00:00
|
|
|
TESTCLASS(30,DataDrivenCalendarTest);
|
2007-08-10 02:09:24 +00:00
|
|
|
TESTCLASS(31,DataDrivenFormatTest);
|
2009-08-04 21:09:17 +00:00
|
|
|
#endif
|
2007-08-10 02:09:24 +00:00
|
|
|
TESTCLASS(32,IntlTestDateTimePatternGeneratorAPI);
|
2007-11-28 20:49:58 +00:00
|
|
|
TESTCLASS(33,TimeZoneOffsetLocalTest);
|
|
|
|
TESTCLASS(34,TimeZoneFormatTest);
|
2007-12-17 01:39:55 +00:00
|
|
|
TESTCLASS(35,PluralRulesTest);
|
|
|
|
TESTCLASS(36,PluralFormatTest);
|
2008-05-28 00:33:44 +00:00
|
|
|
TESTCLASS(37,DateIntervalFormatTest);
|
2008-09-19 19:05:37 +00:00
|
|
|
TESTCLASS(38,TimeUnitTest);
|
2010-05-07 07:28:47 +00:00
|
|
|
TESTCLASS(39,SelectFormatTest);
|
|
|
|
TESTCLASS(40,LocaleDisplayNamesTest);
|
|
|
|
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
|
2010-02-26 02:29:00 +00:00
|
|
|
TESTCLASS(41,DecimalFormatTest);
|
2010-05-07 07:28:47 +00:00
|
|
|
#endif
|
2001-06-11 17:06:56 +00:00
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
default: name = ""; break; //needed to end loop
|
|
|
|
}
|
|
|
|
if (exec) {
|
|
|
|
// restore saved Locale and TimeZone
|
|
|
|
TimeZone::adoptDefault(saveDefaultTimeZone);
|
1999-10-07 00:07:53 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
1999-08-16 21:50:52 +00:00
|
|
|
Locale::setDefault( saveDefaultLocale, status );
|
1999-10-18 22:48:32 +00:00
|
|
|
if (U_FAILURE(status)) {
|
1999-08-16 21:50:52 +00:00
|
|
|
errln("itformat: couldn't re-set default Locale!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-09-21 00:43:14 +00:00
|
|
|
|
|
|
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|