ICU-9679 fix Clang 3.1 compiler warnings, all in test code, mostly adding integers to string literals

X-SVN-Rev: 32778
This commit is contained in:
Markus Scherer 2012-11-09 00:09:28 +00:00
parent 22a342a545
commit 9f22b7cb11
14 changed files with 49 additions and 40 deletions

View file

@ -270,7 +270,6 @@ void TestProperty()
UChar *disName;
int32_t len = 0;
UChar source[12], target[12];
char sourceU8[36], targetU8[36];
int32_t tempLength;
UErrorCode status = U_ZERO_ERROR;
/*

View file

@ -89,6 +89,9 @@ static void FreeStrings( void )
strings_initialized = FALSE;
}
#if (U_PLATFORM == U_PF_LINUX) /* add platforms here .. */
/* Keep the #if above in sync with the one below that has the same "add platforms here .." comment. */
#else
/* Platform dependent test to detect if this type will return NULL when interpreted as a pointer. */
static UBool returnsNullForType(int firstParam, ...) {
UBool isNULL;
@ -98,6 +101,7 @@ static UBool returnsNullForType(int firstParam, ...) {
va_end(marker);
return isNULL;
}
#endif
/* Test u_formatMessage() with various test patterns() */
static void MessageFormatTest( void )

View file

@ -590,7 +590,7 @@ void CalendarRegressionTest::dowTest(UBool lenient)
if (dow < min || dow > max)
errln("FAIL: Day of week %d out of range [%d,%d]\n", dow, min, max);
if (dow != UCAL_SUNDAY)
errln("FAIL: Day of week should be SUNDAY Got " + dow);
errln(UnicodeString("FAIL: Day of week should be SUNDAY Got ") + dow);
if(U_FAILURE(status)) {
errln("Error checking Calendar: %s", u_errorName(status));
@ -844,7 +844,7 @@ void CalendarRegressionTest::test4095407()
}
int32_t dow = a->get(UCAL_DAY_OF_WEEK, status);
if (dow != UCAL_THURSDAY)
errln("Fail: Want THURSDAY Got " + dow);
errln(UnicodeString("Fail: Want THURSDAY Got ") + dow);
delete a;
}
@ -1722,7 +1722,7 @@ CalendarRegressionTest::Test4149677()
UnicodeString temp;
errln("test failed with zone " + zones[i]->getID(temp));
errln(" cutover date is Date(Long.MAX_VALUE)");
errln(" isLeapYear(100) returns: " + is100Leap);
errln(UnicodeString(" isLeapYear(100) returns: ") + is100Leap);
}
delete calendar;
}

View file

@ -421,11 +421,11 @@ CalendarTest::TestGenericAPI()
for (i=0; i<UCAL_FIELD_COUNT; ++i)
{
if (cal->getMinimum((UCalendarDateFields)i) > cal->getGreatestMinimum((UCalendarDateFields)i))
errln("FAIL: getMinimum larger than getGreatestMinimum for field " + i);
errln(UnicodeString("FAIL: getMinimum larger than getGreatestMinimum for field ") + i);
if (cal->getLeastMaximum((UCalendarDateFields)i) > cal->getMaximum((UCalendarDateFields)i))
errln("FAIL: getLeastMaximum larger than getMaximum for field " + i);
errln(UnicodeString("FAIL: getLeastMaximum larger than getMaximum for field ") + i);
if (cal->getMinimum((UCalendarDateFields)i) >= cal->getMaximum((UCalendarDateFields)i))
errln("FAIL: getMinimum not less than getMaximum for field " + i);
errln(UnicodeString("FAIL: getMinimum not less than getMaximum for field ") + i);
}
cal->adoptTimeZone(TimeZone::createDefault());

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 2002-2011, International Business Machines Corporation and
* Copyright (c) 2002-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************
*
@ -163,7 +163,7 @@ void CanonicalIteratorTest::TestBasic() {
//logln(++counter + ": " + hex.transliterate(result));
//logln(" = " + name.transliterate(result));
}
expectEqual(i + ": ", testStr, collectionToString(set), CharsToUnicodeString(testArray[i][1]));
expectEqual(i + UnicodeString(": "), testStr, collectionToString(set), CharsToUnicodeString(testArray[i][1]));
}
} else {

View file

@ -720,8 +720,8 @@ void DateFormatRegressionTest::Test4101483(void)
sdf->format(d, buf, fp);
//logln(sdf.format(d, buf, fp).toString());
logln(dateToString(d) + " => " + buf);
logln("beginIndex = " + fp.getBeginIndex());
logln("endIndex = " + fp.getEndIndex());
logln(UnicodeString("beginIndex = ") + fp.getBeginIndex());
logln(UnicodeString("endIndex = ") + fp.getEndIndex());
if (fp.getBeginIndex() == fp.getEndIndex())
errln("Fail: Empty field");
@ -843,7 +843,7 @@ void DateFormatRegressionTest::Test4104136(void)
logln(" index: %d", pos.getIndex());
logln((UnicodeString) " result: " + d);
if(pos.getIndex() != finish.getIndex())
errln("Fail: Expected pos " + finish.getIndex());
errln(UnicodeString("Fail: Expected pos ") + finish.getIndex());
if (! ((d == 0 && exp == -1) || (d == exp)))
errln((UnicodeString) "Fail: Expected result " + exp);
}

