1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 /********************************************************************
5 * Copyright (c) 1997-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************/
9 #ifndef __TimeZoneTest__
10 #define __TimeZoneTest__
12 #include "unicode/utypes.h"
14 #if !UCONFIG_NO_FORMATTING
16 #include "unicode/simpletz.h"
20 * Various tests for TimeZone
22 class TimeZoneTest: public CalendarTimeZoneTest {
24 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
26 static const int32_t millisPerHour;
30 * Test the offset of the PRT timezone.
32 virtual void TestPRTOffset(void);
34 * Regress a specific bug with a sequence of API calls.
36 virtual void TestVariousAPI518(void);
38 * Test the call which retrieves the available IDs.
40 virtual void TestGetAvailableIDs913(void);
42 virtual void TestGetAvailableIDsNew(void);
45 * Generic API testing for API coverage.
47 virtual void TestGenericAPI(void);
49 * Test the setStartRule/setEndRule API calls.
51 virtual void TestRuleAPI(void);
53 void findTransition(const TimeZone& tz,
54 UDate min, UDate max);
57 * subtest used by TestRuleAPI
59 void testUsingBinarySearch(const TimeZone& tz,
61 UDate expectedBoundary);
65 * Test short zone IDs for compliance
67 virtual void TestShortZoneIDs(void);
71 * Test parsing custom zones
73 virtual void TestCustomParse(void);
76 * Test new getDisplayName() API
78 virtual void TestDisplayName(void);
80 void TestDSTSavings(void);
81 void TestAlternateRules(void);
83 void TestCountries(void);
85 void TestHistorical(void);
87 void TestEquivalentIDs(void);
89 void TestAliasedNames(void);
91 void TestFractionalDST(void);
93 void TestFebruary(void);
95 void TestCanonicalIDAPI();
96 void TestCanonicalID(void);
98 virtual void TestDisplayNamesMeta();
100 void TestGetRegion(void);
101 void TestGetUnknown();
103 void TestGetWindowsID(void);
104 void TestGetIDForWindowsID(void);
106 static const UDate INTERVAL;
109 // internal functions
110 static UnicodeString& formatOffset(int32_t offset, UnicodeString& rv);
111 static UnicodeString& formatTZID(int32_t offset, UnicodeString& rv);
113 // Some test case data is current date/tzdata version sensitive and producing errors
114 // when year/rule are changed.
115 static const int32_t REFERENCE_YEAR;
116 static const char *REFERENCE_DATA_VERSION;
118 void checkContainsAll(StringEnumeration *s1, const char *name1,
119 StringEnumeration *s2, const char *name2);
122 #endif /* #if !UCONFIG_NO_FORMATTING */
124 #endif // __TimeZoneTest__