]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/itformat.cpp
ICU-400.38.tar.gz
[apple/icu.git] / icuSources / test / intltest / itformat.cpp
CommitLineData
b75a7d8f
A
1/********************************************************************
2 * COPYRIGHT:
46f4442e
A
3 * Copyright (c) 1997-2008, International Business Machines
4 * Corporation and others. All Rights Reserved.
b75a7d8f
A
5 ********************************************************************/
6
7/**
8 * IntlTestFormat is the medium level test class for everything in the directory "format".
9 */
10
11#include "unicode/utypes.h"
12
13#if !UCONFIG_NO_FORMATTING
14
15#include "itformat.h"
16#include "tsdate.h"
17#include "tsnmfmt.h"
18#include "caltest.h"
19#include "callimts.h"
20#include "tztest.h"
21#include "tzbdtest.h"
22#include "tsdcfmsy.h" // DecimalFormatSymbols
23#include "tchcfmt.h"
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
374ca955 42#include "astrotst.h" // AstroTest
b75a7d8f 43#include "incaltst.h" // IntlCalendarTest
374ca955 44#include "calcasts.h" // CalendarCaseTest
46f4442e
A
45#include "tzrulets.h" // TimeZoneRuleTest
46#include "dadrcal.h" // DataDrivenCalendarTest
47#include "dadrfmt.h" // DataDrivenFormatTest
48#include "dtptngts.h" // IntlTestDateTimePatternGeneratorAPI
49#include "tzoffloc.h" // TimeZoneOffsetLocalTest
50#include "tzfmttst.h" // TimeZoneFormatTest
51#include "plurults.h" // PluralRulesTest
52#include "plurfmts.h" // PluralFormatTest
53#include "dtifmtts.h" // DateIntervalFormatTest
b75a7d8f
A
54
55#define TESTCLASS(id, TestClass) \
56 case id: \
57 name = #TestClass; \
58 if (exec) { \
59 logln(#TestClass " test---"); \
60 logln((UnicodeString)""); \
61 TestClass test; \
62 callTest(test, par); \
63 } \
64 break
65
66void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
67{
68 // for all format tests, always set default Locale and TimeZone to ENGLISH and PST.
69 TimeZone* saveDefaultTimeZone = NULL;
70 Locale saveDefaultLocale = Locale::getDefault();
71 if (exec) {
72 saveDefaultTimeZone = TimeZone::createDefault();
73 TimeZone *tz = TimeZone::createTimeZone("PST");
74 TimeZone::setDefault(*tz);
75 delete tz;
76 UErrorCode status = U_ZERO_ERROR;
77 Locale::setDefault( Locale::getEnglish(), status );
78 if (U_FAILURE(status)) {
79 errln("itformat: couldn't set default Locale to ENGLISH!");
80 }
81 }
82 if (exec) logln("TestSuite Format: ");
83 switch (index) {
84 TESTCLASS(0,IntlTestDateFormat);
85 TESTCLASS(1,IntlTestNumberFormat);
86 TESTCLASS(2,CalendarTest);
87 TESTCLASS(3,CalendarLimitTest);
88 TESTCLASS(4,TimeZoneTest);
89 TESTCLASS(5,TimeZoneBoundaryTest);
90 TESTCLASS(6,TestChoiceFormat);
91 TESTCLASS(7,IntlTestDecimalFormatSymbols);
92 TESTCLASS(8,IntlTestDateFormatSymbols);
93 TESTCLASS(9,IntlTestDecimalFormatAPI);
94 TESTCLASS(10,TestFormatSmallClasses);
95 TESTCLASS(11,IntlTestNumberFormatAPI);
96 TESTCLASS(12,IntlTestSimpleDateFormatAPI);
97 TESTCLASS(13,IntlTestDateFormatAPI);
98 TESTCLASS(14,DateFormatTest);
99 TESTCLASS(15,TestMessageFormat);
100 TESTCLASS(16,NumberFormatTest);
101 TESTCLASS(17,DateFormatRegressionTest);
102 TESTCLASS(18,MessageFormatRegressionTest);
103 TESTCLASS(19,DateFormatMiscTests);
104 TESTCLASS(20,NumberFormatRoundTripTest);
105 TESTCLASS(21,NumberFormatRegressionTest);
106 TESTCLASS(22,DateFormatRoundTripTest);
107 TESTCLASS(23,ParsePositionTest);
108 TESTCLASS(24,CalendarRegressionTest);
109 TESTCLASS(25,TimeZoneRegressionTest);
110 TESTCLASS(26,IntlCalendarTest);
374ca955
A
111 TESTCLASS(27,AstroTest);
112 TESTCLASS(28,CalendarCaseTest);
46f4442e
A
113 TESTCLASS(29,TimeZoneRuleTest);
114 TESTCLASS(30,DataDrivenCalendarTest);
115 TESTCLASS(31,DataDrivenFormatTest);
116 TESTCLASS(32,IntlTestDateTimePatternGeneratorAPI);
117 TESTCLASS(33,TimeZoneOffsetLocalTest);
118 TESTCLASS(34,TimeZoneFormatTest);
119 TESTCLASS(35,PluralRulesTest);
120 TESTCLASS(36,PluralFormatTest);
121 TESTCLASS(37,DateIntervalFormatTest);
b75a7d8f 122
b75a7d8f
A
123 default: name = ""; break; //needed to end loop
124 }
125 if (exec) {
126 // restore saved Locale and TimeZone
127 TimeZone::adoptDefault(saveDefaultTimeZone);
128 UErrorCode status = U_ZERO_ERROR;
129 Locale::setDefault( saveDefaultLocale, status );
130 if (U_FAILURE(status)) {
131 errln("itformat: couldn't re-set default Locale!");
132 }
133 }
134}
135
136#endif /* #if !UCONFIG_NO_FORMATTING */