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"
11
#include "unicode/timezone.h"
12
#include "unicode/simpletz.h"
16
* A test which discovers the boundaries of DST programmatically and verifies
17
* that they are correct.
19
class TimeZoneBoundaryTest: public CalendarTimeZoneTest {
21
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
24
TimeZoneBoundaryTest();
27
* Date.toString().substring() Boundary Test
28
* Look for a DST changeover to occur within 6 months of the given Date.
29
* The initial Date.toString() should yield a string containing the
30
* startMode as a SUBSTRING. The boundary will be tested to be
31
* at the expectedBoundary value.
35
* internal routines used by major test routines to perform subtests
37
virtual void findDaylightBoundaryUsingDate(UDate d, const char* startMode, UDate expectedBoundary);
38
virtual void findDaylightBoundaryUsingTimeZone(UDate d, UBool startsInDST, UDate expectedBoundary);
39
virtual void findDaylightBoundaryUsingTimeZone(UDate d, UBool startsInDST, UDate expectedBoundary, TimeZone* tz);
42
//static UnicodeString* showDate(long l);
43
UnicodeString showDate(UDate d);
44
static UnicodeString showNN(int32_t n);
48
* Given a date, a TimeZone, and expected values for inDaylightTime,
49
* useDaylightTime, zone and DST offset, verify that this is the case.
51
virtual void verifyDST(UDate d, TimeZone* time_zone, UBool expUseDaylightTime, UBool expInDaylightTime, UDate expZoneOffset, UDate expDSTOffset);
54
* Test the behavior of SimpleTimeZone at the transition into and out of DST.
55
* Use a binary search to find boundaries.
57
virtual void TestBoundaries(void);
60
* internal subroutine used by TestNewRules
62
virtual void testUsingBinarySearch(SimpleTimeZone* tz, UDate d, UDate expectedBoundary);
65
* Test the handling of the "new" rules; that is, rules other than nth Day of week.
67
virtual void TestNewRules(void);
70
* Find boundaries by stepping.
72
virtual void findBoundariesStepwise(int32_t year, UDate interval, TimeZone* z, int32_t expectedChanges);
75
* Test the behavior of SimpleTimeZone at the transition into and out of DST.
76
* Use a stepwise march to find boundaries.
78
virtual void TestStepwise(void);
81
const UDate ONE_SECOND;
82
const UDate ONE_MINUTE;
86
const UDate SIX_MONTHS;
87
static const int32_t MONTH_LENGTH[];
88
static const UDate PST_1997_BEG;
89
static const UDate PST_1997_END;
90
static const UDate INTERVAL;
93
#endif // __TimeZoneBoundaryTest__