]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tzbdtest.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2005, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
9 #ifndef __TimeZoneBoundaryTest__
10 #define __TimeZoneBoundaryTest__
12 #include "unicode/utypes.h"
14 #if !UCONFIG_NO_FORMATTING
16 #include "unicode/timezone.h"
17 #include "unicode/simpletz.h"
21 * A test which discovers the boundaries of DST programmatically and verifies
22 * that they are correct.
24 class TimeZoneBoundaryTest
: public CalendarTimeZoneTest
{
26 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
);
29 TimeZoneBoundaryTest();
32 * Date.toString().substring() Boundary Test
33 * Look for a DST changeover to occur within 6 months of the given Date.
34 * The initial Date.toString() should yield a string containing the
35 * startMode as a SUBSTRING. The boundary will be tested to be
36 * at the expectedBoundary value.
40 * internal routines used by major test routines to perform subtests
42 virtual void findDaylightBoundaryUsingDate(UDate d
, const char* startMode
, UDate expectedBoundary
);
43 virtual void findDaylightBoundaryUsingTimeZone(UDate d
, UBool startsInDST
, UDate expectedBoundary
);
44 virtual void findDaylightBoundaryUsingTimeZone(UDate d
, UBool startsInDST
, UDate expectedBoundary
, TimeZone
* tz
);
47 //static UnicodeString* showDate(long l);
48 UnicodeString
showDate(UDate d
);
49 static UnicodeString
showNN(int32_t n
);
53 * Given a date, a TimeZone, and expected values for inDaylightTime,
54 * useDaylightTime, zone and DST offset, verify that this is the case.
56 virtual void verifyDST(UDate d
, TimeZone
* time_zone
, UBool expUseDaylightTime
, UBool expInDaylightTime
, UDate expZoneOffset
, UDate expDSTOffset
);
59 * Test the behavior of SimpleTimeZone at the transition into and out of DST.
60 * Use a binary search to find boundaries.
62 virtual void TestBoundaries(void);
65 * internal subroutine used by TestNewRules
67 virtual void testUsingBinarySearch(SimpleTimeZone
* tz
, UDate d
, UDate expectedBoundary
);
70 * Test the handling of the "new" rules; that is, rules other than nth Day of week.
72 virtual void TestNewRules(void);
75 * Find boundaries by stepping.
77 virtual void findBoundariesStepwise(int32_t year
, UDate interval
, TimeZone
* z
, int32_t expectedChanges
);
80 * Test the behavior of SimpleTimeZone at the transition into and out of DST.
81 * Use a stepwise march to find boundaries.
83 virtual void TestStepwise(void);
84 void verifyMapping(Calendar
& cal
, int year
, int month
, int dom
, int hour
,
87 const UDate ONE_SECOND
;
88 const UDate ONE_MINUTE
;
92 const UDate SIX_MONTHS
;
93 static const int32_t MONTH_LENGTH
[];
94 static const UDate PST_1997_BEG
;
95 static const UDate PST_1997_END
;
96 static const UDate INTERVAL
;
99 #endif /* #if !UCONFIG_NO_FORMATTING */
101 #endif // __TimeZoneBoundaryTest__