mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-21579 Fix compiler warnings with MSVC.
This commit is contained in:
parent
f811ae946f
commit
b10a467212
9 changed files with 116 additions and 68 deletions
|
@ -164,7 +164,7 @@ MaybeStackVector<Measure> ComplexUnitsConverter::convert(double quantity,
|
|||
if (i < n - 1) {
|
||||
// If quantity is at the limits of double's precision from an
|
||||
// integer value, we take that integer value.
|
||||
int64_t flooredQuantity = floor(quantity * (1 + DBL_EPSILON));
|
||||
int64_t flooredQuantity = static_cast<int64_t>(floor(quantity * (1 + DBL_EPSILON)));
|
||||
if (uprv_isNaN(quantity)) {
|
||||
// With clang on Linux: floor does not support NaN, resulting in
|
||||
// a giant negative number. For now, we produce "0 feet, NaN
|
||||
|
@ -244,20 +244,20 @@ void ComplexUnitsConverter::applyRounder(MaybeStackArray<int64_t, 5> &intValues,
|
|||
}
|
||||
|
||||
// Check if there's a carry, and bubble it back up the resulting intValues.
|
||||
int64_t carry = floor(unitsConverters_[lastIndex]->convertInverse(quantity) * (1 + DBL_EPSILON));
|
||||
int64_t carry = static_cast<int64_t>(floor(unitsConverters_[lastIndex]->convertInverse(quantity) * (1 + DBL_EPSILON)));
|
||||
if (carry <= 0) {
|
||||
return;
|
||||
}
|
||||
quantity -= unitsConverters_[lastIndex]->convert(carry);
|
||||
quantity -= unitsConverters_[lastIndex]->convert(static_cast<double>(carry));
|
||||
intValues[lastIndex - 1] += carry;
|
||||
|
||||
// We don't use the first converter: that one is for the input unit
|
||||
for (int32_t j = lastIndex - 1; j > 0; j--) {
|
||||
carry = floor(unitsConverters_[j]->convertInverse(intValues[j]) * (1 + DBL_EPSILON));
|
||||
carry = static_cast<int64_t>(floor(unitsConverters_[j]->convertInverse(static_cast<double>(intValues[j])) * (1 + DBL_EPSILON)));
|
||||
if (carry <= 0) {
|
||||
return;
|
||||
}
|
||||
intValues[j] -= round(unitsConverters_[j]->convert(carry));
|
||||
intValues[j] -= static_cast<int64_t>(round(unitsConverters_[j]->convert(static_cast<double>(carry))));
|
||||
intValues[j - 1] += carry;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2007,9 +2007,9 @@ static void TestNarrowQuarters(void) {
|
|||
|
||||
if (assertSuccess("Parsing date failed", &err)) {
|
||||
if (patternIsStandaloneQuarter) {
|
||||
assertIntEquals("Wrong parsing result", expectedStandaloneParsedDate, parsedDate);
|
||||
assertDoubleEquals("Wrong parsing result", expectedStandaloneParsedDate, parsedDate);
|
||||
} else {
|
||||
assertIntEquals("Wrong parsing result", expectedFormatParsedDate, parsedDate);
|
||||
assertDoubleEquals("Wrong parsing result", expectedFormatParsedDate, parsedDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -794,4 +794,17 @@ U_CFUNC UBool assertPtrEquals(const char* message, const void* expected, const v
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
U_CFUNC UBool assertDoubleEquals(const char *message, double expected, double actual) {
|
||||
if (expected != actual) {
|
||||
log_err("FAIL: %s; got \"%f\"; expected \"%f\"\n", message, actual, expected);
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef VERBOSE_ASSERTIONS
|
||||
else {
|
||||
log_verbose("Ok: %s; got \"%f\"\n", message, actual);
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -151,7 +151,7 @@ U_CFUNC UBool assertUEquals(const char* msg, const UChar* expectedString,
|
|||
const UChar* actualString);
|
||||
|
||||
/**
|
||||
* Assert that two 64-bit integers are equal, returning TRUE if they do.
|
||||
* Assert that two 64-bit integers are equal, returning TRUE if they are.
|
||||
*/
|
||||
U_CFUNC UBool assertIntEquals(const char* msg, int64_t expected, int64_t actual);
|
||||
|
||||
|
@ -161,6 +161,11 @@ U_CFUNC UBool assertIntEquals(const char* msg, int64_t expected, int64_t actual)
|
|||
*/
|
||||
U_CFUNC UBool assertPtrEquals(const char* msg, const void* expected, const void* actual);
|
||||
|
||||
/**
|
||||
* Assert that two doubles are equal, returning TRUE if they are.
|
||||
*/
|
||||
U_CFUNC UBool assertDoubleEquals(const char *msg, double expected, double actual);
|
||||
|
||||
/*
|
||||
* note - isICUVersionBefore and isICUVersionAtLeast have been removed.
|
||||
* use log_knownIssue() instead.
|
||||
|
|
|
@ -1606,7 +1606,7 @@ main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
const char* IntlTest::loadTestData(UErrorCode& err){
|
||||
if( _testDataPath == NULL){
|
||||
if ( _testDataPath == NULL){
|
||||
const char* directory=NULL;
|
||||
UResourceBundle* test =NULL;
|
||||
char* tdpath=NULL;
|
||||
|
@ -1622,6 +1622,11 @@ const char* IntlTest::loadTestData(UErrorCode& err){
|
|||
|
||||
tdpath = (char*) malloc(sizeof(char) *(( strlen(directory) * strlen(tdrelativepath)) + 100));
|
||||
|
||||
if (tdpath == NULL) {
|
||||
err = U_MEMORY_ALLOCATION_ERROR;
|
||||
it_dataerrln((UnicodeString) "Could not allocate memory for _testDataPath " + u_errorName(err));
|
||||
return "";
|
||||
}
|
||||
|
||||
/* u_getDataDirectory shoul return \source\data ... set the
|
||||
* directory to ..\source\data\..\test\testdata\out\testdata
|
||||
|
@ -1632,7 +1637,7 @@ const char* IntlTest::loadTestData(UErrorCode& err){
|
|||
|
||||
test=ures_open(tdpath, "testtypes", &err);
|
||||
|
||||
if(U_FAILURE(err)){
|
||||
if (U_FAILURE(err)) {
|
||||
err = U_FILE_ACCESS_ERROR;
|
||||
it_dataerrln((UnicodeString)"Could not load testtypes.res in testdata bundle with path " + tdpath + (UnicodeString)" - " + u_errorName(err));
|
||||
return "";
|
||||
|
|
|
@ -238,7 +238,7 @@ void PluralRulesTest::testAPI(/*char *par*/)
|
|||
return;
|
||||
}
|
||||
double fData[] = {-101, -100, -1, -0.0, 0, 0.1, 1, 1.999, 2.0, 100, 100.001 };
|
||||
UBool isKeywordA[] = {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE };
|
||||
bool isKeywordA[] = {true, false, false, false, false, true, false, true, false, false, true };
|
||||
for (int32_t i=0; i<UPRV_LENGTHOF(fData); i++) {
|
||||
if ((newRules->select(fData[i])== KEYWORD_A) != isKeywordA[i]) {
|
||||
errln("File %s, Line %d, ERROR: plural rules for decimal fractions test failed!\n"
|
||||
|
|
|
@ -70,7 +70,7 @@ void RBBIAPITest::TestCloneEquals()
|
|||
logln((UnicodeString)"Testing equals()");
|
||||
|
||||
logln((UnicodeString)"Testing == and !=");
|
||||
UBool b = (*bi1 != *biequal);
|
||||
bool b = (*bi1 != *biequal);
|
||||
b |= *bi1 == *bi2;
|
||||
b |= *bi1 == *bi3;
|
||||
if (b) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <string.h>
|
||||
#include <limits>
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
|
@ -861,11 +862,11 @@ void StringTest::TestCharStrAppendNumber() {
|
|||
assertEquals("TestAppendNumber 12345 and then 123", "12345123", testString.data());
|
||||
|
||||
testString.clear();
|
||||
testString.appendNumber(2147483647, errorCode);
|
||||
testString.appendNumber(std::numeric_limits<int32_t>::max(), errorCode);
|
||||
assertEquals("TestAppendNumber when appending the biggest int32", "2147483647", testString.data());
|
||||
|
||||
testString.clear();
|
||||
testString.appendNumber(-2147483648, errorCode);
|
||||
testString.appendNumber(std::numeric_limits<int32_t>::min(), errorCode);
|
||||
assertEquals("TestAppendNumber when appending the smallest int32", "-2147483648", testString.data());
|
||||
|
||||
testString.clear();
|
||||
|
|
|
@ -129,15 +129,21 @@ void TimeZoneRegressionTest:: Test4073215()
|
|||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UnicodeString str, str2;
|
||||
SimpleTimeZone *z = new SimpleTimeZone(0, "GMT");
|
||||
if (z->useDaylightTime())
|
||||
LocalPointer<SimpleTimeZone> z(new SimpleTimeZone(0, "GMT"), status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Fail: Failed to create SimpleTimeZone %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
if (z->useDaylightTime()) {
|
||||
errln("Fail: Fix test to start with non-DST zone");
|
||||
}
|
||||
z->setStartRule(UCAL_FEBRUARY, 1, UCAL_SUNDAY, 0, status);
|
||||
failure(status, "z->setStartRule()");
|
||||
z->setEndRule(UCAL_MARCH, -1, UCAL_SUNDAY, 0, status);
|
||||
failure(status, "z->setStartRule()");
|
||||
if (!z->useDaylightTime())
|
||||
if (!z->useDaylightTime()) {
|
||||
errln("Fail: DST not active");
|
||||
}
|
||||
|
||||
GregorianCalendar cal(1997, UCAL_JANUARY, 31, status);
|
||||
if(U_FAILURE(status)) {
|
||||
|
@ -145,7 +151,7 @@ void TimeZoneRegressionTest:: Test4073215()
|
|||
return;
|
||||
}
|
||||
failure(status, "new GregorianCalendar");
|
||||
cal.adoptTimeZone(z);
|
||||
cal.adoptTimeZone(z.orphan());
|
||||
|
||||
SimpleDateFormat sdf((UnicodeString)"E d MMM yyyy G HH:mm", status);
|
||||
if(U_FAILURE(status)) {
|
||||
|
@ -156,14 +162,14 @@ void TimeZoneRegressionTest:: Test4073215()
|
|||
failure(status, "new SimpleDateFormat");
|
||||
|
||||
UDate jan31, mar1, mar31;
|
||||
|
||||
UBool indt = z->inDaylightTime(jan31=cal.getTime(status), status);
|
||||
|
||||
UBool indt = cal.getTimeZone().inDaylightTime(jan31 = cal.getTime(status), status);
|
||||
failure(status, "inDaylightTime or getTime call on Jan 31");
|
||||
if (indt) {
|
||||
errln("Fail: Jan 31 inDaylightTime=TRUE, exp FALSE");
|
||||
}
|
||||
cal.set(1997, UCAL_MARCH, 1);
|
||||
indt = z->inDaylightTime(mar1=cal.getTime(status), status);
|
||||
indt = cal.getTimeZone().inDaylightTime(mar1 = cal.getTime(status), status);
|
||||
failure(status, "inDaylightTime or getTime call on Mar 1");
|
||||
if (!indt) {
|
||||
UnicodeString str;
|
||||
|
@ -172,7 +178,7 @@ void TimeZoneRegressionTest:: Test4073215()
|
|||
errln((UnicodeString)"Fail: " + str + " inDaylightTime=FALSE, exp TRUE");
|
||||
}
|
||||
cal.set(1997, UCAL_MARCH, 31);
|
||||
indt = z->inDaylightTime(mar31=cal.getTime(status), status);
|
||||
indt = cal.getTimeZone().inDaylightTime(mar31 = cal.getTime(status), status);
|
||||
failure(status, "inDaylightTime or getTime call on Mar 31");
|
||||
if (indt) {
|
||||
errln("Fail: Mar 31 inDaylightTime=TRUE, exp FALSE");
|
||||
|
@ -397,7 +403,12 @@ TimeZoneRegressionTest::checkCalendar314(GregorianCalendar *testCal, TimeZone *t
|
|||
UDate testDate = testCal->getTime(status);
|
||||
|
||||
UBool inDaylightTime = testTZ->inDaylightTime(testDate, status);
|
||||
SimpleDateFormat *sdf = new SimpleDateFormat((UnicodeString)"MM/dd/yyyy HH:mm", status);
|
||||
LocalPointer<SimpleDateFormat> sdf(new SimpleDateFormat((UnicodeString) "MM/dd/yyyy HH:mm", status),
|
||||
status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Error creating SimpleDateFormat %s", u_errorName(status));
|
||||
return false;
|
||||
}
|
||||
sdf->setCalendar(*testCal);
|
||||
UnicodeString inDaylightTimeString;
|
||||
|
||||
|
@ -432,7 +443,6 @@ TimeZoneRegressionTest::checkCalendar314(GregorianCalendar *testCal, TimeZone *t
|
|||
else
|
||||
errln(output);
|
||||
|
||||
delete sdf;
|
||||
return passed;
|
||||
}
|
||||
|
||||
|
@ -553,16 +563,18 @@ void TimeZoneRegressionTest:: Test4151429() {
|
|||
void TimeZoneRegressionTest:: Test4154537() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
// tz1 and tz2 have no DST and different rule parameters
|
||||
SimpleTimeZone *tz1 = new SimpleTimeZone(0, "1", 0, 0, 0, 0, 2, 0, 0, 0, status);
|
||||
SimpleTimeZone *tz2 = new SimpleTimeZone(0, "2", 1, 0, 0, 0, 3, 0, 0, 0, status);
|
||||
LocalPointer<SimpleTimeZone> tz1(new SimpleTimeZone(0, "1", 0, 0, 0, 0, 2, 0, 0, 0, status), status);
|
||||
LocalPointer<SimpleTimeZone> tz2(new SimpleTimeZone(0, "2", 1, 0, 0, 0, 3, 0, 0, 0, status), status);
|
||||
// tza and tzA have the same rule params
|
||||
SimpleTimeZone *tza = new SimpleTimeZone(0, "a", 0, 1, 0, 0, 3, 2, 0, 0, status);
|
||||
SimpleTimeZone *tzA = new SimpleTimeZone(0, "A", 0, 1, 0, 0, 3, 2, 0, 0, status);
|
||||
LocalPointer<SimpleTimeZone> tza(new SimpleTimeZone(0, "a", 0, 1, 0, 0, 3, 2, 0, 0, status), status);
|
||||
LocalPointer<SimpleTimeZone> tzA(new SimpleTimeZone(0, "A", 0, 1, 0, 0, 3, 2, 0, 0, status), status);
|
||||
// tzb differs from tza
|
||||
SimpleTimeZone *tzb = new SimpleTimeZone(0, "b", 0, 1, 0, 0, 3, 1, 0, 0, status);
|
||||
LocalPointer<SimpleTimeZone> tzb(new SimpleTimeZone(0, "b", 0, 1, 0, 0, 3, 1, 0, 0, status), status);
|
||||
|
||||
if(U_FAILURE(status))
|
||||
errln("Couldn't create TimeZones");
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Couldn't create TimeZones %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
if (tz1->useDaylightTime() || tz2->useDaylightTime() ||
|
||||
!tza->useDaylightTime() || !tzA->useDaylightTime() ||
|
||||
|
@ -577,12 +589,6 @@ void TimeZoneRegressionTest:: Test4154537() {
|
|||
//errln("zone 1 = " + tz1);
|
||||
//errln("zone 2 = " + tz2);
|
||||
}
|
||||
|
||||
delete tz1;
|
||||
delete tz2;
|
||||
delete tza;
|
||||
delete tzA;
|
||||
delete tzb;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -620,7 +626,13 @@ void TimeZoneRegressionTest:: Test4154542()
|
|||
BAD, UCAL_DECEMBER, -32, -UCAL_SATURDAY, 0,
|
||||
BAD, UCAL_DECEMBER, 31, -UCAL_SATURDAY-1, 0,
|
||||
};
|
||||
SimpleTimeZone *zone = new SimpleTimeZone(0, "Z");
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
LocalPointer<SimpleTimeZone> zone(new SimpleTimeZone(0, "Z"), status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Fail: failed to create SimpleTimeZone %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
for (int32_t i=0; i < 18*5; i+=5) {
|
||||
UBool shouldBeGood = (DATA[i] == GOOD);
|
||||
int32_t month = DATA[i+1];
|
||||
|
@ -628,7 +640,7 @@ void TimeZoneRegressionTest:: Test4154542()
|
|||
int32_t dayOfWeek = DATA[i+3];
|
||||
int32_t time = DATA[i+4];
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
status = U_ZERO_ERROR;
|
||||
|
||||
//Exception ex = null;
|
||||
//try {
|
||||
|
@ -665,6 +677,10 @@ void TimeZoneRegressionTest:: Test4154542()
|
|||
(int8_t)month, (int8_t)day, (int8_t)dayOfWeek, time,
|
||||
(int8_t)GOOD_MONTH, (int8_t)GOOD_DAY, (int8_t)GOOD_DAY_OF_WEEK,
|
||||
GOOD_TIME,status);
|
||||
if (temp == nullptr) {
|
||||
errln("Fail: failed to create SimpleTimeZone %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
//} catch (IllegalArgumentException e) {
|
||||
// ex = e;
|
||||
//}
|
||||
|
@ -683,6 +699,10 @@ void TimeZoneRegressionTest:: Test4154542()
|
|||
(int8_t)GOOD_MONTH, (int8_t)GOOD_DAY, (int8_t)GOOD_DAY_OF_WEEK,
|
||||
GOOD_TIME,
|
||||
(int8_t)month, (int8_t)day, (int8_t)dayOfWeek, time,status);
|
||||
if (temp == nullptr) {
|
||||
errln("Fail: failed to create SimpleTimeZone %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
//} catch (IllegalArgumentException e) {
|
||||
// ex = e;
|
||||
//}
|
||||
|
@ -694,7 +714,6 @@ void TimeZoneRegressionTest:: Test4154542()
|
|||
}
|
||||
delete temp;
|
||||
}
|
||||
delete zone;
|
||||
}
|
||||
|
||||
|
||||
|
@ -723,19 +742,21 @@ TimeZoneRegressionTest::Test4154525()
|
|||
UBool valid = DATA[i+1] == GOOD;
|
||||
UnicodeString method;
|
||||
for(int32_t j=0; j < 2; ++j) {
|
||||
SimpleTimeZone *z=NULL;
|
||||
LocalPointer<SimpleTimeZone> z;
|
||||
switch (j) {
|
||||
case 0:
|
||||
method = "constructor";
|
||||
z = new SimpleTimeZone(0, "id",
|
||||
z.adoptInsteadAndCheckErrorCode(new SimpleTimeZone(0, "id",
|
||||
UCAL_JANUARY, 1, 0, 0,
|
||||
UCAL_MARCH, 1, 0, 0,
|
||||
savings, status); // <- what we're interested in
|
||||
savings, status), status); // <- what we're interested in
|
||||
break;
|
||||
case 1:
|
||||
method = "setDSTSavings()";
|
||||
z = new SimpleTimeZone(0, "GMT");
|
||||
z->setDSTSavings(savings, status);
|
||||
z.adoptInsteadAndCheckErrorCode(new SimpleTimeZone(0, "GMT"), status);
|
||||
if (z.isValid()) {
|
||||
z->setDSTSavings(savings, status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -756,7 +777,6 @@ TimeZoneRegressionTest::Test4154525()
|
|||
}
|
||||
}
|
||||
status = U_ZERO_ERROR;
|
||||
delete z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -842,17 +862,21 @@ void
|
|||
TimeZoneRegressionTest::Test4162593()
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
SimpleDateFormat *fmt = new SimpleDateFormat("z", Locale::getUS(), status);
|
||||
if(U_FAILURE(status)) {
|
||||
dataerrln("Error creating calendar %s", u_errorName(status));
|
||||
delete fmt;
|
||||
LocalPointer<SimpleDateFormat> fmt(new SimpleDateFormat("z", Locale::getUS(), status), status);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating SimpleDateFormat %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
const int32_t ONE_HOUR = 60*60*1000;
|
||||
|
||||
SimpleTimeZone *asuncion = new SimpleTimeZone(-4*ONE_HOUR, "America/Asuncion" /*PY%sT*/,
|
||||
LocalPointer<SimpleTimeZone> asuncion(new SimpleTimeZone(-4*ONE_HOUR, "America/Asuncion" /*PY%sT*/,
|
||||
UCAL_OCTOBER, 1, 0 /*DOM*/, 0*ONE_HOUR,
|
||||
UCAL_MARCH, 1, 0 /*DOM*/, 0*ONE_HOUR, 1*ONE_HOUR, status);
|
||||
UCAL_MARCH, 1, 0 /*DOM*/, 0*ONE_HOUR, 1*ONE_HOUR, status), status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating SimpleTimeZone %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Zone
|
||||
* Starting time
|
||||
|
@ -868,10 +892,10 @@ TimeZoneRegressionTest::Test4162593()
|
|||
{2000, UCAL_FEBRUARY, 29, 22, 0},
|
||||
};
|
||||
|
||||
UBool DATA_BOOL [] = {
|
||||
TRUE,
|
||||
FALSE,
|
||||
TRUE,
|
||||
bool DATA_BOOL [] = {
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
};
|
||||
|
||||
UnicodeString zone [4];// = new String[4];
|
||||
|
@ -879,7 +903,12 @@ TimeZoneRegressionTest::Test4162593()
|
|||
new SimpleTimeZone(2*ONE_HOUR, "Asia/Damascus" /*EE%sT*/,
|
||||
UCAL_APRIL, 1, 0 /*DOM*/, 0*ONE_HOUR,
|
||||
UCAL_OCTOBER, 1, 0 /*DOM*/, 0*ONE_HOUR, 1*ONE_HOUR, status);
|
||||
DATA_TZ[1] = asuncion; DATA_TZ[2] = asuncion;
|
||||
DATA_TZ[1] = asuncion.getAlias(); DATA_TZ[2] = asuncion.getAlias();
|
||||
|
||||
if (DATA_TZ[0] == nullptr || U_FAILURE(status)) {
|
||||
errln("Error creating DATA_TZ[0] %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
for(int32_t j = 0; j < 3; j++) {
|
||||
TimeZone *tz = (TimeZone*)DATA_TZ[j];
|
||||
|
@ -889,7 +918,7 @@ TimeZoneRegressionTest::Test4162593()
|
|||
// Must construct the Date object AFTER setting the default zone
|
||||
int32_t *p = (int32_t*)DATA_INT[j];
|
||||
UDate d = CalendarRegressionTest::makeDate(p[0], p[1], p[2], p[3], p[4]);
|
||||
UBool transitionExpected = DATA_BOOL[j];
|
||||
bool transitionExpected = DATA_BOOL[j];
|
||||
|
||||
UnicodeString temp;
|
||||
logln(tz->getID(temp) + ":");
|
||||
|
@ -909,8 +938,6 @@ TimeZoneRegressionTest::Test4162593()
|
|||
errln("Fail: boundary transition incorrect");
|
||||
}
|
||||
}
|
||||
delete fmt;
|
||||
delete asuncion;
|
||||
delete DATA_TZ[0];
|
||||
}
|
||||
|
||||
|
@ -1074,27 +1101,27 @@ TimeZoneRegressionTest::TestJDK12API()
|
|||
// TimeZone *cst1 = TimeZone::createTimeZone("CST");
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
//d,-28800,3,1,-1,120,w,9,-1,1,120,w,60
|
||||
TimeZone *pst = new SimpleTimeZone(-28800*U_MILLIS_PER_SECOND,
|
||||
LocalPointer<TimeZone> pst(new SimpleTimeZone(-28800*U_MILLIS_PER_SECOND,
|
||||
"PST",
|
||||
3,1,-1,120*U_MILLIS_PER_MINUTE,
|
||||
SimpleTimeZone::WALL_TIME,
|
||||
9,-1,1,120*U_MILLIS_PER_MINUTE,
|
||||
SimpleTimeZone::WALL_TIME,
|
||||
60*U_MILLIS_PER_MINUTE,ec);
|
||||
60*U_MILLIS_PER_MINUTE,ec), ec);
|
||||
//d,-21600,3,1,-1,120,w,9,-1,1,120,w,60
|
||||
TimeZone *cst1 = new SimpleTimeZone(-21600*U_MILLIS_PER_SECOND,
|
||||
LocalPointer<TimeZone> cst1(new SimpleTimeZone(-21600*U_MILLIS_PER_SECOND,
|
||||
"CST",
|
||||
3,1,-1,120*U_MILLIS_PER_MINUTE,
|
||||
SimpleTimeZone::WALL_TIME,
|
||||
9,-1,1,120*U_MILLIS_PER_MINUTE,
|
||||
SimpleTimeZone::WALL_TIME,
|
||||
60*U_MILLIS_PER_MINUTE,ec);
|
||||
60*U_MILLIS_PER_MINUTE,ec), ec);
|
||||
if (U_FAILURE(ec)) {
|
||||
errln("FAIL: SimpleTimeZone constructor");
|
||||
return;
|
||||
}
|
||||
|
||||
SimpleTimeZone *cst = dynamic_cast<SimpleTimeZone *>(cst1);
|
||||
SimpleTimeZone *cst = dynamic_cast<SimpleTimeZone *>(cst1.getAlias());
|
||||
|
||||
if(pst->hasSameRules(*cst)) {
|
||||
errln("FAILURE: PST and CST have same rules");
|
||||
|
@ -1127,9 +1154,6 @@ TimeZoneRegressionTest::TestJDK12API()
|
|||
if(savings != 60*60*1000) {
|
||||
errln("setDSTSavings() failed");
|
||||
}
|
||||
|
||||
delete pst;
|
||||
delete cst;
|
||||
}
|
||||
/**
|
||||
* SimpleTimeZone allows invalid DOM values.
|
||||
|
|
Loading…
Add table
Reference in a new issue