]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/tzbdtest.h
ICU-511.25.tar.gz
[apple/icu.git] / icuSources / test / intltest / tzbdtest.h
CommitLineData
b75a7d8f
A
1/********************************************************************
2 * COPYRIGHT:
73c04bcf 3 * Copyright (c) 1997-2005, International Business Machines Corporation and
b75a7d8f
A
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7#ifndef __TimeZoneBoundaryTest__
8#define __TimeZoneBoundaryTest__
9
10#include "unicode/utypes.h"
11
12#if !UCONFIG_NO_FORMATTING
13
14#include "unicode/timezone.h"
15#include "unicode/simpletz.h"
16#include "caltztst.h"
17
18/**
19 * A test which discovers the boundaries of DST programmatically and verifies
20 * that they are correct.
21 */
22class TimeZoneBoundaryTest: public CalendarTimeZoneTest {
23 // IntlTest override
24 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
25public: // package
26
27 TimeZoneBoundaryTest();
28
29 /**
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.
35 */
36
37 /**
38 * internal routines used by major test routines to perform subtests
39 **/
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);
43
44private:
45 //static UnicodeString* showDate(long l);
46 UnicodeString showDate(UDate d);
47 static UnicodeString showNN(int32_t n);
48
49public: // package
50 /**
51 * Given a date, a TimeZone, and expected values for inDaylightTime,
52 * useDaylightTime, zone and DST offset, verify that this is the case.
53 */
54 virtual void verifyDST(UDate d, TimeZone* time_zone, UBool expUseDaylightTime, UBool expInDaylightTime, UDate expZoneOffset, UDate expDSTOffset);
55
56 /**
57 * Test the behavior of SimpleTimeZone at the transition into and out of DST.
58 * Use a binary search to find boundaries.
59 */
60 virtual void TestBoundaries(void);
61
62 /**
63 * internal subroutine used by TestNewRules
64 **/
65 virtual void testUsingBinarySearch(SimpleTimeZone* tz, UDate d, UDate expectedBoundary);
66
67 /**
68 * Test the handling of the "new" rules; that is, rules other than nth Day of week.
69 */
70 virtual void TestNewRules(void);
71
72 /**
73 * Find boundaries by stepping.
74 */
75 virtual void findBoundariesStepwise(int32_t year, UDate interval, TimeZone* z, int32_t expectedChanges);
76
77 /**
78 * Test the behavior of SimpleTimeZone at the transition into and out of DST.
79 * Use a stepwise march to find boundaries.
80 */
81 virtual void TestStepwise(void);
73c04bcf
A
82 void verifyMapping(Calendar& cal, int year, int month, int dom, int hour,
83 double epochHours) ;
b75a7d8f
A
84private:
85 const UDate ONE_SECOND;
86 const UDate ONE_MINUTE;
87 const UDate ONE_HOUR;
88 const UDate ONE_DAY;
89 const UDate ONE_YEAR;
90 const UDate SIX_MONTHS;
91 static const int32_t MONTH_LENGTH[];
92 static const UDate PST_1997_BEG;
93 static const UDate PST_1997_END;
94 static const UDate INTERVAL;
95};
96
97#endif /* #if !UCONFIG_NO_FORMATTING */
98
99#endif // __TimeZoneBoundaryTest__