]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/callimts.h
1 /********************************************************************
3 * Copyright (c) 1997-2015, 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);
39 void TestLimitsThread(int threadNumber
);
43 * Test the functions getMaximum/getGeratestMinimum logically correct.
44 * This method assumes day of week cycle is consistent.
45 * @param cal The calendar instance to be tested.
46 * @param leapMonth true if the calendar system has leap months
48 void doTheoreticalLimitsTest(Calendar
& cal
, UBool leapMonth
);
51 * Test the functions getXxxMinimum() and getXxxMaximum() by marching a
52 * test calendar 'cal' through 'numberOfDays' sequential days starting
53 * with 'startDate'. For each date, read a field value along with its
54 * reported actual minimum and actual maximum. These values are
55 * checked against one another as well as against getMinimum(),
56 * getGreatestMinimum(), getLeastMaximum(), and getMaximum(). We
59 * 1. minimum <= actualMinimum <= greatestMinimum <=
60 * leastMaximum <= actualMaximum <= maximum
62 * 2. actualMinimum <= value <= actualMaximum
64 * Note: In addition to outright failures, this test reports some
65 * results as warnings. These are not generally of concern, but they
66 * should be evaluated by a human. To see these, run this test in
68 * @param cal the calendar to be tested
69 * @param fieldsToTest an array of field values to be tested, e.g., new
70 * int[] { UCAL_MONTH, UCAL_DAY_OF_MONTH }. It only makes
71 * sense to test the day fields; the time fields are not tested by this
72 * method. If null, then test all standard fields.
73 * @param startDate the first date to test
74 * @param testDuration if positive, the number of days to be tested.
75 * If negative, the number of seconds to run the test.
77 void doLimitsTest(Calendar
& cal
, const int32_t* fieldsToTest
, UDate startDate
, int32_t testDuration
);
80 * doLimitsTest with default test duration and fields
82 void doLimitsTest(Calendar
& cal
, UDate startDate
, int32_t endTime
);
84 UnicodeString
& ymdToString(const Calendar
& cal
, UnicodeString
& str
);
87 #endif /* #if !UCONFIG_NO_FORMATTING */
89 #endif // __CalendarLimitTest__