| OLD | NEW |
| 1 /******************************************************************** | 1 /******************************************************************** |
| 2 * Copyright (c) 1997-2013, International Business Machines | 2 * Copyright (c) 1997-2014, International Business Machines |
| 3 * Corporation and others. All Rights Reserved. | 3 * Corporation and others. All Rights Reserved. |
| 4 ******************************************************************** | 4 ******************************************************************** |
| 5 * | 5 * |
| 6 * File CCALTST.C | 6 * File CCALTST.C |
| 7 * | 7 * |
| 8 * Modification History: | 8 * Modification History: |
| 9 * Name Description | 9 * Name Description |
| 10 * Madhu Katragadda Creation | 10 * Madhu Katragadda Creation |
| 11 ******************************************************************** | 11 ******************************************************************** |
| 12 */ | 12 */ |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 log_err("FAIL: Bad version string was returned by ucal_getTZDataVersion\
n"); | 252 log_err("FAIL: Bad version string was returned by ucal_getTZDataVersion\
n"); |
| 253 } else { | 253 } else { |
| 254 log_verbose("PASS: ucal_getTZDataVersion returned %s\n", tzver); | 254 log_verbose("PASS: ucal_getTZDataVersion returned %s\n", tzver); |
| 255 } | 255 } |
| 256 | 256 |
| 257 /*Testing ucal_getCanonicalTimeZoneID*/ | 257 /*Testing ucal_getCanonicalTimeZoneID*/ |
| 258 status = U_ZERO_ERROR; | 258 status = U_ZERO_ERROR; |
| 259 resultlength = ucal_getCanonicalTimeZoneID(PST, -1, | 259 resultlength = ucal_getCanonicalTimeZoneID(PST, -1, |
| 260 canonicalID, sizeof(canonicalID)/sizeof(UChar), &isSystemID, &status); | 260 canonicalID, sizeof(canonicalID)/sizeof(UChar), &isSystemID, &status); |
| 261 if (U_FAILURE(status)) { | 261 if (U_FAILURE(status)) { |
| 262 log_err("FAIL: error in ucal_getCanonicalTimeZoneID : %s\n", u_errorName
(status)); | 262 log_data_err("FAIL: error in ucal_getCanonicalTimeZoneID : %s\n", u_erro
rName(status)); |
| 263 } else { | 263 } else { |
| 264 if (u_strcmp(AMERICA_LOS_ANGELES, canonicalID) != 0) { | 264 if (u_strcmp(AMERICA_LOS_ANGELES, canonicalID) != 0) { |
| 265 log_data_err("FAIL: ucal_getCanonicalTimeZoneID(%s) returned %s : ex
pected - %s (Are you missing data?)\n", | 265 log_data_err("FAIL: ucal_getCanonicalTimeZoneID(%s) returned %s : ex
pected - %s (Are you missing data?)\n", |
| 266 PST, canonicalID, AMERICA_LOS_ANGELES); | 266 PST, canonicalID, AMERICA_LOS_ANGELES); |
| 267 } | 267 } |
| 268 if (!isSystemID) { | 268 if (!isSystemID) { |
| 269 log_data_err("FAIL: ucal_getCanonicalTimeZoneID(%s) set %d to isSyst
emID (Are you missing data?)\n", | 269 log_data_err("FAIL: ucal_getCanonicalTimeZoneID(%s) set %d to isSyst
emID (Are you missing data?)\n", |
| 270 PST, isSystemID); | 270 PST, isSystemID); |
| 271 } | 271 } |
| 272 } | 272 } |
| (...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 { 2000, UCAL_MARCH, 18, 0, 0, 1 }, /* Sat 00:00 */ | 1672 { 2000, UCAL_MARCH, 18, 0, 0, 1 }, /* Sat 00:00 */ |
| 1673 { 2000, UCAL_MARCH, 18, 15, 0, 1 }, /* Sat 15:00 */ | 1673 { 2000, UCAL_MARCH, 18, 15, 0, 1 }, /* Sat 15:00 */ |
| 1674 { 2000, UCAL_MARCH, 19, 23, 0, 1 }, /* Sun 23:00 */ | 1674 { 2000, UCAL_MARCH, 19, 23, 0, 1 }, /* Sun 23:00 */ |
| 1675 { 2000, UCAL_MARCH, 20, 0, -1, 1 }, /* Sun 23:59:59.999 */ | 1675 { 2000, UCAL_MARCH, 20, 0, -1, 1 }, /* Sun 23:59:59.999 */ |
| 1676 { 2000, UCAL_MARCH, 20, 0, 0, 0 }, /* Mon 00:00 */ | 1676 { 2000, UCAL_MARCH, 20, 0, 0, 0 }, /* Mon 00:00 */ |
| 1677 { 2000, UCAL_MARCH, 20, 8, 0, 0 }, /* Mon 08:00 */ | 1677 { 2000, UCAL_MARCH, 20, 8, 0, 0 }, /* Mon 08:00 */ |
| 1678 }; | 1678 }; |
| 1679 static const TestWeekendDates weekendDates_ar_OM[] = { | 1679 static const TestWeekendDates weekendDates_ar_OM[] = { |
| 1680 { 2000, UCAL_MARCH, 15, 23, 0, 0 }, /* Wed 23:00 */ | 1680 { 2000, UCAL_MARCH, 15, 23, 0, 0 }, /* Wed 23:00 */ |
| 1681 { 2000, UCAL_MARCH, 16, 0, -1, 0 }, /* Wed 23:59:59.999 */ | 1681 { 2000, UCAL_MARCH, 16, 0, -1, 0 }, /* Wed 23:59:59.999 */ |
| 1682 { 2000, UCAL_MARCH, 16, 0, 0, 1 }, /* Thu 00:00 */ | 1682 { 2000, UCAL_MARCH, 16, 0, 0, 0 }, /* Thu 00:00 */ |
| 1683 { 2000, UCAL_MARCH, 16, 15, 0, 1 }, /* Thu 15:00 */ | 1683 { 2000, UCAL_MARCH, 16, 15, 0, 0 }, /* Thu 15:00 */ |
| 1684 { 2000, UCAL_MARCH, 17, 23, 0, 1 }, /* Fri 23:00 */ | 1684 { 2000, UCAL_MARCH, 17, 23, 0, 1 }, /* Fri 23:00 */ |
| 1685 { 2000, UCAL_MARCH, 18, 0, -1, 1 }, /* Fri 23:59:59.999 */ | 1685 { 2000, UCAL_MARCH, 18, 0, -1, 1 }, /* Fri 23:59:59.999 */ |
| 1686 { 2000, UCAL_MARCH, 18, 0, 0, 0 }, /* Sat 00:00 */ | 1686 { 2000, UCAL_MARCH, 18, 0, 0, 1 }, /* Sat 00:00 */ |
| 1687 { 2000, UCAL_MARCH, 18, 8, 0, 0 }, /* Sat 08:00 */ | 1687 { 2000, UCAL_MARCH, 18, 8, 0, 1 }, /* Sat 08:00 */ |
| 1688 }; | 1688 }; |
| 1689 static const TestWeekendDatesList testDates[] = { | 1689 static const TestWeekendDatesList testDates[] = { |
| 1690 { "en_US", weekendDates_en_US, sizeof(weekendDates_en_US)/sizeof(weekendDate
s_en_US[0]) }, | 1690 { "en_US", weekendDates_en_US, sizeof(weekendDates_en_US)/sizeof(weekendDate
s_en_US[0]) }, |
| 1691 { "ar_OM", weekendDates_ar_OM, sizeof(weekendDates_ar_OM)/sizeof(weekendDate
s_ar_OM[0]) }, | 1691 { "ar_OM", weekendDates_ar_OM, sizeof(weekendDates_ar_OM)/sizeof(weekendDate
s_ar_OM[0]) }, |
| 1692 }; | 1692 }; |
| 1693 | 1693 |
| 1694 typedef struct { | 1694 typedef struct { |
| 1695 UCalendarDaysOfWeek dayOfWeek; | 1695 UCalendarDaysOfWeek dayOfWeek; |
| 1696 UCalendarWeekdayType dayType; | 1696 UCalendarWeekdayType dayType; |
| 1697 int32_t transition; /* transition time if dayType is UCAL_WEEKE
ND_ONSET or UCAL_WEEKEND_CEASE; else must be 0 */ | 1697 int32_t transition; /* transition time if dayType is UCAL_WEEKE
ND_ONSET or UCAL_WEEKEND_CEASE; else must be 0 */ |
| 1698 } TestDaysOfWeek; | 1698 } TestDaysOfWeek; |
| 1699 typedef struct { | 1699 typedef struct { |
| 1700 const char * locale; | 1700 const char * locale; |
| 1701 const TestDaysOfWeek * days; | 1701 const TestDaysOfWeek * days; |
| 1702 int32_t numDays; | 1702 int32_t numDays; |
| 1703 } TestDaysOfWeekList; | 1703 } TestDaysOfWeekList; |
| 1704 | 1704 |
| 1705 static const TestDaysOfWeek daysOfWeek_en_US[] = { | 1705 static const TestDaysOfWeek daysOfWeek_en_US[] = { |
| 1706 { UCAL_MONDAY, UCAL_WEEKDAY, 0 }, | 1706 { UCAL_MONDAY, UCAL_WEEKDAY, 0 }, |
| 1707 { UCAL_FRIDAY, UCAL_WEEKDAY, 0 }, | 1707 { UCAL_FRIDAY, UCAL_WEEKDAY, 0 }, |
| 1708 { UCAL_SATURDAY, UCAL_WEEKEND, 0 }, | 1708 { UCAL_SATURDAY, UCAL_WEEKEND, 0 }, |
| 1709 { UCAL_SUNDAY, UCAL_WEEKEND, 0 }, | 1709 { UCAL_SUNDAY, UCAL_WEEKEND, 0 }, |
| 1710 }; | 1710 }; |
| 1711 static const TestDaysOfWeek daysOfWeek_ar_OM[] = { /* Thursday:Friday */ | 1711 static const TestDaysOfWeek daysOfWeek_ar_OM[] = { /* Friday:Saturday */ |
| 1712 { UCAL_WEDNESDAY,UCAL_WEEKDAY, 0 }, | 1712 { UCAL_WEDNESDAY,UCAL_WEEKDAY, 0 }, |
| 1713 { UCAL_SATURDAY, UCAL_WEEKDAY, 0 }, | 1713 { UCAL_THURSDAY, UCAL_WEEKDAY, 0 }, |
| 1714 { UCAL_THURSDAY, UCAL_WEEKEND, 0 }, | |
| 1715 { UCAL_FRIDAY, UCAL_WEEKEND, 0 }, | 1714 { UCAL_FRIDAY, UCAL_WEEKEND, 0 }, |
| 1715 { UCAL_SATURDAY, UCAL_WEEKEND, 0 }, |
| 1716 }; | 1716 }; |
| 1717 static const TestDaysOfWeek daysOfWeek_hi_IN[] = { /* Sunday only */ | 1717 static const TestDaysOfWeek daysOfWeek_hi_IN[] = { /* Sunday only */ |
| 1718 { UCAL_MONDAY, UCAL_WEEKDAY, 0 }, | 1718 { UCAL_MONDAY, UCAL_WEEKDAY, 0 }, |
| 1719 { UCAL_FRIDAY, UCAL_WEEKDAY, 0 }, | 1719 { UCAL_FRIDAY, UCAL_WEEKDAY, 0 }, |
| 1720 { UCAL_SATURDAY, UCAL_WEEKDAY, 0 }, | 1720 { UCAL_SATURDAY, UCAL_WEEKDAY, 0 }, |
| 1721 { UCAL_SUNDAY, UCAL_WEEKEND, 0 }, | 1721 { UCAL_SUNDAY, UCAL_WEEKEND, 0 }, |
| 1722 }; | 1722 }; |
| 1723 static const TestDaysOfWeekList testDays[] = { | 1723 static const TestDaysOfWeekList testDays[] = { |
| 1724 { "en_US", daysOfWeek_en_US, sizeof(daysOfWeek_en_US)/sizeof(daysOfWeek_en_U
S[0]) }, | 1724 { "en_US", daysOfWeek_en_US, sizeof(daysOfWeek_en_US)/sizeof(daysOfWeek_en_U
S[0]) }, |
| 1725 { "ar_OM", daysOfWeek_ar_OM, sizeof(daysOfWeek_ar_OM)/sizeof(daysOfWeek_ar_O
M[0]) }, | 1725 { "ar_OM", daysOfWeek_ar_OM, sizeof(daysOfWeek_ar_OM)/sizeof(daysOfWeek_ar_O
M[0]) }, |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2288 } TZTransitionItem; | 2288 } TZTransitionItem; |
| 2289 | 2289 |
| 2290 /* have zoneGMT above */ | 2290 /* have zoneGMT above */ |
| 2291 static const UChar zoneUSPacific[] = { 0x55,0x53,0x2F,0x50,0x61,0x63,0x69,0x66,0
x69,0x63,0 }; /* "US/Pacific" */ | 2291 static const UChar zoneUSPacific[] = { 0x55,0x53,0x2F,0x50,0x61,0x63,0x69,0x66,0
x69,0x63,0 }; /* "US/Pacific" */ |
| 2292 static const UChar zoneCairo[] = { 0x41,0x66,0x72,0x69,0x63,0x61,0x2F,0x43,0
x61,0x69,0x72,0x6F,0 }; /* "Africa/Cairo", DST cancelled since 2011 */ | 2292 static const UChar zoneCairo[] = { 0x41,0x66,0x72,0x69,0x63,0x61,0x2F,0x43,0
x61,0x69,0x72,0x6F,0 }; /* "Africa/Cairo", DST cancelled since 2011 */ |
| 2293 static const UChar zoneIceland[] = { 0x41,0x74,0x6C,0x61,0x6E,0x74,0x69,0x63,0
x2F,0x52,0x65,0x79,0x6B,0x6A,0x61,0x76,0x69,0x6B,0 }; /* "Atlantic/Reykjavik", a
lways on DST (since when?) */ | 2293 static const UChar zoneIceland[] = { 0x41,0x74,0x6C,0x61,0x6E,0x74,0x69,0x63,0
x2F,0x52,0x65,0x79,0x6B,0x6A,0x61,0x76,0x69,0x6B,0 }; /* "Atlantic/Reykjavik", a
lways on DST (since when?) */ |
| 2294 | 2294 |
| 2295 static const TZTransitionItem tzTransitionItems[] = { | 2295 static const TZTransitionItem tzTransitionItems[] = { |
| 2296 { "USPacific mid 2012", zoneUSPacific, 2012, UCAL_JULY, 1, TRUE , TRUE }, | 2296 { "USPacific mid 2012", zoneUSPacific, 2012, UCAL_JULY, 1, TRUE , TRUE }, |
| 2297 { "USPacific mid 100", zoneUSPacific, 100, UCAL_JULY, 1, FALSE, TRUE }, /
* no transitions before 100 CE... */ | 2297 { "USPacific mid 100", zoneUSPacific, 100, UCAL_JULY, 1, FALSE, TRUE }, /
* no transitions before 100 CE... */ |
| 2298 { "Cairo mid 2012", zoneCairo, 2012, UCAL_JULY, 1, TRUE , FALSE }, /
* DST cancelled since 2011 */ | 2298 { "Cairo mid 2012", zoneCairo, 2012, UCAL_JULY, 1, TRUE , TRUE }, /
* DST cancelled since 2011 (Changed since 2014c) */ |
| 2299 { "Iceland mid 2012", zoneIceland, 2012, UCAL_JULY, 1, TRUE , FALSE }, /
* always on DST */ | 2299 { "Iceland mid 2012", zoneIceland, 2012, UCAL_JULY, 1, TRUE , FALSE }, /
* always on DST */ |
| 2300 { NULL, NULL, 0, 0, 0, FALSE, FALSE } /*
terminator */ | 2300 { NULL, NULL, 0, 0, 0, FALSE, FALSE } /*
terminator */ |
| 2301 }; | 2301 }; |
| 2302 | 2302 |
| 2303 void TestGetTZTransition() { | 2303 void TestGetTZTransition() { |
| 2304 UErrorCode status = U_ZERO_ERROR; | 2304 UErrorCode status = U_ZERO_ERROR; |
| 2305 UCalendar * ucal = ucal_open(zoneGMT, -1, "en", UCAL_GREGORIAN, &status); | 2305 UCalendar * ucal = ucal_open(zoneGMT, -1, "en", UCAL_GREGORIAN, &status); |
| 2306 if ( U_SUCCESS(status) ) { | 2306 if ( U_SUCCESS(status) ) { |
| 2307 const TZTransitionItem * itemPtr; | 2307 const TZTransitionItem * itemPtr; |
| 2308 for (itemPtr = tzTransitionItems; itemPtr->descrip != NULL; itemPtr++) { | 2308 for (itemPtr = tzTransitionItems; itemPtr->descrip != NULL; itemPtr++) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2438 if (U_FAILURE(status)) { | 2438 if (U_FAILURE(status)) { |
| 2439 log_data_err("FAIL: TZ ID for Bogus, status %s\n", u_errorName(statu
s)); | 2439 log_data_err("FAIL: TZ ID for Bogus, status %s\n", u_errorName(statu
s)); |
| 2440 } else if (len != 0) { | 2440 } else if (len != 0) { |
| 2441 log_err("FAIL: TZ ID for Bogus\n"); | 2441 log_err("FAIL: TZ ID for Bogus\n"); |
| 2442 } | 2442 } |
| 2443 } | 2443 } |
| 2444 } | 2444 } |
| 2445 | 2445 |
| 2446 | 2446 |
| 2447 #endif /* #if !UCONFIG_NO_FORMATTING */ | 2447 #endif /* #if !UCONFIG_NO_FORMATTING */ |
| OLD | NEW |