2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
|
|
|
* Copyright (c) 1997-1999, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
#ifndef __CalendarLimitTest__
|
|
|
|
#define __CalendarLimitTest__
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/utypes.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "caltztst.h"
|
|
|
|
class Calendar;
|
|
|
|
class DateFormat;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This test verifies the behavior of Calendar around the very earliest limits
|
|
|
|
* which it can handle. It also verifies the behavior for large values of millis.
|
|
|
|
*
|
|
|
|
* Bug ID 4033662.
|
|
|
|
*/
|
|
|
|
class CalendarLimitTest: public CalendarTimeZoneTest {
|
|
|
|
// IntlTest override
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
|
1999-08-16 21:50:52 +00:00
|
|
|
public: // package
|
|
|
|
static const UDate EARLIEST_SUPPORTED_MILLIS;
|
|
|
|
static const UDate LATEST_SUPPORTED_MILLIS;
|
|
|
|
|
|
|
|
//test routine used by TestCalendarLimit
|
|
|
|
virtual void test(UDate millis, Calendar *cal, DateFormat *fmt);
|
|
|
|
|
|
|
|
static double nextDouble(double a);
|
|
|
|
static double previousDouble(double a);
|
2000-05-18 22:08:39 +00:00
|
|
|
static UBool withinErr(double a, double b, double err);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// test behaviour and error reporting at boundaries of defined range
|
|
|
|
virtual void TestCalendarLimit(void);
|
|
|
|
|
|
|
|
public: // package
|
|
|
|
/**
|
|
|
|
* Locate the earliest limits which are correctly handled.
|
|
|
|
* Used by TestCalendarLimit
|
|
|
|
*/
|
|
|
|
virtual void explore2(UDate expectedEarlyLimit);
|
|
|
|
virtual void explore3(UDate expectedLateLimit);
|
|
|
|
static UDate gregorianCutover;
|
|
|
|
|
|
|
|
static const int32_t kEpochStartAsJulianDay; // January 1, 1970 (Gregorian)
|
|
|
|
static const UDate kPapalCutover;
|
|
|
|
static const int32_t kJan1_1JulianDay;
|
|
|
|
static const int32_t kNumDays[];
|
|
|
|
static const int32_t kLeapNumDays[];
|
|
|
|
static const int32_t kMonthLength[];
|
|
|
|
static const int32_t kLeapMonthLength[];
|
|
|
|
|
|
|
|
static double millisToJulianDay(UDate millis);
|
|
|
|
|
|
|
|
static double floorDivide(double numerator, double denominator);
|
|
|
|
static int32_t floorDivide(int32_t numerator, int32_t denominator);
|
|
|
|
static int32_t floorDivide(int32_t numerator, int32_t denominator, int32_t remainder[]);
|
|
|
|
static int32_t floorDivide(double numerator, int32_t denominator, int32_t remainder[]);
|
|
|
|
|
|
|
|
static int32_t julianDayOffset;
|
|
|
|
static int32_t millisPerDay;
|
|
|
|
static int32_t YEAR;
|
|
|
|
static int32_t MONTH;
|
|
|
|
static int32_t DATE;
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
static UBool timeToFields(UDate millis, int32_t *fields);
|
1999-08-16 21:50:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __CalendarLimitTest__
|