X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..1a147d096ae81f4c8262f7bfc56bd19fc2dee932:/icuSources/test/intltest/caltest.h diff --git a/icuSources/test/intltest/caltest.h b/icuSources/test/intltest/caltest.h index ee3eb258..f85abf9d 100644 --- a/icuSources/test/intltest/caltest.h +++ b/icuSources/test/intltest/caltest.h @@ -1,12 +1,13 @@ -/******************************************************************** - * COPYRIGHT: - * Copyright (c) 1997-2003, International Business Machines Corporation and - * others. All Rights Reserved. - ********************************************************************/ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/*********************************************************************** + * Copyright (c) 1997-2016, International Business Machines Corporation + * and others. All Rights Reserved. + ***********************************************************************/ #ifndef __CalendarTest__ #define __CalendarTest__ - + #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING @@ -34,7 +35,7 @@ public: * test subroutine use by TestDOW943 */ void dowTest(UBool lenient); - /** + /** * Confirm that cloned Calendar objects do not inadvertently share substructures. */ virtual void TestClonesUnique908(void); @@ -52,7 +53,9 @@ public: virtual void TestGenericAPI(void); // New to C++ -- needs to be back ported to Java virtual void TestWOY(void); - + + virtual void TestDebug(void); + public: // package /** * test subroutine used by TestDisambiguation765 @@ -62,19 +65,19 @@ public: // package * test subroutine used by TestDisambiguation765 */ virtual void verify765(const UnicodeString& msg/*, IllegalArgumentException e*/, UErrorCode status); - + public: /** * Confirm that the offset between local time and GMT behaves as expected. */ virtual void TestGMTvsLocal4064654(void); - + public: // package /** * test subroutine used by TestGMTvsLocal4064654 */ virtual void test4064654(int32_t yr, int32_t mo, int32_t dt, int32_t hr, int32_t mn, int32_t sc); - + public: /** * The operations of adding and setting should not exhibit pathological @@ -92,12 +95,12 @@ public: public: // package // internal utility routine for checking date - virtual void check520(Calendar* c, - int32_t y, int32_t m, int32_t d, - int32_t hr, int32_t min, int32_t sec, + virtual void check520(Calendar* c, + int32_t y, int32_t m, int32_t d, + int32_t hr, int32_t min, int32_t sec, int32_t ms, UCalendarDateFields field); - - virtual void check520(Calendar* c, + + virtual void check520(Calendar* c, int32_t y, int32_t m, int32_t d); public: @@ -107,17 +110,17 @@ public: */ virtual void TestFieldSet4781(void); /* virtual void TestSerialize337(); - + public: // package static UnicodeString& PREFIX; static UnicodeString& POSTFIX; static UnicodeString& FILENAME; -*/ +*/ public: /** * Verify that the seconds of a Calendar can be zeroed out through the * expected sequence of operations. - */ + */ virtual void TestSecondsZero121(void); /** * Verify that a specific sequence of adding and setting works as expected; @@ -125,31 +128,31 @@ public: * called. */ virtual void TestAddSetGet0610(void); - + public: // package // internal routine for checking date static UnicodeString value(Calendar* calendar); - + public: /** * Verify that various fields on a known date are set correctly. */ virtual void TestFields060(void); - + public: // package static int32_t EXPECTED_FIELDS[]; static const int32_t EXPECTED_FIELDS_length; - + public: /** * Verify that various fields on a known date are set correctly. In this * case, the start of the epoch (January 1 1970). */ virtual void TestEpochStartFields(void); - + public: // package static int32_t EPOCH_FIELDS[]; - + public: /** * Test that the days of the week progress properly when add is called repeatedly @@ -161,20 +164,99 @@ public: */ virtual void TestDOW_LOCALandYEAR_WOY(void); // test subroutine used by TestDOW_LOCALandYEAR_WOY - virtual void doYEAR_WOYLoop(Calendar *cal, + virtual void doYEAR_WOYLoop(Calendar *cal, SimpleDateFormat *sdf, int32_t times, UErrorCode& status); // test subroutine used by TestDOW_LOCALandYEAR_WOY virtual void loop_addroll(Calendar *cal, /*SimpleDateFormat *sdf, */ - int times, UCalendarDateFields field, UCalendarDateFields field2, + int times, UCalendarDateFields field, UCalendarDateFields field2, UErrorCode& errorCode); + void TestYWOY(void); + void TestJD(void); + void yearAddTest(Calendar& cal, UErrorCode& status); - + public: // package // test subroutine use by TestDOWProgression virtual void marchByDelta(Calendar* cal, int32_t delta); + + public: + // for other tests' use + static UnicodeString fieldName(UCalendarDateFields f); + static UnicodeString calToStr(const Calendar & cal); + + // List of non-installed locales with interesting calendars + + /** + * @return the count of 'other' locales to test + */ + static int32_t testLocaleCount(); + + /** + * @param i index of 'other' locale to return + * @return locale ID + */ + static const char* testLocaleID(int32_t i); + + /** + * Clone the specified calendar, and determine its earliest supported date + * by setting the extended year to the minimum value. + * @param cal Calendar (will be cloned) + * @param isGregorian output: returns 'TRUE' if the calendar's class is GregorianCalendar + * @param status error code + */ + static UDate minDateOfCalendar(const Calendar& cal, UBool &isGregorian, UErrorCode& status); + + /** + * Construct a calendar of the specified locale, and determine its earliest supported date + * by setting the extended year to the minimum value. + * @param locale locale of calendar to check + * @param isGregorian output: returns 'TRUE' if the calendar's class is GregorianCalendar + * @param status error code + */ + static UDate minDateOfCalendar(const Locale& locale, UBool &isGregorian, UErrorCode& status); + + // internal - for other test use + public: + void Test6703(void); + void Test3785(void); + void Test1624(void); + void TestIslamicUmAlQura(void); + void TestIslamicTabularDates(void); + + /** + * Test the time stamp array recalculation during heavy Calendar usage + */ + void TestTimeStamp(void); + /** + * Test the ISO8601 calendar type + */ + void TestISO8601(void); + + /** + * Test cases for [set|get][Repeated|Skipped]WallTimeOption + */ + void TestAmbiguousWallTimeAPIs(void); + void TestRepeatedWallTime(void); + void TestSkippedWallTime(void); + + void TestCloneLocale(void); + + void TestHebrewMonthValidation(void); + + /* + * utility methods for TestIslamicUmAlQura + */ + void setAndTestCalendar(Calendar* cal, int32_t initMonth, int32_t initDay, int32_t initYear, UErrorCode& status); + void setAndTestWholeYear(Calendar* cal, int32_t startYear, UErrorCode& status); + + void TestWeekData(void); + + void TestAddAcrossZoneTransition(void); + + void TestChineseCalendarMapping(void); }; #endif /* #if !UCONFIG_NO_FORMATTING */ - + #endif // __CalendarTest__