+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
-* Copyright (C) 2007-2012, International Business Machines Corporation and *
-* others. All Rights Reserved. *
+* Copyright (C) 2007-2016, International Business Machines Corporation and
+* others. All Rights Reserved.
*******************************************************************************
*/
#include "unicode/tzrule.h"
#include "unicode/calendar.h"
#include "unicode/gregocal.h"
+#include "unicode/strenum.h"
#include "unicode/ucal.h"
#include "unicode/unistr.h"
#include "unicode/ustring.h"
#define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
#define HOUR (60*60*1000)
-static const UVersionInfo ICU_453 = {4,5,3,0};
-
static const char *const TESTZIDS[] = {
"AGT",
"America/New_York",
len = tzenum->count(status);
} else {
tzenum = NULL;
- len = (int32_t)sizeof(TESTZIDS)/sizeof(TESTZIDS[0]);
+ len = UPRV_LENGTHOF(TESTZIDS);
}
}
if (rbtz1->hasSameRules(*rbtz3)) {
errln("FAIL: rbtz1 and rbtz3 have different rules, but returned true.");
}
- RuleBasedTimeZone *rbtz1c = (RuleBasedTimeZone*)rbtz1->clone();
+ RuleBasedTimeZone *rbtz1c = rbtz1->clone();
if (!rbtz1->hasSameRules(*rbtz1c)) {
errln("FAIL: Cloned RuleBasedTimeZone must have the same rules with the original.");
}
if (ny->hasSameRules(*rbtz) || rbtz->hasSameRules(*ny)) {
errln("FAIL: hasSameRules must return false");
}
- RuleBasedTimeZone *rbtzc = (RuleBasedTimeZone*)rbtz->clone();
+ RuleBasedTimeZone *rbtzc = rbtz->clone();
if (!rbtz->hasSameRules(*rbtzc) || !rbtz->hasEquivalentTransitions(*rbtzc, jan1_1950, jan1_2010, TRUE, status)) {
errln("FAIL: hasSameRules/hasEquivalentTransitions must return true for cloned RBTZs");
}
}
// Cloned TimeZone
- BasicTimeZone *newyork2 = (BasicTimeZone*)newyork->clone();
+ BasicTimeZone *newyork2 = newyork->clone();
if (!newyork->hasEquivalentTransitions(*newyork2, jan1_1971, jan1_2011, FALSE, status)) {
errln("FAIL: Cloned TimeZone must have the same transitions");
}
getUTCMillis(2005, UCAL_JULY, 1),
getUTCMillis(2010, UCAL_NOVEMBER, 1),
};
- int32_t numTimes = sizeof(testTimes)/sizeof(UDate);
+ int32_t numTimes = UPRV_LENGTHOF(testTimes);
UErrorCode status = U_ZERO_ERROR;
TestZIDEnumeration tzenum(!quick);
InitialTimeZoneRule *initial;
// setRawOffset
const int32_t RAW = -10*HOUR;
- VTimeZone *tmpvtz = (VTimeZone*)vtz->clone();
+ VTimeZone *tmpvtz = vtz->clone();
tmpvtz->setRawOffset(RAW);
if (tmpvtz->getRawOffset() != RAW) {
logln("setRawOffset is implemented in VTimeZone");
int32_t i, j;
// Get test times
- UDate times[sizeof(TestDates) / (3 * sizeof(int32_t))];
+ UDate times[UPRV_LENGTHOF(TestDates)];
int32_t numTimes;
UErrorCode status = U_ZERO_ERROR;