~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/test/intltest/tzbdtest.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/********************************************************************
2
 
 * COPYRIGHT: 
3
 
 * Copyright (c) 1997-2001, International Business Machines Corporation and
4
 
 * others. All Rights Reserved.
5
 
 ********************************************************************/
6
 
 
7
 
#ifndef __TimeZoneBoundaryTest__
8
 
#define __TimeZoneBoundaryTest__
9
 
 
10
 
#include "unicode/utypes.h"
11
 
#include "unicode/timezone.h"
12
 
#include "unicode/simpletz.h"
13
 
#include "caltztst.h"
14
 
 
15
 
/**
16
 
 * A test which discovers the boundaries of DST programmatically and verifies
17
 
 * that they are correct.
18
 
 */
19
 
class TimeZoneBoundaryTest: public CalendarTimeZoneTest {
20
 
    // IntlTest override
21
 
    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
22
 
public: // package
23
 
 
24
 
    TimeZoneBoundaryTest();
25
 
 
26
 
    /**
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.
32
 
     */
33
 
 
34
 
    /**
35
 
     * internal routines used by major test routines to perform subtests
36
 
     **/
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);
40
 
 
41
 
private:
42
 
    //static UnicodeString* showDate(long l);
43
 
    UnicodeString showDate(UDate d);
44
 
    static UnicodeString showNN(int32_t n);
45
 
 
46
 
public: // package
47
 
    /**
48
 
     * Given a date, a TimeZone, and expected values for inDaylightTime,
49
 
     * useDaylightTime, zone and DST offset, verify that this is the case.
50
 
     */
51
 
    virtual void verifyDST(UDate d, TimeZone* time_zone, UBool expUseDaylightTime, UBool expInDaylightTime, UDate expZoneOffset, UDate expDSTOffset);
52
 
 
53
 
    /**
54
 
     * Test the behavior of SimpleTimeZone at the transition into and out of DST.
55
 
     * Use a binary search to find boundaries.
56
 
     */
57
 
    virtual void TestBoundaries(void);
58
 
 
59
 
    /**
60
 
     * internal subroutine used by TestNewRules
61
 
     **/
62
 
    virtual void testUsingBinarySearch(SimpleTimeZone* tz, UDate d, UDate expectedBoundary);
63
 
 
64
 
    /**
65
 
     * Test the handling of the "new" rules; that is, rules other than nth Day of week.
66
 
     */
67
 
    virtual void TestNewRules(void);
68
 
 
69
 
    /**
70
 
     * Find boundaries by stepping.
71
 
     */
72
 
    virtual void findBoundariesStepwise(int32_t year, UDate interval, TimeZone* z, int32_t expectedChanges);
73
 
 
74
 
    /**
75
 
     * Test the behavior of SimpleTimeZone at the transition into and out of DST.
76
 
     * Use a stepwise march to find boundaries.
77
 
     */ 
78
 
    virtual void TestStepwise(void);
79
 
 
80
 
private:
81
 
    const UDate ONE_SECOND;
82
 
    const UDate ONE_MINUTE;
83
 
    const UDate ONE_HOUR;
84
 
    const UDate ONE_DAY;
85
 
    const UDate ONE_YEAR;
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;
91
 
};
92
 
 
93
 
#endif // __TimeZoneBoundaryTest__