]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/dtfmttst.h
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / dtfmttst.h
CommitLineData
b75a7d8f 1/********************************************************************
2ca993e8
A
2 * COPYRIGHT:
3 * Copyright (c) 1997-2016, International Business Machines Corporation and
b75a7d8f
A
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7#ifndef _DATEFORMATTEST_
8#define _DATEFORMATTEST_
2ca993e8 9
b75a7d8f
A
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
2ca993e8 18/**
729e4ab9 19 * Performs many different tests for DateFormat and SimpleDateFormat
b75a7d8f
A
20 **/
21class DateFormatTest: public CalendarTimeZoneTest {
22 // IntlTest override
23 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
24public:
51004dcb
A
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();
b75a7d8f
A
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);
2ca993e8 43
b75a7d8f
A
44public: // package
45 // internal utility routine (genrates escape sequences for characters)
46 static UnicodeString& escape(UnicodeString& s);
2ca993e8 47
b75a7d8f
A
48public:
49 /**
50 * Verify that returned field position indices are correct.
51 */
374ca955 52 void TestFieldPosition(void);
2ca993e8 53
374ca955
A
54 void TestGeneral();
55
b75a7d8f
A
56public: // package
57 // internal utility function
58 static void getFieldText(DateFormat* df, int32_t field, UDate date, UnicodeString& str);
2ca993e8 59
b75a7d8f
A
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);
2ca993e8 67
b75a7d8f
A
68public: // package
69 // internal test subroutine, used by TestPartialParse994
70 virtual void tryPat994(SimpleDateFormat* format, const char* pat, const char* str, UDate expected);
2ca993e8 71
b75a7d8f
A
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);
2ca993e8 83
b75a7d8f
A
84public: // package
85 // internal test subroutine, used by TestRunTogetherPattern917
86 virtual void testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected);
2ca993e8 87
b75a7d8f
A
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);
2ca993e8 102
b75a7d8f
A
103public: // package
104 // interl test subroutine, used by TestDayOfYearPattern195
105 virtual void tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, UDate expected);
2ca993e8 106
b75a7d8f
A
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);
2ca993e8 116
b75a7d8f
A
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);
2ca993e8 128
b75a7d8f
A
129public: // package
130 // internal test subroutine, used by TestTwoDigitYear
131 virtual void parse2DigitYear(DateFormat& fmt, const char* str, UDate expected);
2ca993e8 132
b75a7d8f
A
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);
73c04bcf
A
142
143 void TestTimeZoneStringsAPI(void);
7393aa2f 144
7393aa2f 145 void TestGMTParsing(void);
7393aa2f 146
b75a7d8f
A
147public: // package
148 /**
149 * Test the formatting of dates in different locales.
150 */
151 virtual void TestLocaleDateFormat(void);
152
b331163b
A
153 virtual void TestFormattingLocaleTimeSeparator(void);
154
b75a7d8f
A
155 virtual void TestDateFormatCalendar(void);
156
157 virtual void TestSpaceParsing(void);
158
159 void TestExactCountFormat(void);
160
161 void TestWhiteSpaceParsing(void);
162
374ca955
A
163 void TestInvalidPattern(void);
164
165 void TestGreekMay(void);
166
73c04bcf
A
167 void TestGenericTime(void);
168
169 void TestGenericTimeZoneOrder(void);
170
7393aa2f
A
171 void Test6338(void);
172
173 void Test6726(void);
174
175 void Test6880(void);
729e4ab9
A
176
177 void TestISOEra(void);
178
179 void TestFormalChineseDate(void);
7393aa2f 180
4388f060
A
181 void TestStandAloneGMTParse(void);
182
183 void TestParsePosition(void);
184
185 void TestMonthPatterns(void);
186
187 void TestContext(void);
188
51004dcb
A
189 void TestNonGregoFmtParse(void);
190
2ca993e8
A
191 void TestFormatsWithNumberSystems(void);
192
73c04bcf
A
193public:
194 /**
195 * Test host-specific formatting.
196 */
197 void TestHost(void);
198
199public:
200 /**
51004dcb 201 * Test patterns added in CLDR 1.4, CLDR 23
73c04bcf
A
202 */
203 void TestEras(void);
204
205 void TestNarrowNames(void);
206
51004dcb
A
207 void TestShortDays(void);
208
73c04bcf
A
209 void TestStandAloneDays(void);
210
211 void TestStandAloneMonths(void);
212
213 void TestQuarters(void);
2ca993e8 214
46f4442e
A
215 void TestZTimeZoneParsing(void);
216
217 void TestRelativeClone(void);
2ca993e8 218
46f4442e
A
219 void TestHostClone(void);
220
b331163b
A
221 void TestHebrewClone(void);
222
223 void TestDateFormatSymbolsClone(void);
224
7393aa2f
A
225 void TestTimeZoneDisplayName(void);
226
227 void TestRoundtripWithCalendar(void);
7393aa2f 228
46f4442e
A
229public:
230 /***
231 * Test Relative Dates
232 */
233 void TestRelative(void);
46f4442e
A
234/* void TestRelativeError(void);
235 void TestRelativeOther(void);
236*/
237
51004dcb 238 void TestDotAndAtLeniency();
57a6839d
A
239
240 void TestDateFormatLeniency();
241
242 void TestParseMultiPatternMatch();
243
244 void TestParseLeniencyAPIs();
245
b331163b
A
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
2ca993e8
A
255 void TestPatternFromSkeleton();
256
257 void TestAmPmMidnightNoon();
258 void TestFlexibleDayPeriod();
259 void TestDayPeriodWithLocales();
260 void TestMinuteSecondFieldsInOddPlaces();
261 void TestDayPeriodParsing();
262
51004dcb
A
263private:
264 UBool showParse(DateFormat &format, const UnicodeString &formattedString);
265
7393aa2f
A
266public:
267 /**
268 * Test parsing a number as a string
269 */
270 void TestNumberAsStringParsing(void);
729e4ab9
A
271
272 private:
2ca993e8 273 void TestRelative(int daysdelta,
46f4442e
A
274 const Locale& loc,
275 const char *expectChars);
73c04bcf 276
b75a7d8f
A
277 private:
278 void expectParse(const char** data, int32_t data_length,
279 const Locale& locale);
374ca955
A
280
281 void expect(const char** data, int32_t data_length,
282 const Locale& loc);
73c04bcf
A
283
284 void expectFormat(const char **data, int32_t data_length,
285 const Locale &locale);
2ca993e8 286
b75a7d8f
A
287};
288
289#endif /* #if !UCONFIG_NO_FORMATTING */
2ca993e8 290
b75a7d8f
A
291#endif // _DATEFORMATTEST_
292//eof