1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 4 /******************************************************************** 5 * Copyright (c) 1997-2014, International Business Machines 6 * Corporation and others. All Rights Reserved. 7 ********************************************************************/ 8 9 #ifndef __TimeZoneTest__ 10 #define __TimeZoneTest__ 11 12 #include "unicode/utypes.h" 13 14 #if !UCONFIG_NO_FORMATTING 15 16 #include "unicode/simpletz.h" 17 #include "caltztst.h" 18 19 /** 20 * Various tests for TimeZone 21 **/ 22 class TimeZoneTest: public CalendarTimeZoneTest { 23 // IntlTest override 24 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par ) override; 25 public: // package 26 static const int32_t millisPerHour; 27 28 public: 29 /** 30 * Test the offset of the PRT timezone. 31 */ 32 virtual void TestPRTOffset(); 33 /** 34 * Regress a specific bug with a sequence of API calls. 35 */ 36 virtual void TestVariousAPI518(); 37 /** 38 * Test the call which retrieves the available IDs. 39 */ 40 virtual void TestGetAvailableIDs913(); 41 42 virtual void TestGetAvailableIDsNew(); 43 44 /** 45 * Generic API testing for API coverage. 46 */ 47 virtual void TestGenericAPI(); 48 /** 49 * Test the setStartRule/setEndRule API calls. 50 */ 51 virtual void TestRuleAPI(); 52 53 void findTransition(const TimeZone& tz, 54 UDate min, UDate max); 55 56 /** 57 * subtest used by TestRuleAPI 58 **/ 59 void testUsingBinarySearch(const TimeZone& tz, 60 UDate min, UDate max, 61 UDate expectedBoundary); 62 63 64 /** 65 * Test short zone IDs for compliance 66 */ 67 virtual void TestShortZoneIDs(); 68 69 70 /** 71 * Test parsing custom zones 72 */ 73 virtual void TestCustomParse(); 74 75 /** 76 * Test new getDisplayName() API 77 */ 78 virtual void TestDisplayName(); 79 80 void TestDSTSavings(); 81 void TestAlternateRules(); 82 83 void TestCountries(); 84 85 void TestHistorical(); 86 87 void TestEquivalentIDs(); 88 89 void TestAliasedNames(); 90 91 void TestFractionalDST(); 92 93 void TestFebruary(); 94 95 void TestCanonicalIDAPI(); 96 void TestCanonicalID(); 97 98 virtual void TestDisplayNamesMeta(); 99 100 void TestGetRegion(); 101 void TestGetUnknown(); 102 void TestGetGMT(); 103 104 void TestGetWindowsID(); 105 void TestGetIDForWindowsID(); 106 void TestCasablancaNameAndOffset22041(); 107 void TestRawOffsetAndOffsetConsistency22041(); 108 void TestGMTMinus24ICU22526(); 109 110 void TestGetIanaID(); 111 112 static const UDate INTERVAL; 113 114 private: 115 // internal functions 116 static UnicodeString& formatOffset(int32_t offset, UnicodeString& rv); 117 static UnicodeString& formatTZID(int32_t offset, UnicodeString& rv); 118 119 // Some test case data is current date/tzdata version sensitive and producing errors 120 // when year/rule are changed. 121 static const int32_t REFERENCE_YEAR; 122 static const char *REFERENCE_DATA_VERSION; 123 124 void checkContainsAll(StringEnumeration *s1, const char *name1, 125 StringEnumeration *s2, const char *name2); 126 }; 127 128 #endif /* #if !UCONFIG_NO_FORMATTING */ 129 130 #endif // __TimeZoneTest__ 131