]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/dtfmttst.h
1 /********************************************************************
3 * Copyright (c) 1997-2013, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #ifndef _DATEFORMATTEST_
8 #define _DATEFORMATTEST_
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
14 #include "unicode/datefmt.h"
15 #include "unicode/smpdtfmt.h"
19 * Performs many different tests for DateFormat and SimpleDateFormat
21 class DateFormatTest
: public CalendarTimeZoneTest
{
23 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
);
26 * Verify that patterns have the correct values and could produce
27 * the DateFormat instances that contain the correct localized patterns.
31 * "Test written by Wally Wedel and emailed to me."
32 * Test handling of timezone offsets
34 virtual void TestWallyWedel(void);
38 virtual void TestEquals(void);
40 * Test the parsing of 2-digit years.
42 virtual void TestTwoDigitYearDSTParse(void);
45 // internal utility routine (genrates escape sequences for characters)
46 static UnicodeString
& escape(UnicodeString
& s
);
50 * Verify that returned field position indices are correct.
52 void TestFieldPosition(void);
57 // internal utility function
58 static void getFieldText(DateFormat
* df
, int32_t field
, UDate date
, UnicodeString
& str
);
62 * Verify that strings which contain incomplete specifications are parsed
63 * correctly. In some instances, this means not being parsed at all, and
64 * returning an appropriate error.
66 virtual void TestPartialParse994(void);
69 // internal test subroutine, used by TestPartialParse994
70 virtual void tryPat994(SimpleDateFormat
* format
, const char* pat
, const char* str
, UDate expected
);
74 * Verify the behavior of patterns in which digits for different fields run together
75 * without intervening separators.
77 virtual void TestRunTogetherPattern985(void);
79 * Verify the behavior of patterns in which digits for different fields run together
80 * without intervening separators.
82 virtual void TestRunTogetherPattern917(void);
85 // internal test subroutine, used by TestRunTogetherPattern917
86 virtual void testIt917(SimpleDateFormat
* fmt
, UnicodeString
& str
, UDate expected
);
90 * Verify the handling of Czech June and July, which have the unique attribute that
91 * one is a proper prefix substring of the other.
93 virtual void TestCzechMonths459(void);
95 * Test the handling of 'D' in patterns.
97 virtual void TestLetterDPattern212(void);
99 * Test the day of year pattern.
101 virtual void TestDayOfYearPattern195(void);
104 // interl test subroutine, used by TestDayOfYearPattern195
105 virtual void tryPattern(SimpleDateFormat
& sdf
, UDate d
, const char* pattern
, UDate expected
);
109 * Test the handling of single quotes in patterns.
111 virtual void TestQuotePattern161(void);
113 * Verify the correct behavior when handling invalid input strings.
115 virtual void TestBadInput135(void);
119 * Verify the correct behavior when parsing an array of inputs against an
120 * array of patterns, with known results. The results are encoded after
121 * the input strings in each row.
123 virtual void TestBadInput135a(void);
125 * Test the parsing of two-digit years.
127 virtual void TestTwoDigitYear(void);
130 // internal test subroutine, used by TestTwoDigitYear
131 virtual void parse2DigitYear(DateFormat
& fmt
, const char* str
, UDate expected
);
135 * Test the formatting of time zones.
137 virtual void TestDateFormatZone061(void);
139 * Further test the formatting of time zones.
141 virtual void TestDateFormatZone146(void);
143 void TestTimeZoneStringsAPI(void);
145 void TestGMTParsing(void);
149 * Test the formatting of dates in different locales.
151 virtual void TestLocaleDateFormat(void);
153 virtual void TestDateFormatCalendar(void);
155 virtual void TestSpaceParsing(void);
157 void TestExactCountFormat(void);
159 void TestWhiteSpaceParsing(void);
161 void TestInvalidPattern(void);
163 void TestGreekMay(void);
165 void TestGenericTime(void);
167 void TestGenericTimeZoneOrder(void);
175 void TestISOEra(void);
177 void TestFormalChineseDate(void);
179 void TestStandAloneGMTParse(void);
181 void TestParsePosition(void);
183 void TestMonthPatterns(void);
185 void TestContext(void);
187 void TestNonGregoFmtParse(void);
191 * Test host-specific formatting.
197 * Test patterns added in CLDR 1.4, CLDR 23
201 void TestNarrowNames(void);
203 void TestShortDays(void);
205 void TestStandAloneDays(void);
207 void TestStandAloneMonths(void);
209 void TestQuarters(void);
211 void TestZTimeZoneParsing(void);
213 void TestRelativeClone(void);
215 void TestHostClone(void);
217 void TestTimeZoneDisplayName(void);
219 void TestRoundtripWithCalendar(void);
223 * Test Relative Dates
225 void TestRelative(void);
226 /* void TestRelativeError(void);
227 void TestRelativeOther(void);
230 void TestDotAndAtLeniency();
232 UBool
showParse(DateFormat
&format
, const UnicodeString
&formattedString
);
236 * Test parsing a number as a string
238 void TestNumberAsStringParsing(void);
241 void TestRelative(int daysdelta
,
243 const char *expectChars
);
246 void expectParse(const char** data
, int32_t data_length
,
247 const Locale
& locale
);
249 void expect(const char** data
, int32_t data_length
,
252 void expectFormat(const char **data
, int32_t data_length
,
253 const Locale
&locale
);
256 #endif /* #if !UCONFIG_NO_FORMATTING */
258 #endif // _DATEFORMATTEST_