]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tzbdtest.h
1 /********************************************************************
3 * Copyright (c) 1997-2001, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #ifndef __TimeZoneBoundaryTest__
8 #define __TimeZoneBoundaryTest__
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
14 #include "unicode/timezone.h"
15 #include "unicode/simpletz.h"
19 * A test which discovers the boundaries of DST programmatically and verifies
20 * that they are correct.
22 class TimeZoneBoundaryTest
: public CalendarTimeZoneTest
{
24 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
);
27 TimeZoneBoundaryTest();
30 * Date.toString().substring() Boundary Test
31 * Look for a DST changeover to occur within 6 months of the given Date.
32 * The initial Date.toString() should yield a string containing the
33 * startMode as a SUBSTRING. The boundary will be tested to be
34 * at the expectedBoundary value.
38 * internal routines used by major test routines to perform subtests
40 virtual void findDaylightBoundaryUsingDate(UDate d
, const char* startMode
, UDate expectedBoundary
);
41 virtual void findDaylightBoundaryUsingTimeZone(UDate d
, UBool startsInDST
, UDate expectedBoundary
);
42 virtual void findDaylightBoundaryUsingTimeZone(UDate d
, UBool startsInDST
, UDate expectedBoundary
, TimeZone
* tz
);
45 //static UnicodeString* showDate(long l);
46 UnicodeString
showDate(UDate d
);
47 static UnicodeString
showNN(int32_t n
);
51 * Given a date, a TimeZone, and expected values for inDaylightTime,
52 * useDaylightTime, zone and DST offset, verify that this is the case.
54 virtual void verifyDST(UDate d
, TimeZone
* time_zone
, UBool expUseDaylightTime
, UBool expInDaylightTime
, UDate expZoneOffset
, UDate expDSTOffset
);
57 * Test the behavior of SimpleTimeZone at the transition into and out of DST.
58 * Use a binary search to find boundaries.
60 virtual void TestBoundaries(void);
63 * internal subroutine used by TestNewRules
65 virtual void testUsingBinarySearch(SimpleTimeZone
* tz
, UDate d
, UDate expectedBoundary
);
68 * Test the handling of the "new" rules; that is, rules other than nth Day of week.
70 virtual void TestNewRules(void);
73 * Find boundaries by stepping.
75 virtual void findBoundariesStepwise(int32_t year
, UDate interval
, TimeZone
* z
, int32_t expectedChanges
);
78 * Test the behavior of SimpleTimeZone at the transition into and out of DST.
79 * Use a stepwise march to find boundaries.
81 virtual void TestStepwise(void);
84 const UDate ONE_SECOND
;
85 const UDate ONE_MINUTE
;
89 const UDate SIX_MONTHS
;
90 static const int32_t MONTH_LENGTH
[];
91 static const UDate PST_1997_BEG
;
92 static const UDate PST_1997_END
;
93 static const UDate INTERVAL
;
96 #endif /* #if !UCONFIG_NO_FORMATTING */
98 #endif // __TimeZoneBoundaryTest__