View file

@ -689,7 +689,7 @@ DateFormatTest::TestRunTogetherPattern985()
logln(now);
ParsePosition pos(0);
UDate date2 = formatter->parse(now, pos);
if (date2 == 0) then = "Parse stopped at " + pos.getIndex();
if (date2 == 0) then = UnicodeString("Parse stopped at ") + pos.getIndex();
else ((DateFormat*)formatter)->format(date2, then);
logln(then);
if (!(date2 == date1)) errln((UnicodeString)"FAIL");

View file

@ -183,7 +183,6 @@ void ListFormatterTest::TestOutOfOrderPatterns() {
four + " in the last after " + three + " after " + two + " after the first " + one
};
UErrorCode errorCode = U_ZERO_ERROR;
ListFormatData data("{1} after {0}", "{1} after the first {0}",
"{1} after {0}", "{1} in the last after {0}");
ListFormatter formatter(data);

View file

@ -289,13 +289,13 @@ void NumberFormatRegressionTest::Test4088161 (void)
UnicodeString sBuf1;
FieldPosition fp1(0);
logln(UnicodeString("d = ") + d);
logln("maxFractionDigits = " + df->getMaximumFractionDigits());
logln(UnicodeString("maxFractionDigits = ") + df->getMaximumFractionDigits());
logln(" format(d) = '" + df->format(d, sBuf1, fp1) + "'");
df->setMaximumFractionDigits(17);
UnicodeString sBuf2;
FieldPosition fp2(0);
logln("maxFractionDigits = " + df->getMaximumFractionDigits());
logln(UnicodeString("maxFractionDigits = ") + df->getMaximumFractionDigits());
sBuf2 = df->format(d, sBuf2, fp2);
if(sBuf2 != "100")
errln(" format(d) = '" + sBuf2 + "'");
@ -1306,7 +1306,7 @@ void NumberFormatRegressionTest::Test4101481(void)
}
failure(status, "new DecimalFormat");
if (sdf->getMinimumIntegerDigits() != 1)
errln("Minimum integer digits : " + sdf->getMinimumIntegerDigits());
errln(UnicodeString("Minimum integer digits : ") + sdf->getMinimumIntegerDigits());
delete sdf;
}
/* @bug 4052223 (API addition request A27)
@ -1618,7 +1618,7 @@ void NumberFormatRegressionTest::Test4110936(void)
nf->setMaximumIntegerDigits(MAX_INT_DIGITS);
logln("setMaximumIntegerDigits(MAX_INT_DIGITS)");
if (nf->getMaximumIntegerDigits() != MAX_INT_DIGITS)
errln("getMaximumIntegerDigits() returns " +
errln(UnicodeString("getMaximumIntegerDigits() returns ") +
nf->getMaximumIntegerDigits());
delete nf;

View file

@ -1,7 +1,7 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2010, International Business Machines Corporation and
* Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@ -229,7 +229,7 @@ void IntlTestSimpleDateFormatAPI::testAPI(/*char *par*/)
status = U_ZERO_ERROR;
pat.applyLocalizedPattern(p1, status);
if(U_FAILURE(status)) {
errln("ERROR: applyPattern() failed with " + (int32_t) status);
errln("ERROR: applyPattern() failed with %s", u_errorName(status));
}
UnicodeString s3;
status = U_ZERO_ERROR;

View file

