home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / tzbdtest.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  3.3 KB  |  101 lines

  1.  
  2. /*
  3. ********************************************************************
  4. * COPYRIGHT: 
  5. * (C) Copyright Taligent, Inc., 1997
  6. * (C) Copyright International Business Machines Corporation, 1997 - 1998
  7. * Licensed Material - Program-Property of IBM - All Rights Reserved. 
  8. * US Government Users Restricted Rights - Use, duplication, or disclosure 
  9. * restricted by GSA ADP Schedule Contract with IBM Corp. 
  10. *
  11. ********************************************************************
  12. */
  13.  
  14. #ifndef __TimeZoneBoundaryTest__
  15. #define __TimeZoneBoundaryTest__
  16.  
  17. #include "utypes.h"
  18. #include "caltztst.h"
  19. class TimeZone;
  20. class SimpleTimeZone;
  21.  
  22. /**
  23.  * A test which discovers the boundaries of DST programmatically and verifies
  24.  * that they are correct.
  25.  */
  26. class TimeZoneBoundaryTest: public CalendarTimeZoneTest {
  27.     // IntlTest override
  28.     void runIndexedTest( int32_t index, bool_t exec, char* &name, char* par );
  29. public: // package
  30.     static UDate ONE_SECOND;
  31.     static UDate ONE_MINUTE;
  32.     static UDate ONE_HOUR;
  33.     static UDate ONE_DAY;
  34.     static UDate ONE_YEAR;
  35.     static UDate SIX_MONTHS;
  36.     static int32_t MONTH_LENGTH[];
  37.     static UDate PST_1997_BEG;
  38.     static UDate PST_1997_END;
  39.     static UDate INTERVAL;
  40.     /**
  41.      * Date.toString().substring() Boundary Test
  42.      * Look for a DST changeover to occur within 6 months of the given Date.
  43.      * The initial Date.toString() should yield a string containing the
  44.      * startMode as a SUBSTRING.  The boundary will be tested to be
  45.      * at the expectedBoundary value.
  46.      */
  47.  
  48.     /**
  49.      * internal routines used by major test routines to perform subtests
  50.      **/
  51.     virtual void findDaylightBoundaryUsingDate(UDate d, const char* startMode, UDate expectedBoundary);
  52.     virtual void findDaylightBoundaryUsingTimeZone(UDate d, bool_t startsInDST, UDate expectedBoundary);
  53.     virtual void findDaylightBoundaryUsingTimeZone(UDate d, bool_t startsInDST, UDate expectedBoundary, TimeZone* tz);
  54.  
  55. private:
  56.     //static UnicodeString* showDate(long l);
  57.     UnicodeString showDate(UDate d);
  58.     static UnicodeString showNN(int32_t n);
  59.  
  60. public: // package
  61.     /**
  62.      * Given a date, a TimeZone, and expected values for inDaylightTime,
  63.      * useDaylightTime, zone and DST offset, verify that this is the case.
  64.      */
  65.     virtual void verifyDST(UDate d, TimeZone* time_zone, bool_t expUseDaylightTime, bool_t expInDaylightTime, UDate expZoneOffset, UDate expDSTOffset);
  66.  
  67. public:
  68.     /**
  69.      * Test the behavior of SimpleTimeZone at the transition into and out of DST.
  70.      * Use a binary search to find boundaries.
  71.      */
  72.     virtual void TestBoundaries(void);
  73.  
  74. public: // package
  75.     /**
  76.      * internal subroutine used by TestNewRules
  77.      **/
  78.     virtual void testUsingBinarySearch(SimpleTimeZone* tz, UDate d, UDate expectedBoundary);
  79.  
  80. public:
  81.     /**
  82.      * Test the handling of the "new" rules; that is, rules other than nth Day of week.
  83.      */
  84.     virtual void TestNewRules(void);
  85.  
  86. public: // package
  87.     /**
  88.      * Find boundaries by stepping.
  89.      */
  90.     virtual void findBoundariesStepwise(int32_t year, UDate interval, TimeZone* z, int32_t expectedChanges);
  91.  
  92. public:
  93.     /**
  94.      * Test the behavior of SimpleTimeZone at the transition into and out of DST.
  95.      * Use a stepwise march to find boundaries.
  96.      */ 
  97.     virtual void TestStepwise(void);
  98. };
  99.  
  100. #endif // __TimeZoneBoundaryTest__
  101.