2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2003-12-04 00:47:56 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 2003-2008, International Business Machines Corporation
|
|
|
|
* and others. All Rights Reserved.
|
2003-12-04 00:47:56 +00:00
|
|
|
********************************************************************
|
|
|
|
* Calendar Case Test is a type of CalendarTest which compares the
|
|
|
|
* behavior of a calendar to a certain set of 'test cases', involving
|
|
|
|
* conversion between julian-day to fields and vice versa.
|
|
|
|
********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CalendarCaseTest__
|
|
|
|
#define __CalendarCaseTest__
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
|
|
|
#include "unicode/calendar.h"
|
|
|
|
#include "unicode/smpdtfmt.h"
|
|
|
|
#include "caltest.h"
|
|
|
|
|
|
|
|
class CalendarCaseTest: public CalendarTest {
|
|
|
|
public:
|
|
|
|
virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
|
|
|
|
|
|
|
|
/* Test case struct */
|
|
|
|
struct TestCase {
|
|
|
|
double julian; // Julian Date
|
|
|
|
int32_t era;
|
|
|
|
int32_t year;
|
|
|
|
int32_t month;
|
|
|
|
int32_t day;
|
|
|
|
int32_t dayOfWeek;
|
|
|
|
int32_t hour;
|
|
|
|
int32_t min;
|
|
|
|
int32_t sec;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param cases array of items to test. Terminate with a "-1" for era.
|
|
|
|
*/
|
|
|
|
void doTestCases(const TestCase *cases, Calendar *cal);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Utility function to test out a specific field
|
|
|
|
* @param cal calendar
|
|
|
|
* @param field which field
|
|
|
|
* @param value expected value
|
|
|
|
* @param status err status
|
|
|
|
* @return boolean indicating success (TRUE) or failure (FALSE) of the test.
|
|
|
|
*/
|
|
|
|
UBool checkField(Calendar *cal, UCalendarDateFields field, int32_t value, UErrorCode &status);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// test cases
|
|
|
|
void IslamicCivil();
|
2003-12-10 19:55:23 +00:00
|
|
|
void Hebrew();
|
2007-07-17 21:17:35 +00:00
|
|
|
void Indian();
|
2008-03-22 02:58:07 +00:00
|
|
|
void Coptic();
|
|
|
|
void Ethiopic();
|
2003-12-04 00:47:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|