@ -1,7 +1,7 @@
/***********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2005, International Business Machines Corporation
* Copyright (c) 1997-2012, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@ -308,7 +308,7 @@ void test_Formattable( void )
for(i = 0; i < ft_cnt; ++i) {
pf = ftarray[i].clone();
if(pf == (ftarray + i) || *pf != ftarray[i]) {
it_errln("Formattable.clone() failed for item %d" + i);
it_errln(UnicodeString("Formattable.clone() failed for item ") + i);
}
delete pf;
}

View file

@ -1048,7 +1048,7 @@ public:
int32_t cmpres2 = coll->compare(lines[i].buff, lines[i].buflen, lines[prev].buff, lines[prev].buflen);
if(cmpres != -cmpres2) {
error("Compare result not symmetrical on line " + (i + 1));
error(UnicodeString("Compare result not symmetrical on line ") + (i + 1));
break;
}

View file

@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2011, International Business Machines Corporation
* Copyright (c) 1997-2012, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@ -369,7 +369,7 @@ IntlTestNumberFormat::tryIt(int32_t aNumber)
fFormat->format(number, stringNum, status);
if (U_FAILURE(status))
{
errln("**** FAIL: Formatting " + aNumber);
errln(UnicodeString("**** FAIL: Formatting ") + aNumber);
return;
}
fFormat->parse(stringNum, number, status);

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2011, International Business Machines Corporation and
* Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@ -113,9 +113,9 @@ UnicodeStringTest::TestBasicManipulation()
errln("operator+=() failed: expected \"" + expectedValue + "\"\n,got \"" + test2 + "\"");
if (test1.length() != 70)
errln("length() failed: expected 70, got " + test1.length());
errln(UnicodeString("length() failed: expected 70, got ") + test1.length());
if (test2.length() != 30)
errln("length() failed: expected 30, got " + test2.length());
errln(UnicodeString("length() failed: expected 30, got ") + test2.length());
UnicodeString test3;
test3.append((UChar32)0x20402);
@ -123,7 +123,7 @@ UnicodeStringTest::TestBasicManipulation()
errln((UnicodeString)"append failed for UChar32, expected \"\\\\ud841\\\\udc02\", got " + prettify(test3));
}
if(test3.length() != 2){
errln("append or length failed for UChar32, expected 2, got " + test3.length());
errln(UnicodeString("append or length failed for UChar32, expected 2, got ") + test3.length());
}
test3.append((UChar32)0x0074);
if(test3 != CharsToUnicodeString("\\uD841\\uDC02t")){
@ -721,14 +721,15 @@ UnicodeStringTest::TestSearching()
(startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
;
if (occurrences != 6)
errln("indexOf failed: expected to find 6 occurrences, found " + occurrences);
errln(UnicodeString("indexOf failed: expected to find 6 occurrences, found ") + occurrences);
for ( occurrences = 0, startPos = 10;
startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
;
if (occurrences != 4)
errln("indexOf with starting offset failed: expected to find 4 occurrences, found " + occurrences);
errln(UnicodeString("indexOf with starting offset failed: "
"expected to find 4 occurrences, found ") + occurrences);
int32_t endPos = 28;
for ( occurrences = 0, startPos = 5;
@ -736,7 +737,8 @@ UnicodeStringTest::TestSearching()
(startPos = test1.indexOf(test2, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
;
if (occurrences != 4)
errln("indexOf with starting and ending offsets failed: expected to find 4 occurrences, found " + occurrences);
errln(UnicodeString("indexOf with starting and ending offsets failed: "
"expected to find 4 occurrences, found ") + occurrences);
//using UChar32 string
for ( startPos=0, occurrences=0;
@ -751,7 +753,7 @@ UnicodeStringTest::TestSearching()
(startPos = test3.indexOf(test4, startPos)) != -1 ? (++occurrences, startPos += 2) : 0)
;
if (occurrences != 2)
errln("indexOf failed: expected to find 2 occurrences, found " + occurrences);
errln(UnicodeString("indexOf failed: expected to find 2 occurrences, found ") + occurrences);
//---
for ( occurrences = 0, startPos = 0;
@ -759,21 +761,24 @@ UnicodeStringTest::TestSearching()
(startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
;
if (occurrences != 16)
errln("indexOf with character failed: expected to find 16 occurrences, found " + occurrences);
errln(UnicodeString("indexOf with character failed: "
"expected to find 16 occurrences, found ") + occurrences);
for ( occurrences = 0, startPos = 10;
startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
;
if (occurrences != 12)
errln("indexOf with character & start offset failed: expected to find 12 occurrences, found " + occurrences);
errln(UnicodeString("indexOf with character & start offset failed: "
"expected to find 12 occurrences, found ") + occurrences);
for ( occurrences = 0, startPos = 5, endPos = 28;
startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(testChar, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
;
if (occurrences != 10)
errln("indexOf with character & start & end offsets failed: expected to find 10 occurrences, found " + occurrences);
errln(UnicodeString("indexOf with character & start & end offsets failed: "
"expected to find 10 occurrences, found ") + occurrences);
//testing for UChar32
UnicodeString subString;
@ -816,14 +821,16 @@ UnicodeStringTest::TestSearching()
(startPos = test1.lastIndexOf(test2, 5, startPos - 5)) != -1 ? ++occurrences : 0)
;
if (occurrences != 4)
errln("lastIndexOf with starting and ending offsets failed: expected to find 4 occurrences, found " + occurrences);
errln(UnicodeString("lastIndexOf with starting and ending offsets failed: "
"expected to find 4 occurrences, found ") + occurrences);
for ( occurrences = 0, startPos = 32;
startPos != -1;
(startPos = test1.lastIndexOf(testChar, 5, startPos - 5)) != -1 ? ++occurrences : 0)
;
if (occurrences != 11)
errln("lastIndexOf with character & start & end offsets failed: expected to find 11 occurrences, found " + occurrences);
errln(UnicodeString("lastIndexOf with character & start & end offsets failed: "
"expected to find 11 occurrences, found ") + occurrences);
//testing UChar32
startPos=test3.length();