OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2012, International Business Machines Corporation and | 3 * Copyright (c) 1997-2014, International Business Machines Corporation and |
4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 /*******************************************************************************
* | 6 /*******************************************************************************
* |
7 * | 7 * |
8 * File CDTDPTST.C | 8 * File CDTDPTST.C |
9 * | 9 * |
10 * Modification History: | 10 * Modification History: |
11 * Name Description | 11 * Name Description |
12 * Madhu Katragadda Creation | 12 * Madhu Katragadda Creation |
13 ********************************************************************************
* | 13 ********************************************************************************
* |
(...skipping 17 matching lines...) Expand all Loading... |
31 | 31 |
32 void addDtFrDepTest(TestNode** root); | 32 void addDtFrDepTest(TestNode** root); |
33 | 33 |
34 void addDtFrDepTest(TestNode** root) | 34 void addDtFrDepTest(TestNode** root) |
35 { | 35 { |
36 addTest(root, &TestTwoDigitYearDSTParse, "tsformat/cdtdptst/TestTwoDigitYear
DSTParse"); | 36 addTest(root, &TestTwoDigitYearDSTParse, "tsformat/cdtdptst/TestTwoDigitYear
DSTParse"); |
37 addTest(root, &TestPartialParse994, "tsformat/cdtdptst/TestPartialParse994")
; | 37 addTest(root, &TestPartialParse994, "tsformat/cdtdptst/TestPartialParse994")
; |
38 addTest(root, &TestRunTogetherPattern985, "tsformat/cdtdptst/TestRunTogether
Pattern985"); | 38 addTest(root, &TestRunTogetherPattern985, "tsformat/cdtdptst/TestRunTogether
Pattern985"); |
39 addTest(root, &TestCzechMonths459, "tsformat/cdtdptst/TestCzechMonths459"); | 39 addTest(root, &TestCzechMonths459, "tsformat/cdtdptst/TestCzechMonths459"); |
40 addTest(root, &TestQuotePattern161, "tsformat/cdtdptst/TestQuotePattern161")
; | 40 addTest(root, &TestQuotePattern161, "tsformat/cdtdptst/TestQuotePattern161")
; |
| 41 addTest(root, &TestBooleanAttributes, "tsformat/cdtdptst/TestBooleanAttribut
es"); |
| 42 |
41 | 43 |
42 } | 44 } |
43 | 45 |
44 /** | 46 /** |
45 * Test the parsing of 2-digit years. | 47 * Test the parsing of 2-digit years. |
46 */ | 48 */ |
47 void TestTwoDigitYearDSTParse() | 49 void TestTwoDigitYearDSTParse() |
48 { | 50 { |
49 UDateFormat *fullFmt, *fmt; | 51 UDateFormat *fullFmt, *fmt; |
50 UErrorCode status = U_ZERO_ERROR; | 52 UErrorCode status = U_ZERO_ERROR; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 344 |
343 udat_close(format); | 345 udat_close(format); |
344 ucal_close(cal); | 346 ucal_close(cal); |
345 free(exp); | 347 free(exp); |
346 free(tzID); | 348 free(tzID); |
347 free(pattern); | 349 free(pattern); |
348 | 350 |
349 ctest_resetTimeZone(); | 351 ctest_resetTimeZone(); |
350 } | 352 } |
351 | 353 |
| 354 /* |
| 355 * Testing udat_getBooleanAttribute and unum_setBooleanAttribute() to make sure
basic C wrapper functionality is present |
| 356 */ |
| 357 void TestBooleanAttributes(void) |
| 358 { |
| 359 UDateFormat *en; |
| 360 UErrorCode status=U_ZERO_ERROR; |
| 361 UBool initialState = TRUE; |
| 362 UBool switchedState = FALSE; |
| 363 |
| 364 log_verbose("\ncreating a date format with english locale\n"); |
| 365 en = udat_open(UDAT_FULL, UDAT_DEFAULT, "en_US", NULL, 0, NULL, 0, &status); |
| 366 if(U_FAILURE(status)) { |
| 367 log_data_err("error in creating the dateformat -> %s (Are you missing da
ta?)\n", |
| 368 myErrorName(status) ); |
| 369 return; |
| 370 } |
| 371 |
| 372 |
| 373 initialState = udat_getBooleanAttribute(en, UDAT_PARSE_ALLOW_NUMERIC, &statu
s); |
| 374 if(initialState != TRUE) switchedState = TRUE; // if it wasn't the default
of TRUE, then flip what we expect |
| 375 |
| 376 udat_setBooleanAttribute(en, UDAT_PARSE_ALLOW_NUMERIC, switchedState, &statu
s); |
| 377 if(switchedState != udat_getBooleanAttribute(en, UDAT_PARSE_ALLOW_NUMERIC, &
status)) { |
| 378 log_err("unable to switch states!"); |
| 379 return; |
| 380 } |
| 381 |
| 382 udat_close(en); |
| 383 } |
| 384 |
352 #endif /* #if !UCONFIG_NO_FORMATTING */ | 385 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |