1 /********************************************************************
3 * Copyright (c) 1997-2012, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6 /********************************************************************************
10 * Modification History:
12 * Madhu Katragadda Creation
13 *********************************************************************************/
14 /* C API TEST FOR CALENDAR */
18 #include "unicode/utypes.h"
20 #if !UCONFIG_NO_FORMATTING
26 * The function used to test the Calendar API
28 static void TestCalendar(void);
30 * The function used to test getMillis, setMillis, setDate and setDateTime functions extensively
32 static void TestGetSetDateAPI(void);
34 * This function is used to test and confirm the functioning of
35 * the calendar get and set functions of calendar fields.
37 static void TestFieldGetSet(void);
39 * Execute and test adding and rolling extensively.
41 static void TestAddRollExtensive(void);
43 *Testing the Limits for various Fields of Calendar
45 static void TestGetLimits(void);
47 * Test that the days of the week progress properly when add is called repeatedly
48 * for increments of 24 days.
50 static void TestDOWProgression(void);
52 * Confirm that the offset between local time and GMT behaves as expected.
54 static void TestGMTvsLocal(void);
56 * test subroutine used by TestGMTvsLocal()
58 static void testZones(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t);
60 * Test getKeywordValuesForLocale API
62 static void TestGetKeywordValuesForLocale(void);
64 * Test weekend-related APIs
66 static void TestWeekend(void);
68 * Test ambiguous wall time
70 static void TestAmbiguousWallTime(void);
72 /*Internal functions used*/
74 * test subroutines used by TestAddRollExtensive()
76 static void checkDate(UCalendar
* c
, int32_t y
, int32_t m
, int32_t d
);
78 static void checkDateTime(UCalendar
* c
, int32_t y
, int32_t m
, int32_t d
,
79 int32_t hr
, int32_t min
, int32_t sec
, int32_t ms
,
80 UCalendarDateFields field
);
83 * test subroutines used by TestGetSetDateAPI and TestFieldGetSet
85 static void verify1(const char* msg
, UCalendar
* c
, UDateFormat
* dat
, int32_t year
, int32_t month
, int32_t day
);
87 static void verify2(const char* msg
, UCalendar
* c
, UDateFormat
* dat
, int32_t year
, int32_t month
, int32_t day
,
88 int32_t hour
, int32_t min
, int32_t sec
, int32_t am_pm
);
90 #endif /* #if !UCONFIG_NO_FORMATTING */