]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/intltest/tztest.cpp
ICU-551.51.tar.gz
[apple/icu.git] / icuSources / test / intltest / tztest.cpp
index 696957253fe8e658540220f7e2d7f005450731ab..15a251dc9022ecea2c004c62ff5789fce81f4ebe 100644 (file)
@@ -1,6 +1,6 @@
 /***********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2015, International Business Machines Corporation
+ * Copyright (c) 1997-2016, International Business Machines Corporation
  * and others. All Rights Reserved.
  ***********************************************************************/
 
@@ -21,8 +21,6 @@
 #include "cstring.h"
 #include "olsontz.h"
 
-#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
-
 #define CASE(id,test) case id:                               \
                           name = #test;                      \
                           if (exec) {                        \
@@ -137,6 +135,13 @@ TimeZoneTest::TestGenericAPI()
         infoln("WARNING: t_timezone may be incorrect. It is not a multiple of 15min.", tzoffset);
     }
 
+    TimeZone* hostZone = TimeZone::detectHostTimeZone();
+    /* Host time zone's offset should match the offset returned by uprv_timezone() */
+    if (hostZone->getRawOffset() != tzoffset * (-1000)) {
+        errln("FAIL: detectHostTimeZone()'s raw offset != host timezone's offset");
+    }
+    delete hostZone;
+
     UErrorCode status = U_ZERO_ERROR;
     const char* tzver = TimeZone::getTZDataVersion(status);
     if (U_FAILURE(status)) {
@@ -856,7 +861,7 @@ void TimeZoneTest::TestShortZoneIDs()
         {"ECT", 60, TRUE},    // ICU Link - Europe/Paris
         {"MET", 60, TRUE},    // Olson europe 1:00 C-Eur
         {"CAT", 120, FALSE},  // ICU Link - Africa/Maputo
-        {"ART", 120, TRUE},   // ICU Link - Africa/Cairo
+        {"ART", 120, FALSE},  // ICU Link - Africa/Cairo
         {"EET", 120, TRUE},   // Olson europe 2:00 EU
         {"EAT", 180, FALSE},  // ICU Link - Africa/Addis_Ababa
         {"NET", 240, FALSE},  // ICU Link - Asia/Yerevan
@@ -1907,9 +1912,9 @@ void TimeZoneTest::TestFebruary() {
     TimeZone *tz;
     UDate dt;
     int32_t t, i, raw, dst;
-    for (t = 0; t < LENGTHOF(timezones); ++t) {
+    for (t = 0; t < UPRV_LENGTHOF(timezones); ++t) {
         tz = timezones[t];
-        for (i = 0; i < LENGTHOF(data); ++i) {
+        for (i = 0; i < UPRV_LENGTHOF(data); ++i) {
             gc.set(data[i].year, data[i].month, data[i].day,
                    data[i].hour, data[i].minute, data[i].second);
             dt = gc.getTime(status);
@@ -2009,23 +2014,27 @@ void TimeZoneTest::TestCanonicalID() {
         {"Africa/Ouagadougou", "Africa/Abidjan"},
         {"Africa/Porto-Novo", "Africa/Lagos"},
         {"Africa/Sao_Tome", "Africa/Abidjan"},
+        {"America/Antigua", "America/Port_of_Spain"},
+        {"America/Anguilla", "America/Port_of_Spain"},
         {"America/Curacao", "America/Aruba"},
-        {"America/Dominica", "America/Anguilla"},
-        {"America/Grenada", "America/Anguilla"},
-        {"America/Guadeloupe", "America/Anguilla"},
+        {"America/Dominica", "America/Port_of_Spain"},
+        {"America/Grenada", "America/Port_of_Spain"},
+        {"America/Guadeloupe", "America/Port_of_Spain"},
         {"America/Kralendijk", "America/Aruba"},
         {"America/Lower_Princes", "America/Aruba"},
-        {"America/Marigot", "America/Anguilla"},
-        {"America/Montserrat", "America/Anguilla"},
-        {"America/Port_of_Spain", "America/Anguilla"},
-        {"America/Shiprock", "America/Denver"}, // America/Shiprock is defined as a Link to America/Denver in tzdata
-        {"America/St_Barthelemy", "America/Anguilla"},
-        {"America/St_Kitts", "America/Anguilla"},
-        {"America/St_Lucia", "America/Anguilla"},
-        {"America/St_Thomas", "America/Anguilla"},
-        {"America/St_Vincent", "America/Anguilla"},
-        {"America/Tortola", "America/Anguilla"},
-        {"America/Virgin", "America/Anguilla"},
+        {"America/Marigot", "America/Port_of_Spain"},
+        {"America/Montserrat", "America/Port_of_Spain"},
+        {"America/Panama", "America/Cayman"},
+        {"America/Santa_Isabel", "America/Tijuana"},
+        {"America/Shiprock", "America/Denver"},
+        {"America/St_Barthelemy", "America/Port_of_Spain"},
+        {"America/St_Kitts", "America/Port_of_Spain"},
+        {"America/St_Lucia", "America/Port_of_Spain"},
+        {"America/St_Thomas", "America/Port_of_Spain"},
+        {"America/St_Vincent", "America/Port_of_Spain"},
+        {"America/Toronto", "America/Montreal"},
+        {"America/Tortola", "America/Port_of_Spain"},
+        {"America/Virgin", "America/Port_of_Spain"},
         {"Antarctica/South_Pole", "Antarctica/McMurdo"},
         {"Arctic/Longyearbyen", "Europe/Oslo"},
         {"Asia/Kuwait", "Asia/Aden"},
@@ -2055,6 +2064,8 @@ void TimeZoneTest::TestCanonicalID() {
         {"Indian/Mayotte", "Africa/Nairobi"},
         {"Pacific/Auckland", "Antarctica/McMurdo"},
         {"Pacific/Johnston", "Pacific/Honolulu"},
+        {"Pacific/Midway", "Pacific/Pago_Pago"},
+        {"Pacific/Saipan", "Pacific/Guam"},
         {0, 0}
     };