1999-08-16 21:50:52 +00:00
|
|
|
|
2000-03-10 00:42:27 +00:00
|
|
|
/********************************************************************
|
2014-01-10 23:14:14 +00:00
|
|
|
* Copyright (c) 1997-2014, International Business Machines
|
2007-07-27 03:12:12 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
2000-03-10 00:42:27 +00:00
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
#ifndef __TimeZoneTest__
|
|
|
|
#define __TimeZoneTest__
|
2001-10-08 23:26:58 +00:00
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
#include "unicode/simpletz.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "caltztst.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Various tests for TimeZone
|
|
|
|
**/
|
|
|
|
class TimeZoneTest: public CalendarTimeZoneTest {
|
|
|
|
// IntlTest override
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
|
1999-08-16 21:50:52 +00:00
|
|
|
public: // package
|
|
|
|
static const int32_t millisPerHour;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Test the offset of the PRT timezone.
|
|
|
|
*/
|
|
|
|
virtual void TestPRTOffset(void);
|
|
|
|
/**
|
|
|
|
* Regress a specific bug with a sequence of API calls.
|
|
|
|
*/
|
|
|
|
virtual void TestVariousAPI518(void);
|
|
|
|
/**
|
|
|
|
* Test the call which retrieves the available IDs.
|
|
|
|
*/
|
|
|
|
virtual void TestGetAvailableIDs913(void);
|
|
|
|
|
2011-03-01 18:29:13 +00:00
|
|
|
virtual void TestGetAvailableIDsNew(void);
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
/**
|
|
|
|
* Generic API testing for API coverage.
|
|
|
|
*/
|
|
|
|
virtual void TestGenericAPI(void);
|
|
|
|
/**
|
|
|
|
* Test the setStartRule/setEndRule API calls.
|
|
|
|
*/
|
|
|
|
virtual void TestRuleAPI(void);
|
2003-08-15 18:27:19 +00:00
|
|
|
|
|
|
|
void findTransition(const TimeZone& tz,
|
|
|
|
UDate min, UDate max);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2003-08-15 18:27:19 +00:00
|
|
|
/**
|
1999-08-16 21:50:52 +00:00
|
|
|
* subtest used by TestRuleAPI
|
|
|
|
**/
|
2003-08-15 18:27:19 +00:00
|
|
|
void testUsingBinarySearch(const TimeZone& tz,
|
|
|
|
UDate min, UDate max,
|
|
|
|
UDate expectedBoundary);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test short zone IDs for compliance
|
|
|
|
*/
|
|
|
|
virtual void TestShortZoneIDs(void);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test parsing custom zones
|
|
|
|
*/
|
|
|
|
virtual void TestCustomParse(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test new getDisplayName() API
|
|
|
|
*/
|
|
|
|
virtual void TestDisplayName(void);
|
|
|
|
|
|
|
|
void TestDSTSavings(void);
|
|
|
|
void TestAlternateRules(void);
|
|
|
|
|
2001-02-02 19:26:56 +00:00
|
|
|
void TestCountries(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2003-08-15 18:27:19 +00:00
|
|
|
void TestHistorical(void);
|
|
|
|
|
2003-08-19 00:24:49 +00:00
|
|
|
void TestEquivalentIDs(void);
|
|
|
|
|
2005-07-19 05:12:33 +00:00
|
|
|
void TestAliasedNames(void);
|
2005-11-04 21:57:24 +00:00
|
|
|
|
|
|
|
void TestFractionalDST(void);
|
2006-10-24 19:57:32 +00:00
|
|
|
|
|
|
|
void TestFebruary(void);
|
|
|
|
|
2014-01-10 23:14:14 +00:00
|
|
|
void TestCanonicalIDAPI();
|
2008-01-23 23:47:13 +00:00
|
|
|
void TestCanonicalID(void);
|
2011-02-18 23:03:47 +00:00
|
|
|
|
2008-06-09 03:46:34 +00:00
|
|
|
virtual void TestDisplayNamesMeta();
|
2008-01-23 23:47:13 +00:00
|
|
|
|
2011-02-18 23:03:47 +00:00
|
|
|
void TestGetRegion(void);
|
2011-09-28 00:00:31 +00:00
|
|
|
void TestGetUnknown();
|
2011-02-18 23:03:47 +00:00
|
|
|
|
2013-05-22 20:33:30 +00:00
|
|
|
void TestGetWindowsID(void);
|
|
|
|
void TestGetIDForWindowsID(void);
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
static const UDate INTERVAL;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// internal functions
|
2007-11-28 20:49:58 +00:00
|
|
|
static UnicodeString& formatOffset(int32_t offset, UnicodeString& rv);
|
|
|
|
static UnicodeString& formatTZID(int32_t offset, UnicodeString& rv);
|
2009-03-30 20:55:05 +00:00
|
|
|
|
|
|
|
// Some test case data is current date/tzdata version sensitive and producing errors
|
|
|
|
// when year/rule are changed.
|
|
|
|
static const int32_t REFERENCE_YEAR;
|
|
|
|
static const char *REFERENCE_DATA_VERSION;
|
2011-03-01 18:29:13 +00:00
|
|
|
|
|
|
|
void checkContainsAll(StringEnumeration *s1, const char *name1,
|
|
|
|
StringEnumeration *s2, const char *name2);
|
1999-08-16 21:50:52 +00:00
|
|
|
};
|
2002-09-21 00:43:14 +00:00
|
|
|
|
|
|
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
#endif // __TimeZoneTest__
|