]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/dtfmttst.h
ICU-511.27.tar.gz
[apple/icu.git] / icuSources / test / intltest / dtfmttst.h
CommitLineData
b75a7d8f
A
1/********************************************************************
2 * COPYRIGHT:
51004dcb 3 * Copyright (c) 1997-2013, International Business Machines Corporation and
b75a7d8f
A
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/**
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);
43
44public: // package
45 // internal utility routine (genrates escape sequences for characters)
46 static UnicodeString& escape(UnicodeString& s);
b75a7d8f
A
47
48public:
49 /**
50 * Verify that returned field position indices are correct.
51 */
374ca955 52 void TestFieldPosition(void);
b75a7d8f 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);
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
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);
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);
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
153 virtual void TestDateFormatCalendar(void);
154
155 virtual void TestSpaceParsing(void);
156
157 void TestExactCountFormat(void);
158
159 void TestWhiteSpaceParsing(void);
160
374ca955
A
161 void TestInvalidPattern(void);
162
163 void TestGreekMay(void);
164
73c04bcf
A
165 void TestGenericTime(void);
166
167 void TestGenericTimeZoneOrder(void);
168
7393aa2f
A
169 void Test6338(void);
170
171 void Test6726(void);
172
173 void Test6880(void);
729e4ab9
A
174
175 void TestISOEra(void);
176
177 void TestFormalChineseDate(void);
7393aa2f 178
4388f060
A
179 void TestStandAloneGMTParse(void);
180
181 void TestParsePosition(void);
182
183 void TestMonthPatterns(void);
184
185 void TestContext(void);
186
51004dcb
A
187 void TestNonGregoFmtParse(void);
188
73c04bcf
A
189public:
190 /**
191 * Test host-specific formatting.
192 */
193 void TestHost(void);
194
195public:
196 /**
51004dcb 197 * Test patterns added in CLDR 1.4, CLDR 23
73c04bcf
A
198 */
199 void TestEras(void);
200
201 void TestNarrowNames(void);
202
51004dcb
A
203 void TestShortDays(void);
204
73c04bcf
A
205 void TestStandAloneDays(void);
206
207 void TestStandAloneMonths(void);
208
209 void TestQuarters(void);
46f4442e
A
210
211 void TestZTimeZoneParsing(void);
212
213 void TestRelativeClone(void);
214
215 void TestHostClone(void);
216
7393aa2f
A
217 void TestTimeZoneDisplayName(void);
218
219 void TestRoundtripWithCalendar(void);
7393aa2f 220
46f4442e
A
221public:
222 /***
223 * Test Relative Dates
224 */
225 void TestRelative(void);
46f4442e
A
226/* void TestRelativeError(void);
227 void TestRelativeOther(void);
228*/
229
51004dcb
A
230 void TestDotAndAtLeniency();
231private:
232 UBool showParse(DateFormat &format, const UnicodeString &formattedString);
233
7393aa2f
A
234public:
235 /**
236 * Test parsing a number as a string
237 */
238 void TestNumberAsStringParsing(void);
729e4ab9
A
239
240 private:
46f4442e
A
241 void TestRelative(int daysdelta,
242 const Locale& loc,
243 const char *expectChars);
73c04bcf 244
b75a7d8f
A
245 private:
246 void expectParse(const char** data, int32_t data_length,
247 const Locale& locale);
374ca955
A
248
249 void expect(const char** data, int32_t data_length,
250 const Locale& loc);
73c04bcf
A
251
252 void expectFormat(const char **data, int32_t data_length,
253 const Locale &locale);
b75a7d8f
A
254};
255
256#endif /* #if !UCONFIG_NO_FORMATTING */
257
258#endif // _DATEFORMATTEST_
259//eof