]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/callimts.h
1 /********************************************************************
3 * Copyright (c) 1997-2010, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #ifndef __CalendarLimitTest__
8 #define __CalendarLimitTest__
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
17 * This test verifies the behavior of Calendar around the very earliest limits
18 * which it can handle. It also verifies the behavior for large values of millis.
22 class CalendarLimitTest
: public CalendarTimeZoneTest
{
24 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
);
26 //test routine used by TestCalendarLimit
27 virtual void test(UDate millis
, Calendar
*cal
, DateFormat
*fmt
);
29 // bug 986c: deprecate nextDouble/previousDouble
30 //static double nextDouble(double a);
31 //static double previousDouble(double a);
32 static UBool
withinErr(double a
, double b
, double err
);
35 // test behaviour and error reporting at boundaries of defined range
36 virtual void TestCalendarExtremeLimit(void);
38 void TestLimits(void);
42 * Test the functions getMaximum/getGeratestMinimum logically correct.
43 * This method assumes day of week cycle is consistent.
44 * @param cal The calendar instance to be tested.
45 * @param leapMonth true if the calendar system has leap months
47 void doTheoreticalLimitsTest(Calendar
& cal
, UBool leapMonth
);
50 * Test the functions getXxxMinimum() and getXxxMaximum() by marching a
51 * test calendar 'cal' through 'numberOfDays' sequential days starting
52 * with 'startDate'. For each date, read a field value along with its
53 * reported actual minimum and actual maximum. These values are
54 * checked against one another as well as against getMinimum(),
55 * getGreatestMinimum(), getLeastMaximum(), and getMaximum(). We
58 * 1. minimum <= actualMinimum <= greatestMinimum <=
59 * leastMaximum <= actualMaximum <= maximum
61 * 2. actualMinimum <= value <= actualMaximum
63 * Note: In addition to outright failures, this test reports some
64 * results as warnings. These are not generally of concern, but they
65 * should be evaluated by a human. To see these, run this test in
67 * @param cal the calendar to be tested
68 * @param fieldsToTest an array of field values to be tested, e.g., new
69 * int[] { UCAL_MONTH, UCAL_DAY_OF_MONTH }. It only makes
70 * sense to test the day fields; the time fields are not tested by this
71 * method. If null, then test all standard fields.
72 * @param startDate the first date to test
73 * @param testDuration if positive, the number of days to be tested.
74 * If negative, the number of seconds to run the test.
76 void doLimitsTest(Calendar
& cal
, const int32_t* fieldsToTest
, UDate startDate
, int32_t testDuration
);
79 * doLimitsTest with default test duration and fields
81 void doLimitsTest(Calendar
& cal
, UDate startDate
, int32_t endTime
);
83 UnicodeString
& ymdToString(const Calendar
& cal
, UnicodeString
& str
);
86 #endif /* #if !UCONFIG_NO_FORMATTING */
88 #endif // __CalendarLimitTest__