OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2007-2013, International Business Machines | 4 * Copyright (C) 2007-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: udatpg_test.c | 8 * file name: udatpg_test.c |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 2007aug01 | 13 * created on: 2007aug01 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 typedef struct { | 114 typedef struct { |
115 UDateTimePatternField field; | 115 UDateTimePatternField field; |
116 UChar name[12]; | 116 UChar name[12]; |
117 } AppendItemNameData; | 117 } AppendItemNameData; |
118 | 118 |
119 static const AppendItemNameData appendItemNameData[] = { /* for Finnish */ | 119 static const AppendItemNameData appendItemNameData[] = { /* for Finnish */ |
120 { UDATPG_YEAR_FIELD, {0x0076,0x0075,0x006F,0x0073,0x0069,0} }, /* "vuosi"
*/ | 120 { UDATPG_YEAR_FIELD, {0x0076,0x0075,0x006F,0x0073,0x0069,0} }, /* "vuosi"
*/ |
121 { UDATPG_MONTH_FIELD, {0x006B,0x0075,0x0075,0x006B,0x0061,0x0075,0x0073,0x
0069,0} }, /* "kuukausi" */ | 121 { UDATPG_MONTH_FIELD, {0x006B,0x0075,0x0075,0x006B,0x0061,0x0075,0x0073,0x
0069,0} }, /* "kuukausi" */ |
122 { UDATPG_WEEKDAY_FIELD, {0x0076,0x0069,0x0069,0x006B,0x006F,0x006E,0x0070,0x
00E4,0x0069,0x0076,0x00E4,0} }, /* "viikonpäivä" */ | 122 { UDATPG_WEEKDAY_FIELD, {0x0076,0x0069,0x0069,0x006B,0x006F,0x006E,0x0070,0x
00E4,0x0069,0x0076,0x00E4,0} }, |
123 { UDATPG_DAY_FIELD, {0x0070,0x00E4,0x0069,0x0076,0x00E4,0} }, /* "päivä"
*/ | 123 { UDATPG_DAY_FIELD, {0x0070,0x00E4,0x0069,0x0076,0x00E4,0} }, |
124 { UDATPG_HOUR_FIELD, {0x0074,0x0075,0x006E,0x0074,0x0069,0} }, /* "tunti"
*/ | 124 { UDATPG_HOUR_FIELD, {0x0074,0x0075,0x006E,0x0074,0x0069,0} }, /* "tunti"
*/ |
125 { UDATPG_FIELD_COUNT, {0} } /* terminator */ | 125 { UDATPG_FIELD_COUNT, {0} } /* terminator */ |
126 }; | 126 }; |
127 | 127 |
128 static void TestUsage() { | 128 static void TestUsage() { |
129 UErrorCode errorCode=U_ZERO_ERROR; | 129 UErrorCode errorCode=U_ZERO_ERROR; |
130 UDateTimePatternGenerator *dtpg; | 130 UDateTimePatternGenerator *dtpg; |
131 const AppendItemNameData * appItemNameDataPtr; | 131 const AppendItemNameData * appItemNameDataPtr; |
132 UChar bestPattern[20]; | 132 UChar bestPattern[20]; |
133 UChar result[20]; | 133 UChar result[20]; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 const char * locale; | 376 const char * locale; |
377 const UChar * skel; | 377 const UChar * skel; |
378 UDateTimePatternMatchOptions options; | 378 UDateTimePatternMatchOptions options; |
379 const UChar * expectedPattern; | 379 const UChar * expectedPattern; |
380 } DTPtnGenOptionsData; | 380 } DTPtnGenOptionsData; |
381 enum { kTestOptionsPatLenMax = 32 }; | 381 enum { kTestOptionsPatLenMax = 32 }; |
382 | 382 |
383 static const UChar skel_Hmm[] = { 0x0048, 0x006D, 0x006D, 0 }; | 383 static const UChar skel_Hmm[] = { 0x0048, 0x006D, 0x006D, 0 }; |
384 static const UChar skel_HHmm[] = { 0x0048, 0x0048, 0x006D, 0x006D, 0 }; | 384 static const UChar skel_HHmm[] = { 0x0048, 0x0048, 0x006D, 0x006D, 0 }; |
385 static const UChar skel_hhmm[] = { 0x0068, 0x0068, 0x006D, 0x006D, 0 }; | 385 static const UChar skel_hhmm[] = { 0x0068, 0x0068, 0x006D, 0x006D, 0 }; |
386 static const UChar patn_Hcmm[] = { 0x0048, 0x003A, 0x006D, 0x006D, 0 }; /* H:
mm */ | |
387 static const UChar patn_hcmm_a[] = { 0x0068, 0x003A, 0x006D, 0x006D, 0x0020, 0x
0061, 0 }; /* h:mm a */ | 386 static const UChar patn_hcmm_a[] = { 0x0068, 0x003A, 0x006D, 0x006D, 0x0020, 0x
0061, 0 }; /* h:mm a */ |
388 static const UChar patn_HHcmm[] = { 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0
}; /* HH:mm */ | 387 static const UChar patn_HHcmm[] = { 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0
}; /* HH:mm */ |
389 static const UChar patn_hhcmm_a[] = { 0x0068, 0x0068, 0x003A, 0x006D, 0x006D, 0x
0020, 0x0061, 0 }; /* hh:mm a */ | 388 static const UChar patn_hhcmm_a[] = { 0x0068, 0x0068, 0x003A, 0x006D, 0x006D, 0x
0020, 0x0061, 0 }; /* hh:mm a */ |
390 static const UChar patn_HHpmm[] = { 0x0048, 0x0048, 0x002E, 0x006D, 0x006D, 0
}; /* HH.mm */ | 389 static const UChar patn_HHpmm[] = { 0x0048, 0x0048, 0x002E, 0x006D, 0x006D, 0
}; /* HH.mm */ |
391 static const UChar patn_hpmm_a[] = { 0x0068, 0x002E, 0x006D, 0x006D, 0x0020, 0x
0061, 0 }; /* h.mm a */ | 390 static const UChar patn_hpmm_a[] = { 0x0068, 0x002E, 0x006D, 0x006D, 0x0020, 0x
0061, 0 }; /* h.mm a */ |
392 static const UChar patn_Hpmm[] = { 0x0048, 0x002E, 0x006D, 0x006D, 0 }; /* H.
mm */ | 391 static const UChar patn_Hpmm[] = { 0x0048, 0x002E, 0x006D, 0x006D, 0 }; /* H.
mm */ |
393 static const UChar patn_hhpmm_a[] = { 0x0068, 0x0068, 0x002E, 0x006D, 0x006D, 0x
0020, 0x0061, 0 }; /* hh.mm a */ | 392 static const UChar patn_hhpmm_a[] = { 0x0068, 0x0068, 0x002E, 0x006D, 0x006D, 0x
0020, 0x0061, 0 }; /* hh.mm a */ |
394 | 393 |
395 static void TestOptions() { | 394 static void TestOptions() { |
396 const DTPtnGenOptionsData testData[] = { | 395 const DTPtnGenOptionsData testData[] = { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 u_austrncpy(patternBytes,pattern,kTestOptionsPatLenMax),
status ); | 429 u_austrncpy(patternBytes,pattern,kTestOptionsPatLenMax),
status ); |
431 } | 430 } |
432 udatpg_close(dtpgen); | 431 udatpg_close(dtpgen); |
433 } else { | 432 } else { |
434 log_data_err("ERROR udatpg_open failed for locale %s : %s - (Are you
missing data?)\n", testDataPtr->locale, myErrorName(status)); | 433 log_data_err("ERROR udatpg_open failed for locale %s : %s - (Are you
missing data?)\n", testDataPtr->locale, myErrorName(status)); |
435 } | 434 } |
436 } | 435 } |
437 } | 436 } |
438 | 437 |
439 #endif | 438 #endif |
OLD | NEW |