1 /********************************************************************
3 * Copyright (c) 1997-2003, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
8 * IntlTestFormat is the medium level test class for everything in the directory "format".
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
22 #include "tsdcfmsy.h" // DecimalFormatSymbols
24 #include "tsdtfmsy.h" // DateFormatSymbols
25 #include "dcfmapts.h" // DecimalFormatAPI
26 #include "tfsmalls.h" // Format Small Classes
27 #include "nmfmapts.h" // NumberFormatAPI
28 #include "numfmtst.h" // NumberFormatTest
29 #include "sdtfmtts.h" // SimpleDateFormatAPI
30 #include "dtfmapts.h" // DateFormatAPI
31 #include "dtfmttst.h" // DateFormatTest
32 #include "tmsgfmt.h" // TestMessageFormat
33 #include "dtfmrgts.h" // DateFormatRegressionTest
34 #include "msfmrgts.h" // MessageFormatRegressionTest
35 #include "miscdtfm.h" // DateFormatMiscTests
36 #include "nmfmtrt.h" // NumberFormatRoundTripTest
37 #include "numrgts.h" // NumberFormatRegressionTest
38 #include "dtfmtrtts.h" // DateFormatRoundTripTest
39 #include "pptest.h" // ParsePositionTest
40 #include "calregts.h" // CalendarRegressionTest
41 #include "tzregts.h" // TimeZoneRegressionTest
42 #include "astrotst.h" // AstroTest
43 #include "incaltst.h" // IntlCalendarTest
44 #include "calcasts.h" // CalendarCaseTest
46 #define TESTCLASS(id, TestClass) \
50 logln(#TestClass " test---"); \
51 logln((UnicodeString)""); \
53 callTest(test, par); \
57 void IntlTestFormat::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
)
59 // for all format tests, always set default Locale and TimeZone to ENGLISH and PST.
60 TimeZone
* saveDefaultTimeZone
= NULL
;
61 Locale saveDefaultLocale
= Locale::getDefault();
63 saveDefaultTimeZone
= TimeZone::createDefault();
64 TimeZone
*tz
= TimeZone::createTimeZone("PST");
65 TimeZone::setDefault(*tz
);
67 UErrorCode status
= U_ZERO_ERROR
;
68 Locale::setDefault( Locale::getEnglish(), status
);
69 if (U_FAILURE(status
)) {
70 errln("itformat: couldn't set default Locale to ENGLISH!");
73 if (exec
) logln("TestSuite Format: ");
75 TESTCLASS(0,IntlTestDateFormat
);
76 TESTCLASS(1,IntlTestNumberFormat
);
77 TESTCLASS(2,CalendarTest
);
78 TESTCLASS(3,CalendarLimitTest
);
79 TESTCLASS(4,TimeZoneTest
);
80 TESTCLASS(5,TimeZoneBoundaryTest
);
81 TESTCLASS(6,TestChoiceFormat
);
82 TESTCLASS(7,IntlTestDecimalFormatSymbols
);
83 TESTCLASS(8,IntlTestDateFormatSymbols
);
84 TESTCLASS(9,IntlTestDecimalFormatAPI
);
85 TESTCLASS(10,TestFormatSmallClasses
);
86 TESTCLASS(11,IntlTestNumberFormatAPI
);
87 TESTCLASS(12,IntlTestSimpleDateFormatAPI
);
88 TESTCLASS(13,IntlTestDateFormatAPI
);
89 TESTCLASS(14,DateFormatTest
);
90 TESTCLASS(15,TestMessageFormat
);
91 TESTCLASS(16,NumberFormatTest
);
92 TESTCLASS(17,DateFormatRegressionTest
);
93 TESTCLASS(18,MessageFormatRegressionTest
);
94 TESTCLASS(19,DateFormatMiscTests
);
95 TESTCLASS(20,NumberFormatRoundTripTest
);
96 TESTCLASS(21,NumberFormatRegressionTest
);
97 TESTCLASS(22,DateFormatRoundTripTest
);
98 TESTCLASS(23,ParsePositionTest
);
99 TESTCLASS(24,CalendarRegressionTest
);
100 TESTCLASS(25,TimeZoneRegressionTest
);
101 TESTCLASS(26,IntlCalendarTest
);
102 TESTCLASS(27,AstroTest
);
103 TESTCLASS(28,CalendarCaseTest
);
105 default: name
= ""; break; //needed to end loop
108 // restore saved Locale and TimeZone
109 TimeZone::adoptDefault(saveDefaultTimeZone
);
110 UErrorCode status
= U_ZERO_ERROR
;
111 Locale::setDefault( saveDefaultLocale
, status
);
112 if (U_FAILURE(status
)) {
113 errln("itformat: couldn't re-set default Locale!");
118 #endif /* #if !UCONFIG_NO_FORMATTING */