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