1
/********************************************************************
3
* Copyright (c) 1997-2001, 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"
19
#include "tsdcfmsy.h" // DecimalFormatSymbols
21
#include "tsdtfmsy.h" // DateFormatSymbols
22
#include "dcfmapts.h" // DecimalFormatAPI
23
#include "tfsmalls.h" // Format Small Classes
24
#include "nmfmapts.h" // NumberFormatAPI
25
#include "numfmtst.h" // NumberFormatTest
26
#include "sdtfmtts.h" // SimpleDateFormatAPI
27
#include "dtfmapts.h" // DateFormatAPI
28
#include "dtfmttst.h" // DateFormatTest
29
#include "tmsgfmt.h" // TestMessageFormat
30
#include "dtfmrgts.h" // DateFormatRegressionTest
31
#include "msfmrgts.h" // MessageFormatRegressionTest
32
#include "miscdtfm.h" // DateFormatMiscTests
33
#include "nmfmtrt.h" // NumberFormatRoundTripTest
34
#include "numrgts.h" // NumberFormatRegressionTest
35
#include "dtfmtrtts.h" // DateFormatRoundTripTest
36
#include "pptest.h" // ParsePositionTest
37
#include "calregts.h" // CalendarRegressionTest
38
#include "tzregts.h" // TimeZoneRegressionTest
40
#define TESTCLASS(id, TestClass) \
44
logln(#TestClass " test---"); \
45
logln((UnicodeString)""); \
47
callTest(test, par); \
51
void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
53
// for all format tests, always set default Locale and TimeZone to ENGLISH and PST.
54
TimeZone* saveDefaultTimeZone = NULL;
55
Locale saveDefaultLocale = Locale::getDefault();
57
saveDefaultTimeZone = TimeZone::createDefault();
58
TimeZone *tz = TimeZone::createTimeZone("PST");
59
TimeZone::setDefault(*tz);
61
UErrorCode status = U_ZERO_ERROR;
62
Locale::setDefault( Locale::getEnglish(), status );
63
if (U_FAILURE(status)) {
64
errln("itformat: couldn't set default Locale to ENGLISH!");
67
if (exec) logln("TestSuite Format: ");
69
TESTCLASS(0,IntlTestDateFormat);
70
TESTCLASS(1,IntlTestNumberFormat);
71
TESTCLASS(2,CalendarTest);
72
TESTCLASS(3,CalendarLimitTest);
73
TESTCLASS(4,TimeZoneTest);
74
TESTCLASS(5,TimeZoneBoundaryTest);
75
TESTCLASS(6,TestChoiceFormat);
76
TESTCLASS(7,IntlTestDecimalFormatSymbols);
77
TESTCLASS(8,IntlTestDateFormatSymbols);
78
TESTCLASS(9,IntlTestDecimalFormatAPI);
79
TESTCLASS(10,TestFormatSmallClasses);
80
TESTCLASS(11,IntlTestNumberFormatAPI);
81
TESTCLASS(12,IntlTestSimpleDateFormatAPI);
82
TESTCLASS(13,IntlTestDateFormatAPI);
83
TESTCLASS(14,DateFormatTest);
84
TESTCLASS(15,TestMessageFormat);
85
TESTCLASS(16,NumberFormatTest);
86
TESTCLASS(17,DateFormatRegressionTest);
87
TESTCLASS(18,MessageFormatRegressionTest);
88
TESTCLASS(19,DateFormatMiscTests);
89
TESTCLASS(20,NumberFormatRoundTripTest);
90
TESTCLASS(21,NumberFormatRegressionTest);
91
TESTCLASS(22,DateFormatRoundTripTest);
92
TESTCLASS(23,ParsePositionTest);
93
TESTCLASS(24,CalendarRegressionTest);
94
TESTCLASS(25,TimeZoneRegressionTest);
96
//TESTCLASS(0,IntlTestDateFormatSymbolsC);
97
//TESTCLASS(0,IntlTestDecimalFormatSymbolsC);
98
//TESTCLASS(0,IntlTestSimpleDateFormatAPIC);
99
//TESTCLASS(0,IntlTestDateFormatAPIC);
100
//TESTCLASS(0,IntlTestDecimalFormatAPIC);
101
//TESTCLASS(0,IntlTestNumberFormatAPIC);
102
//TESTCLASS(0,CNumberSpelloutFormatTest);
103
//TESTCLASS(0,CNumberSpelloutFormatRoundTripTest);
104
//TESTCLASS(0,TestCwrapperFormatSmallClasses);
105
//TESTCLASS(0,TestCwrapperMessageFormat);
106
//TESTCLASS(0,TestCwrapperChoiceFormat);
107
//TESTCLASS(0,TestCwrapperCalendar);
108
//TESTCLASS(0,TestCwrapperTimeZone);
109
default: name = ""; break; //needed to end loop
112
// restore saved Locale and TimeZone
113
TimeZone::adoptDefault(saveDefaultTimeZone);
114
UErrorCode status = U_ZERO_ERROR;
115
Locale::setDefault( saveDefaultLocale, status );
116
if (U_FAILURE(status)) {
117
errln("itformat: couldn't re-set default Locale!");