12e5b6d6dSopenharmony_ci// © 2016 and later: Unicode, Inc. and others. 22e5b6d6dSopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html 32e5b6d6dSopenharmony_ci/******************************************************************** 42e5b6d6dSopenharmony_ci * COPYRIGHT: 52e5b6d6dSopenharmony_ci * Copyright (c) 1997-2012, International Business Machines Corporation and 62e5b6d6dSopenharmony_ci * others. All Rights Reserved. 72e5b6d6dSopenharmony_ci ********************************************************************/ 82e5b6d6dSopenharmony_ci/******************************************************************************** 92e5b6d6dSopenharmony_ci* 102e5b6d6dSopenharmony_ci* File CAPITEST.H 112e5b6d6dSopenharmony_ci* 122e5b6d6dSopenharmony_ci* Modification History: 132e5b6d6dSopenharmony_ci* Name Description 142e5b6d6dSopenharmony_ci* Madhu Katragadda Creation 152e5b6d6dSopenharmony_ci*********************************************************************************/ 162e5b6d6dSopenharmony_ci/* C API TEST FOR CALENDAR */ 172e5b6d6dSopenharmony_ci#ifndef _CCALTST 182e5b6d6dSopenharmony_ci#define _CCALTST 192e5b6d6dSopenharmony_ci 202e5b6d6dSopenharmony_ci#include "unicode/utypes.h" 212e5b6d6dSopenharmony_ci#include "unicode/ucal.h" 222e5b6d6dSopenharmony_ci#include "unicode/udat.h" 232e5b6d6dSopenharmony_ci 242e5b6d6dSopenharmony_ci#if !UCONFIG_NO_FORMATTING 252e5b6d6dSopenharmony_ci 262e5b6d6dSopenharmony_ci#include "cintltst.h" 272e5b6d6dSopenharmony_ci 282e5b6d6dSopenharmony_ci 292e5b6d6dSopenharmony_ci /** 302e5b6d6dSopenharmony_ci * The function used to test the Calendar API 312e5b6d6dSopenharmony_ci **/ 322e5b6d6dSopenharmony_ci static void TestCalendar(void); 332e5b6d6dSopenharmony_ci /** 342e5b6d6dSopenharmony_ci * The function used to test getMillis, setMillis, setDate and setDateTime functions extensively 352e5b6d6dSopenharmony_ci **/ 362e5b6d6dSopenharmony_ci static void TestGetSetDateAPI(void); 372e5b6d6dSopenharmony_ci /** 382e5b6d6dSopenharmony_ci * This function is used to test and confirm the functioning of 392e5b6d6dSopenharmony_ci * the calendar get and set functions of calendar fields. 402e5b6d6dSopenharmony_ci **/ 412e5b6d6dSopenharmony_ci static void TestFieldGetSet(void); 422e5b6d6dSopenharmony_ci /** 432e5b6d6dSopenharmony_ci * Execute and test adding and rolling extensively. 442e5b6d6dSopenharmony_ci **/ 452e5b6d6dSopenharmony_ci static void TestAddRollExtensive(void); 462e5b6d6dSopenharmony_ci /** 472e5b6d6dSopenharmony_ci *Testing the Limits for various Fields of Calendar 482e5b6d6dSopenharmony_ci **/ 492e5b6d6dSopenharmony_ci static void TestGetLimits(void); 502e5b6d6dSopenharmony_ci /** 512e5b6d6dSopenharmony_ci * Test that the days of the week progress properly when add is called repeatedly 522e5b6d6dSopenharmony_ci * for increments of 24 days. 532e5b6d6dSopenharmony_ci **/ 542e5b6d6dSopenharmony_ci static void TestDOWProgression(void); 552e5b6d6dSopenharmony_ci /** 562e5b6d6dSopenharmony_ci * Confirm that the offset between local time and GMT behaves as expected. 572e5b6d6dSopenharmony_ci **/ 582e5b6d6dSopenharmony_ci static void TestGMTvsLocal(void); 592e5b6d6dSopenharmony_ci /** 602e5b6d6dSopenharmony_ci * test subroutine used by TestGMTvsLocal() 612e5b6d6dSopenharmony_ci */ 622e5b6d6dSopenharmony_ci static void testZones(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); 632e5b6d6dSopenharmony_ci /** 642e5b6d6dSopenharmony_ci * Test getKeywordValuesForLocale API 652e5b6d6dSopenharmony_ci */ 662e5b6d6dSopenharmony_ci static void TestGetKeywordValuesForLocale(void); 672e5b6d6dSopenharmony_ci /** 682e5b6d6dSopenharmony_ci * Test weekend-related APIs 692e5b6d6dSopenharmony_ci */ 702e5b6d6dSopenharmony_ci static void TestWeekend(void); 712e5b6d6dSopenharmony_ci /** 722e5b6d6dSopenharmony_ci * Test ambiguous wall time 732e5b6d6dSopenharmony_ci */ 742e5b6d6dSopenharmony_ci static void TestAmbiguousWallTime(void); 752e5b6d6dSopenharmony_ci 762e5b6d6dSopenharmony_ci/*Internal functions used*/ 772e5b6d6dSopenharmony_ci /** 782e5b6d6dSopenharmony_ci * test subroutines used by TestAddRollExtensive() 792e5b6d6dSopenharmony_ci **/ 802e5b6d6dSopenharmony_ci static void checkDate(UCalendar* c, int32_t y, int32_t m, int32_t d); 812e5b6d6dSopenharmony_ci 822e5b6d6dSopenharmony_ci static void checkDateTime(UCalendar* c, int32_t y, int32_t m, int32_t d, 832e5b6d6dSopenharmony_ci int32_t hr, int32_t min, int32_t sec, int32_t ms, 842e5b6d6dSopenharmony_ci UCalendarDateFields field); 852e5b6d6dSopenharmony_ci 862e5b6d6dSopenharmony_ci /** 872e5b6d6dSopenharmony_ci * test subroutines used by TestGetSetDateAPI and TestFieldGetSet 882e5b6d6dSopenharmony_ci **/ 892e5b6d6dSopenharmony_ci static void verify1(const char* msg, UCalendar* c, UDateFormat* dat, int32_t year, int32_t month, int32_t day); 902e5b6d6dSopenharmony_ci 912e5b6d6dSopenharmony_ci static void verify2(const char* msg, UCalendar* c, UDateFormat* dat, int32_t year, int32_t month, int32_t day, 922e5b6d6dSopenharmony_ci int32_t hour, int32_t min, int32_t sec, int32_t am_pm); 932e5b6d6dSopenharmony_ci 942e5b6d6dSopenharmony_ci#endif /* #if !UCONFIG_NO_FORMATTING */ 952e5b6d6dSopenharmony_ci 962e5b6d6dSopenharmony_ci#endif 97