]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/caltest.h
ICU-62123.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / caltest.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
374ca955 3/***********************************************************************
2ca993e8 4 * Copyright (c) 1997-2016, International Business Machines Corporation
374ca955
A
5 * and others. All Rights Reserved.
6 ***********************************************************************/
b75a7d8f
A
7
8#ifndef __CalendarTest__
9#define __CalendarTest__
2ca993e8 10
b75a7d8f
A
11#include "unicode/utypes.h"
12
13#if !UCONFIG_NO_FORMATTING
14
15#include "unicode/calendar.h"
16#include "unicode/smpdtfmt.h"
17#include "caltztst.h"
18
19class CalendarTest: public CalendarTimeZoneTest {
20public:
21 // IntlTest override
22 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
23public:
24 /**
25 * This test confirms the correct behavior of add when incrementing
26 * through subsequent days.
27 */
28 virtual void TestRog(void);
29 /**
30 * Test the handling of the day of the week, checking for correctness and
31 * for correct minimum and maximum values.
32 */
33 virtual void TestDOW943(void);
34 /**
35 * test subroutine use by TestDOW943
36 */
37 void dowTest(UBool lenient);
2ca993e8 38 /**
b75a7d8f
A
39 * Confirm that cloned Calendar objects do not inadvertently share substructures.
40 */
41 virtual void TestClonesUnique908(void);
42 /**
43 * Confirm that the Gregorian cutoff value works as advertised.
44 */
45 virtual void TestGregorianChange768(void);
46 /**
47 * Confirm the functioning of the field disambiguation algorithm.
48 */
49 virtual void TestDisambiguation765(void);
50 /**
51 * Test various API methods for API completeness.
52 */
53 virtual void TestGenericAPI(void); // New to C++ -- needs to be back ported to Java
54
55 virtual void TestWOY(void);
2ca993e8 56
46f4442e 57 virtual void TestDebug(void);
2ca993e8 58
b75a7d8f
A
59public: // package
60 /**
61 * test subroutine used by TestDisambiguation765
62 */
63 virtual void verify765(const UnicodeString& msg, Calendar* c, int32_t year, int32_t month, int32_t day);
64 /**
65 * test subroutine used by TestDisambiguation765
66 */
67 virtual void verify765(const UnicodeString& msg/*, IllegalArgumentException e*/, UErrorCode status);
2ca993e8 68
b75a7d8f
A
69public:
70 /**
71 * Confirm that the offset between local time and GMT behaves as expected.
72 */
73 virtual void TestGMTvsLocal4064654(void);
2ca993e8 74
b75a7d8f
A
75public: // package
76 /**
77 * test subroutine used by TestGMTvsLocal4064654
78 */
79 virtual void test4064654(int32_t yr, int32_t mo, int32_t dt, int32_t hr, int32_t mn, int32_t sc);
2ca993e8 80
b75a7d8f
A
81public:
82 /**
83 * The operations of adding and setting should not exhibit pathological
84 * dependence on the order of operations. This test checks for this.
85 */
86 virtual void TestAddSetOrder621(void);
87 /**
88 * Confirm that adding to various fields works.
89 */
90 virtual void TestAdd520(void);
91 /**
92 * Execute and test adding and rolling in GregorianCalendar extensively.
93 */
94 virtual void TestAddRollExtensive(void);
95
96public: // package
97 // internal utility routine for checking date
2ca993e8
A
98 virtual void check520(Calendar* c,
99 int32_t y, int32_t m, int32_t d,
100 int32_t hr, int32_t min, int32_t sec,
b75a7d8f 101 int32_t ms, UCalendarDateFields field);
2ca993e8
A
102
103 virtual void check520(Calendar* c,
b75a7d8f
A
104 int32_t y, int32_t m, int32_t d);
105
106public:
107 /**
108 * Test that setting of fields works. In particular, make sure that all instances
109 * of GregorianCalendar don't share a static instance of the fields array.
110 */
111 virtual void TestFieldSet4781(void);
112/* virtual void TestSerialize337();
2ca993e8 113
b75a7d8f
A
114public: // package
115 static UnicodeString& PREFIX;
116 static UnicodeString& POSTFIX;
117 static UnicodeString& FILENAME;
2ca993e8 118*/
b75a7d8f
A
119public:
120 /**
121 * Verify that the seconds of a Calendar can be zeroed out through the
122 * expected sequence of operations.
2ca993e8 123 */
b75a7d8f
A
124 virtual void TestSecondsZero121(void);
125 /**
126 * Verify that a specific sequence of adding and setting works as expected;
127 * it should not vary depending on when and whether the get method is
128 * called.
129 */
130 virtual void TestAddSetGet0610(void);
2ca993e8 131
b75a7d8f
A
132public: // package
133 // internal routine for checking date
134 static UnicodeString value(Calendar* calendar);
2ca993e8 135
b75a7d8f
A
136public:
137 /**
138 * Verify that various fields on a known date are set correctly.
139 */
140 virtual void TestFields060(void);
2ca993e8 141
b75a7d8f
A
142public: // package
143 static int32_t EXPECTED_FIELDS[];
144 static const int32_t EXPECTED_FIELDS_length;
2ca993e8 145
b75a7d8f
A
146public:
147 /**
148 * Verify that various fields on a known date are set correctly. In this
149 * case, the start of the epoch (January 1 1970).
150 */
151 virtual void TestEpochStartFields(void);
2ca993e8 152
b75a7d8f
A
153public: // package
154 static int32_t EPOCH_FIELDS[];
2ca993e8 155
b75a7d8f
A
156public:
157 /**
158 * Test that the days of the week progress properly when add is called repeatedly
159 * for increments of 24 days.
160 */
161 virtual void TestDOWProgression(void);
162 /**
163 * Test newly added fields - DOW_LOCAL and YEAR_WOY
164 */
165 virtual void TestDOW_LOCALandYEAR_WOY(void);
166 // test subroutine used by TestDOW_LOCALandYEAR_WOY
2ca993e8 167 virtual void doYEAR_WOYLoop(Calendar *cal,
b75a7d8f
A
168 SimpleDateFormat *sdf, int32_t times, UErrorCode& status);
169 // test subroutine used by TestDOW_LOCALandYEAR_WOY
170 virtual void loop_addroll(Calendar *cal, /*SimpleDateFormat *sdf, */
2ca993e8 171 int times, UCalendarDateFields field, UCalendarDateFields field2,
b75a7d8f
A
172 UErrorCode& errorCode);
173
374ca955
A
174 void TestYWOY(void);
175 void TestJD(void);
176
b75a7d8f 177 void yearAddTest(Calendar& cal, UErrorCode& status);
2ca993e8 178
b75a7d8f
A
179public: // package
180 // test subroutine use by TestDOWProgression
181 virtual void marchByDelta(Calendar* cal, int32_t delta);
374ca955
A
182
183 public:
184 // for other tests' use
185 static UnicodeString fieldName(UCalendarDateFields f);
186 static UnicodeString calToStr(const Calendar & cal);
2ca993e8 187
374ca955
A
188 // List of non-installed locales with interesting calendars
189
190 /**
191 * @return the count of 'other' locales to test
192 */
193 static int32_t testLocaleCount();
194
195 /**
196 * @param i index of 'other' locale to return
197 * @return locale ID
198 */
199 static const char* testLocaleID(int32_t i);
200
201 /**
202 * Clone the specified calendar, and determine its earliest supported date
203 * by setting the extended year to the minimum value.
204 * @param cal Calendar (will be cloned)
205 * @param isGregorian output: returns 'TRUE' if the calendar's class is GregorianCalendar
2ca993e8 206 * @param status error code
374ca955
A
207 */
208 static UDate minDateOfCalendar(const Calendar& cal, UBool &isGregorian, UErrorCode& status);
209
210 /**
211 * Construct a calendar of the specified locale, and determine its earliest supported date
212 * by setting the extended year to the minimum value.
213 * @param locale locale of calendar to check
214 * @param isGregorian output: returns 'TRUE' if the calendar's class is GregorianCalendar
2ca993e8 215 * @param status error code
374ca955
A
216 */
217 static UDate minDateOfCalendar(const Locale& locale, UBool &isGregorian, UErrorCode& status);
218
219 // internal - for other test use
220 public:
729e4ab9
A
221 void Test6703(void);
222 void Test3785(void);
223 void Test1624(void);
57a6839d
A
224 void TestIslamicUmAlQura(void);
225 void TestIslamicTabularDates(void);
4388f060
A
226
227 /**
228 * Test the time stamp array recalculation during heavy Calendar usage
229 */
230 void TestTimeStamp(void);
231 /**
232 * Test the ISO8601 calendar type
233 */
234 void TestISO8601(void);
235
236 /**
237 * Test cases for [set|get][Repeated|Skipped]WallTimeOption
238 */
239 void TestAmbiguousWallTimeAPIs(void);
240 void TestRepeatedWallTime(void);
241 void TestSkippedWallTime(void);
242
243 void TestCloneLocale(void);
e4f10fab 244
57a6839d
A
245 void TestHebrewMonthValidation(void);
246
247 /*
248 * utility methods for TestIslamicUmAlQura
249 */
250 void setAndTestCalendar(Calendar* cal, int32_t initMonth, int32_t initDay, int32_t initYear, UErrorCode& status);
251 void setAndTestWholeYear(Calendar* cal, int32_t startYear, UErrorCode& status);
252
253 void TestWeekData(void);
254
e4f10fab 255 void TestAddAcrossZoneTransition(void);
2ca993e8
A
256
257 void TestChineseCalendarMapping(void);
b75a7d8f
A
258};
259
260#endif /* #if !UCONFIG_NO_FORMATTING */
2ca993e8 261
b75a7d8f 262#endif // __CalendarTest__