1// Copyright (C) 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3/********************************************************************
4 * COPYRIGHT:
5 * Copyright (c) 2003-2008, International Business Machines Corporation
6 * and others. All Rights Reserved.
7 ********************************************************************
8 * Calendar Case Test is a type of CalendarTest which compares the
9 * behavior of a calendar to a certain set of 'test cases', involving
10 * conversion between julian-day to fields and vice versa.
11 ********************************************************************/
12
13#ifndef __CalendarCaseTest__
14#define __CalendarCaseTest__
15
16#include "unicode/utypes.h"
17
18#if !UCONFIG_NO_FORMATTING
19
20#include "unicode/calendar.h"
21#include "unicode/smpdtfmt.h"
22#include "caltest.h"
23
24class CalendarCaseTest: public CalendarTest {
25 public:
26  virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
27
28  /* Test case struct */
29  struct TestCase {
30    double julian; // Julian Date
31    int32_t era;
32    int32_t year;
33    int32_t month;
34    int32_t day;
35    int32_t dayOfWeek;
36    int32_t hour;
37    int32_t min;
38    int32_t sec;
39  };
40
41  /**
42   * @param cases array of items to test.  Terminate with a "-1" for era.
43   */
44  void doTestCases(const TestCase *cases, Calendar *cal);
45
46 private:
47  /**
48   * Utility function to test out a specific field
49   * @param cal calendar
50   * @param field which field
51   * @param value expected value
52   * @param status err status
53   * @return boolean indicating success (TRUE) or failure (FALSE) of the test.
54   */
55  UBool checkField(Calendar *cal, UCalendarDateFields field, int32_t value, UErrorCode &status);
56
57 private:
58  // test cases
59  void IslamicCivil();
60  void Hebrew();
61  void Indian();
62  void Coptic();
63  void Ethiopic();
64};
65
66#endif
67#endif
68