home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / callimts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  2.7 KB  |  80 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 __CalendarLimitTest__
  15. #define __CalendarLimitTest__
  16.  
  17. #include "utypes.h"
  18. #include "caltztst.h"
  19. class Calendar;
  20. class DateFormat;
  21.  
  22. /**
  23.  * This test verifies the behavior of Calendar around the very earliest limits
  24.  * which it can handle.  It also verifies the behavior for large values of millis.
  25.  *
  26.  * Bug ID 4033662.
  27.  */
  28. class CalendarLimitTest: public CalendarTimeZoneTest {
  29.     // IntlTest override
  30.     void runIndexedTest( int32_t index, bool_t exec, char* &name, char* par );
  31. public: // package
  32.     static const UDate EARLIEST_SUPPORTED_MILLIS;
  33.     static const UDate LATEST_SUPPORTED_MILLIS;
  34.  
  35.     //test routine used by TestCalendarLimit
  36.     virtual void test(UDate millis, Calendar *cal, DateFormat *fmt);
  37.  
  38.     static double nextDouble(double a);
  39.     static double previousDouble(double a);
  40.     static bool_t withinErr(double a, double b, double err);
  41.  
  42. public:
  43.     // test behaviour and error reporting at boundaries of defined range
  44.     virtual void TestCalendarLimit(void);
  45.  
  46. public: // package
  47.     /**
  48.      * Locate the earliest limits which are correctly handled.
  49.      * Used by TestCalendarLimit
  50.      */
  51.     virtual void explore2(UDate expectedEarlyLimit);
  52.     virtual void explore3(UDate expectedLateLimit);
  53.     static UDate gregorianCutover;
  54.  
  55.     static const int32_t     kEpochStartAsJulianDay; // January 1, 1970 (Gregorian)
  56.     static const UDate        kPapalCutover;
  57.     static const int32_t    kJan1_1JulianDay;
  58.     static const int32_t    kNumDays[];
  59.     static const int32_t    kLeapNumDays[];
  60.     static const int32_t    kMonthLength[];
  61.     static const int32_t    kLeapMonthLength[];
  62.  
  63.     static double millisToJulianDay(UDate millis);
  64.  
  65.     static double floorDivide(double numerator, double denominator);
  66.     static int32_t floorDivide(int32_t numerator, int32_t denominator);
  67.     static int32_t floorDivide(int32_t numerator, int32_t denominator, int32_t remainder[]);
  68.     static int32_t floorDivide(double numerator, int32_t denominator, int32_t remainder[]);
  69.  
  70.        static int32_t julianDayOffset;
  71.     static int32_t millisPerDay;
  72.     static int32_t YEAR;
  73.     static int32_t MONTH;
  74.     static int32_t DATE;
  75.  
  76.     static bool_t timeToFields(UDate millis, int32_t *fields);
  77. };
  78.  
  79. #endif // __CalendarLimitTest__
  80.