]> git.saurik.com Git - apple/icu.git/blame_incremental - icuSources/test/intltest/dtfmttst.h
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / dtfmttst.h
... / ...
CommitLineData
1/********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2016, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7#ifndef _DATEFORMATTEST_
8#define _DATEFORMATTEST_
9
10#include "unicode/utypes.h"
11
12#if !UCONFIG_NO_FORMATTING
13
14#include "unicode/datefmt.h"
15#include "unicode/smpdtfmt.h"
16#include "caltztst.h"
17
18/**
19 * Performs many different tests for DateFormat and SimpleDateFormat
20 **/
21class DateFormatTest: public CalendarTimeZoneTest {
22 // IntlTest override
23 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
24public:
25 /**
26 * Verify that patterns have the correct values and could produce
27 * the DateFormat instances that contain the correct localized patterns.
28 */
29 void TestPatterns();
30 /**
31 * "Test written by Wally Wedel and emailed to me."
32 * Test handling of timezone offsets
33 **/
34 virtual void TestWallyWedel(void);
35 /**
36 * Test operator==
37 */
38 virtual void TestEquals(void);
39 /**
40 * Test the parsing of 2-digit years.
41 */
42 virtual void TestTwoDigitYearDSTParse(void);
43
44public: // package
45 // internal utility routine (genrates escape sequences for characters)
46 static UnicodeString& escape(UnicodeString& s);
47
48public:
49 /**
50 * Verify that returned field position indices are correct.
51 */
52 void TestFieldPosition(void);
53
54 void TestGeneral();
55
56public: // package
57 // internal utility function
58 static void getFieldText(DateFormat* df, int32_t field, UDate date, UnicodeString& str);
59
60public:
61 /**
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.
65 */
66 virtual void TestPartialParse994(void);
67
68public: // package
69 // internal test subroutine, used by TestPartialParse994
70 virtual void tryPat994(SimpleDateFormat* format, const char* pat, const char* str, UDate expected);
71
72public:
73 /**
74 * Verify the behavior of patterns in which digits for different fields run together
75 * without intervening separators.
76 */
77 virtual void TestRunTogetherPattern985(void);
78 /**
79 * Verify the behavior of patterns in which digits for different fields run together
80 * without intervening separators.
81 */
82 virtual void TestRunTogetherPattern917(void);
83
84public: // package
85 // internal test subroutine, used by TestRunTogetherPattern917
86 virtual void testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected);
87
88public:
89 /**
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.
92 */
93 virtual void TestCzechMonths459(void);
94 /**
95 * Test the handling of 'D' in patterns.
96 */
97 virtual void TestLetterDPattern212(void);
98 /**
99 * Test the day of year pattern.
100 */
101 virtual void TestDayOfYearPattern195(void);
102
103public: // package
104 // interl test subroutine, used by TestDayOfYearPattern195
105 virtual void tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, UDate expected);
106
107public:
108 /**
109 * Test the handling of single quotes in patterns.
110 */
111 virtual void TestQuotePattern161(void);
112 /**
113 * Verify the correct behavior when handling invalid input strings.
114 */
115 virtual void TestBadInput135(void);
116
117public:
118 /**
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.
122 */
123 virtual void TestBadInput135a(void);
124 /**
125 * Test the parsing of two-digit years.
126 */
127 virtual void TestTwoDigitYear(void);
128
129public: // package
130 // internal test subroutine, used by TestTwoDigitYear
131 virtual void parse2DigitYear(DateFormat& fmt, const char* str, UDate expected);
132
133public:
134 /**
135 * Test the formatting of time zones.
136 */
137 virtual void TestDateFormatZone061(void);
138 /**
139 * Further test the formatting of time zones.
140 */
141 virtual void TestDateFormatZone146(void);
142
143 void TestTimeZoneStringsAPI(void);
144
145 void TestGMTParsing(void);
146
147public: // package
148 /**
149 * Test the formatting of dates in different locales.
150 */
151 virtual void TestLocaleDateFormat(void);
152
153 virtual void TestFormattingLocaleTimeSeparator(void);
154
155 virtual void TestDateFormatCalendar(void);
156
157 virtual void TestSpaceParsing(void);
158
159 void TestExactCountFormat(void);
160
161 void TestWhiteSpaceParsing(void);
162
163 void TestInvalidPattern(void);
164
165 void TestGreekMay(void);
166
167 void TestGenericTime(void);
168
169 void TestGenericTimeZoneOrder(void);
170
171 void Test6338(void);
172
173 void Test6726(void);
174
175 void Test6880(void);
176
177 void TestISOEra(void);
178
179 void TestFormalChineseDate(void);
180
181 void TestStandAloneGMTParse(void);
182
183 void TestParsePosition(void);
184
185 void TestMonthPatterns(void);
186
187 void TestContext(void);
188
189 void TestNonGregoFmtParse(void);
190
191 void TestFormatsWithNumberSystems(void);
192
193public:
194 /**
195 * Test host-specific formatting.
196 */
197 void TestHost(void);
198
199public:
200 /**
201 * Test patterns added in CLDR 1.4, CLDR 23
202 */
203 void TestEras(void);
204
205 void TestNarrowNames(void);
206
207 void TestShortDays(void);
208
209 void TestStandAloneDays(void);
210
211 void TestStandAloneMonths(void);
212
213 void TestQuarters(void);
214
215 void TestZTimeZoneParsing(void);
216
217 void TestRelativeClone(void);
218
219 void TestHostClone(void);
220
221 void TestHebrewClone(void);
222
223 void TestDateFormatSymbolsClone(void);
224
225 void TestTimeZoneDisplayName(void);
226
227 void TestRoundtripWithCalendar(void);
228
229public:
230 /***
231 * Test Relative Dates
232 */
233 void TestRelative(void);
234/* void TestRelativeError(void);
235 void TestRelativeOther(void);
236*/
237
238 void TestDotAndAtLeniency();
239
240 void TestDateFormatLeniency();
241
242 void TestParseMultiPatternMatch();
243
244 void TestParseLeniencyAPIs();
245
246 // test override NumberFormat
247 void TestNumberFormatOverride();
248 void TestCreateInstanceForSkeleton();
249 void TestCreateInstanceForSkeletonDefault();
250 void TestCreateInstanceForSkeletonWithCalendar();
251 void TestDFSCreateForLocaleNonGregorianLocale();
252 void TestDFSCreateForLocaleWithCalendarInLocale();
253 void TestChangeCalendar();
254
255 void TestPatternFromSkeleton();
256
257 void TestAmPmMidnightNoon();
258 void TestFlexibleDayPeriod();
259 void TestDayPeriodWithLocales();
260 void TestMinuteSecondFieldsInOddPlaces();
261 void TestDayPeriodParsing();
262
263private:
264 UBool showParse(DateFormat &format, const UnicodeString &formattedString);
265
266public:
267 /**
268 * Test parsing a number as a string
269 */
270 void TestNumberAsStringParsing(void);
271
272 private:
273 void TestRelative(int daysdelta,
274 const Locale& loc,
275 const char *expectChars);
276
277 private:
278 void expectParse(const char** data, int32_t data_length,
279 const Locale& locale);
280
281 void expect(const char** data, int32_t data_length,
282 const Locale& loc);
283
284 void expectFormat(const char **data, int32_t data_length,
285 const Locale &locale);
286
287};
288
289#endif /* #if !UCONFIG_NO_FORMATTING */
290
291#endif // _DATEFORMATTEST_
292//eof