diff --git a/icu4c/source/test/intltest/icusvtst.cpp b/icu4c/source/test/intltest/icusvtst.cpp index 0727d658a39..b570ef259f8 100644 --- a/icu4c/source/test/intltest/icusvtst.cpp +++ b/icu4c/source/test/intltest/icusvtst.cpp @@ -12,8 +12,8 @@ #if !UCONFIG_NO_SERVICE #include "icusvtst.h" - #include "iculserv.h" +#include class MyListener : public EventListener { diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index 686b7252f97..6cdcb81ecba 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -499,47 +499,6 @@ void it_errln( UnicodeString message ) IntlTest::gTest->errln( message ); } -IntlTest& operator<<(IntlTest& test, const UnicodeString& string) -{ -/* NULL shouldn't happen */ -// if (&test == NULL) -// return *((IntlTest*) NULL); - test.log( string ); - return test; -} - -IntlTest& operator<<(IntlTest& test, const char* string) -{ -/* NULL shouldn't happen */ -// if (&test == NULL) -// return *((IntlTest*) NULL); - test.log( string ); - return test; -} - -IntlTest& operator<<(IntlTest& test, const int32_t num) -{ -/* NULL shouldn't happen */ -// if (&test == NULL) -// return *((IntlTest*) NULL); - char convert[20]; - sprintf(convert, "%li", (long)num); - test.log(convert); - return test; -} - -IntlTest& endl( IntlTest& test ) -{ - test.logln(); - return test; -} - -IntlTest& operator<<(IntlTest& test, IntlTest& ( * _f)(IntlTest&)) -{ - (*_f)(test); - return test; -} - IntlTest::IntlTest() { @@ -894,7 +853,7 @@ void IntlTest::LL_message( UnicodeString message, UBool newline ) // stream out the indentation string first if necessary length = indent.extract(1, indent.length(), buffer, sizeof(buffer)); if (length > 0) { - fwrite(buffer, sizeof(*buffer), length, testoutfp); + fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp); } // replace each LineFeed by the indentation string @@ -903,17 +862,17 @@ void IntlTest::LL_message( UnicodeString message, UBool newline ) // stream out the message length = message.extract(0, message.length(), buffer, sizeof(buffer)); if (length > 0) { - fwrite(buffer, sizeof(*buffer), length, testoutfp); + fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp); } if (newline) { char newLine = '\n'; - fwrite(&newLine, sizeof(newLine), 1, testoutfp); + fwrite(&newLine, sizeof(newLine), 1, (FILE *)testoutfp); } // A newline usually flushes the buffer, but // flush the message just in case of a core dump. - fflush(testoutfp); + fflush((FILE *)testoutfp); } /** diff --git a/icu4c/source/test/intltest/intltest.h b/icu4c/source/test/intltest/intltest.h index 78546cb04c0..369a26d78bc 100644 --- a/icu4c/source/test/intltest/intltest.h +++ b/icu4c/source/test/intltest/intltest.h @@ -11,10 +11,7 @@ #ifndef _INTLTEST #define _INTLTEST -#include - -#include "unicode/utypes.h" -#include "unicode/unistr.h" +// The following includes utypes.h, uobject.h and unistr.h #include "unicode/fmtable.h" U_NAMESPACE_USE @@ -25,8 +22,6 @@ U_NAMESPACE_USE #pragma map(IntlTest::log( const UnicodeString &message ),"logos390") #endif -#define it_out (*IntlTest::gTest) - //----------------------------------------------------------------------------- //convenience classes to ease porting code that uses the Java //string-concatenation operator (moved from findword test by rtg) @@ -117,8 +112,6 @@ public: virtual void usage( void ) ; - FILE *testoutfp; - /** * Returns a uniform random value x, with 0.0 <= x < 1.0. Use * with care: Does not return all possible values; returns one of @@ -158,6 +151,9 @@ private: IntlTest* caller; char* path; // specifies subtests + //FILE *testoutfp; + void *testoutfp; + protected: virtual void LL_message( UnicodeString message, UBool newline ); @@ -198,13 +194,6 @@ void it_err(void); void it_err( UnicodeString message ); void it_errln( UnicodeString message ); -IntlTest& operator<<(IntlTest& test, const UnicodeString& string); -IntlTest& operator<<(IntlTest& test, const char* string); -IntlTest& operator<<(IntlTest& test, const int32_t num); - -IntlTest& endl( IntlTest& test ); -IntlTest& operator<<(IntlTest& test, IntlTest& ( * _f)(IntlTest&)); - /** * This is a variant of cintltst/ccolltst.c:CharsToUChars(). * It converts a character string into a UnicodeString, with diff --git a/icu4c/source/test/intltest/itrbnf.cpp b/icu4c/source/test/intltest/itrbnf.cpp index ead78763b2f..ff951adf93e 100644 --- a/icu4c/source/test/intltest/itrbnf.cpp +++ b/icu4c/source/test/intltest/itrbnf.cpp @@ -43,25 +43,25 @@ void IntlTestRBNF::runIndexedTest(int32_t index, UBool exec, const char* &name, if (exec) logln("TestSuite RuleBasedNumberFormat"); switch (index) { #if U_HAVE_RBNF - TESTCASE(0, TestEnglishSpellout); - TESTCASE(1, TestOrdinalAbbreviations); - TESTCASE(2, TestDurations); - TESTCASE(3, TestSpanishSpellout); - TESTCASE(4, TestFrenchSpellout); - TESTCASE(5, TestSwissFrenchSpellout); - TESTCASE(6, TestItalianSpellout); - TESTCASE(7, TestGermanSpellout); - TESTCASE(8, TestThaiSpellout); - TESTCASE(9, TestAPI); - TESTCASE(10, TestFractionalRuleSet); - TESTCASE(11, TestSwedishSpellout); - TESTCASE(12, TestBelgianFrenchSpellout); + TESTCASE(0, TestEnglishSpellout); + TESTCASE(1, TestOrdinalAbbreviations); + TESTCASE(2, TestDurations); + TESTCASE(3, TestSpanishSpellout); + TESTCASE(4, TestFrenchSpellout); + TESTCASE(5, TestSwissFrenchSpellout); + TESTCASE(6, TestItalianSpellout); + TESTCASE(7, TestGermanSpellout); + TESTCASE(8, TestThaiSpellout); + TESTCASE(9, TestAPI); + TESTCASE(10, TestFractionalRuleSet); + TESTCASE(11, TestSwedishSpellout); + TESTCASE(12, TestBelgianFrenchSpellout); #else - TESTCASE(0, TestRBNFDisabled); + TESTCASE(0, TestRBNFDisabled); #endif default: - name = ""; - break; + name = ""; + break; } } @@ -1174,33 +1174,33 @@ IntlTestRBNF::TestFrenchSpellout() } static const char* swissFrenchTestData[][2] = { - { "1", "un" }, - { "15", "quinze" }, - { "20", "vingt" }, - { "21", "vingt-et-un" }, - { "23", "vingt-trois" }, - { "62", "soixante-deux" }, - { "70", "septante" }, - { "71", "septante-et-un" }, - { "73", "septante-trois" }, - { "80", "huitante" }, - { "88", "huitante-huit" }, - { "100", "cent" }, - { "106", "cent six" }, - { "127", "cent vingt-sept" }, - { "200", "deux cents" }, - { "579", "cinq cents septante-neuf" }, - { "1,000", "mille" }, - { "1,123", "onze cents vingt-trois" }, - { "1,594", "mille cinq cents nonante-quatre" }, - { "2,000", "deux mille" }, - { "3,004", "trois mille quatre" }, - { "4,567", "quatre mille cinq cents soixante-sept" }, - { "15,943", "quinze mille neuf cents quarante-trois" }, - { "2,345,678", "deux million trois cents quarante-cinq mille six cents septante-huit" }, - { "-36", "moins trente-six" }, - { "234.567", "deux cents trente-quatre virgule cinq six sept" }, - { NULL, NULL} + { "1", "un" }, + { "15", "quinze" }, + { "20", "vingt" }, + { "21", "vingt-et-un" }, + { "23", "vingt-trois" }, + { "62", "soixante-deux" }, + { "70", "septante" }, + { "71", "septante-et-un" }, + { "73", "septante-trois" }, + { "80", "huitante" }, + { "88", "huitante-huit" }, + { "100", "cent" }, + { "106", "cent six" }, + { "127", "cent vingt-sept" }, + { "200", "deux cents" }, + { "579", "cinq cents septante-neuf" }, + { "1,000", "mille" }, + { "1,123", "onze cents vingt-trois" }, + { "1,594", "mille cinq cents nonante-quatre" }, + { "2,000", "deux mille" }, + { "3,004", "trois mille quatre" }, + { "4,567", "quatre mille cinq cents soixante-sept" }, + { "15,943", "quinze mille neuf cents quarante-trois" }, + { "2,345,678", "deux million trois cents quarante-cinq mille six cents septante-huit" }, + { "-36", "moins trente-six" }, + { "234.567", "deux cents trente-quatre virgule cinq six sept" }, + { NULL, NULL} }; void @@ -1226,10 +1226,10 @@ IntlTestRBNF::TestBelgianFrenchSpellout() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("fr", "BE", ""), status); if (U_FAILURE(status)) { - fprintf(stderr, "rbnf status: %d (%x)\n", status, status); + errln("rbnf status: 0x%x (%s)\n", status, u_errorName(status)); errln("FAIL: could not construct formatter"); } else { - // Belgian french should match Swiss french. + // Belgian french should match Swiss french. doTest(formatter, swissFrenchTestData, TRUE); } delete formatter; @@ -1469,9 +1469,7 @@ IntlTestRBNF::doTest(RuleBasedNumberFormat* formatter, const char* testData[][2] UnicodeString msg = "FAIL: formatter could not parse "; msg.append(actualString); msg.append(" status code: " ); - char buffer[32]; - sprintf(buffer, "0x%x", status); - msg.append(buffer); + msg.append(u_errorName(status)); errln(msg); break; } else { diff --git a/icu4c/source/test/intltest/itrbnfrt.cpp b/icu4c/source/test/intltest/itrbnfrt.cpp index 6604f0f51d0..1c09d1fa058 100644 --- a/icu4c/source/test/intltest/itrbnfrt.cpp +++ b/icu4c/source/test/intltest/itrbnfrt.cpp @@ -12,7 +12,8 @@ #include "itrbnfrt.h" #include "unicode/fmtable.h" -#include "math.h" // fabs +#include // fabs +#include // current macro not in icu1.8.1 #define TESTCASE(id,test) \ diff --git a/icu4c/source/test/intltest/numrgts.cpp b/icu4c/source/test/intltest/numrgts.cpp index 0bdb259768b..ddee025913a 100644 --- a/icu4c/source/test/intltest/numrgts.cpp +++ b/icu4c/source/test/intltest/numrgts.cpp @@ -11,6 +11,7 @@ #include "numrgts.h" #include // DBL_MIN, DBL_MAX +#include #include "unicode/dcfmtsym.h" #include "unicode/decimfmt.h" diff --git a/icu4c/source/test/intltest/regextst.cpp b/icu4c/source/test/intltest/regextst.cpp index 71c253a73bc..4c794d3cdf9 100644 --- a/icu4c/source/test/intltest/regextst.cpp +++ b/icu4c/source/test/intltest/regextst.cpp @@ -10,17 +10,17 @@ // ICU Regular Expressions test, part of intltest. // -#include "unicode/utypes.h" +#include "intltest.h" #if !UCONFIG_NO_REGULAR_EXPRESSIONS #include "unicode/uchar.h" #include "unicode/ucnv.h" -#include "intltest.h" #include "regextst.h" #include "uvector.h" -#include "stdlib.h" #include "charstr.h" #include "util.h" +#include +#include //--------------------------------------------------------------------------- diff --git a/icu4c/source/test/intltest/restest.cpp b/icu4c/source/test/intltest/restest.cpp index 8afa73af83c..a5f9cec8c37 100644 --- a/icu4c/source/test/intltest/restest.cpp +++ b/icu4c/source/test/intltest/restest.cpp @@ -156,8 +156,7 @@ int32_t randi(int32_t n) */ ResourceBundleTest::ResourceBundleTest() : pass(0), - fail(0), - OUT(it_out) + fail(0) { if (param[5].locale == NULL) { param[0].locale = new Locale("root"); diff --git a/icu4c/source/test/intltest/restest.h b/icu4c/source/test/intltest/restest.h index 14a778a4ee5..876b4d283a9 100644 --- a/icu4c/source/test/intltest/restest.h +++ b/icu4c/source/test/intltest/restest.h @@ -47,8 +47,6 @@ private: int32_t pass; int32_t fail; - - IntlTest& OUT; }; #endif diff --git a/icu4c/source/test/intltest/restsnew.cpp b/icu4c/source/test/intltest/restsnew.cpp index 9a30b0c9ff4..82a09407e05 100644 --- a/icu4c/source/test/intltest/restsnew.cpp +++ b/icu4c/source/test/intltest/restsnew.cpp @@ -155,8 +155,7 @@ static int32_t randi(int32_t n) */ NewResourceBundleTest::NewResourceBundleTest() : pass(0), - fail(0), - OUT(it_out) + fail(0) { if (param[5].locale == NULL) { param[0].locale = new Locale("root"); diff --git a/icu4c/source/test/intltest/restsnew.h b/icu4c/source/test/intltest/restsnew.h index 6a8245da9fd..cfe738337fe 100644 --- a/icu4c/source/test/intltest/restsnew.h +++ b/icu4c/source/test/intltest/restsnew.h @@ -52,7 +52,6 @@ private: int32_t pass; int32_t fail; - IntlTest& OUT; }; #endif diff --git a/icu4c/source/test/intltest/srchtest.cpp b/icu4c/source/test/intltest/srchtest.cpp index cb95832119b..de333973ff9 100644 --- a/icu4c/source/test/intltest/srchtest.cpp +++ b/icu4c/source/test/intltest/srchtest.cpp @@ -14,6 +14,7 @@ #include "unicode/ustring.h" #include "unicode/schriter.h" #include +#include // private definitions ----------------------------------------------------- diff --git a/icu4c/source/test/intltest/tchcfmt.cpp b/icu4c/source/test/intltest/tchcfmt.cpp index bd378659c41..6e9954361a3 100644 --- a/icu4c/source/test/intltest/tchcfmt.cpp +++ b/icu4c/source/test/intltest/tchcfmt.cpp @@ -64,7 +64,7 @@ TestChoiceFormat::TestSimpleExample( void ) } //form->parse(res1, f, parse_pos); res2 = " ??? "; - it_out << ix << " -> " << res1 << " -> " << res2 << endl; + it_logln(UnicodeString("") + ix + UnicodeString(" -> ") + res1 + UnicodeString(" -> ") + res2); } //Testing ==operator const double filelimits[] = {0,1,2}; @@ -176,11 +176,11 @@ TestChoiceFormat::TestComplexExample( void ) UnicodeString str; UnicodeString res1, res2; pattform->toPattern( res1 ); - it_out << "MessageFormat toPattern: " << res1 << endl; + it_logln("MessageFormat toPattern: " + res1); fileform->toPattern( res1 ); - it_out << "ChoiceFormat toPattern: " << res1 << endl; + it_logln("ChoiceFormat toPattern: " + res1); if (res1 == "-1.0#are corrupted files|0.0#are no files|1.0#is one file|2.0#are {2} files") { - it_out << "toPattern tested!" << endl; + it_logln("toPattern tested!"); }else{ it_errln("*** ChoiceFormat to Pattern result!"); } @@ -219,15 +219,16 @@ TestChoiceFormat::TestComplexExample( void ) delete pattform; return; } - it_out << i << " -> " << res2 << endl; + it_logln(i + UnicodeString(" -> ") + res2); if (res2 != checkstr[i - start]) { it_errln("*** test_complex_example res string"); - it_out << "*** " << i << " -> '" << res2 << "' unlike '" << checkstr[i] << "' ! " << endl; + it_errln(UnicodeString("*** ") + i + UnicodeString(" -> '") + res2 + UnicodeString("' unlike '") + checkstr[i] + UnicodeString("' ! ")); } } - it_out << endl; + it_logln(); - it_out << "------ additional testing in complex test ------" << endl << endl; + it_logln("------ additional testing in complex test ------"); + it_logln(); // int32_t retCount; const double* retLimits = fileform->getLimits( retCount ); @@ -236,7 +237,7 @@ TestChoiceFormat::TestComplexExample( void ) && (retLimits[1] == 0.0) && (retLimits[2] == 1.0) && (retLimits[3] == 2.0)) { - it_out << "getLimits tested!" << endl; + it_logln("getLimits tested!"); }else{ it_errln("*** getLimits unexpected result!"); } @@ -247,7 +248,7 @@ TestChoiceFormat::TestComplexExample( void ) && (retFormats[1] == "are no files") && (retFormats[2] == "is one file") && (retFormats[3] == "are {2} files")) { - it_out << "getFormats tested!" << endl; + it_logln("getFormats tested!"); }else{ it_errln("*** getFormats unexpected result!"); } @@ -260,7 +261,8 @@ TestChoiceFormat::TestComplexExample( void ) }; fileform->applyPattern("0#is no folder|1#is one folder|2#are many folders", status ); - if (status == U_ZERO_ERROR) it_out << "status applyPattern OK!" << endl; + if (status == U_ZERO_ERROR) + it_logln("status applyPattern OK!"); if (!chkstatus( status, "*** test_complex_example pattform" )) { delete fileform; delete filenumform; @@ -281,10 +283,10 @@ TestChoiceFormat::TestComplexExample( void ) delete pattform; return; } - it_out << i << " -> " << res2 << endl; + it_logln(UnicodeString() + i + UnicodeString(" -> ") + res2); if (res2 != checkstr2[i]) { it_errln("*** test_complex_example res string"); - it_out << "*** " << i << " -> '" << res2 << "' unlike '" << checkstr2[i] << "' ! " << endl; + it_errln(UnicodeString("*** ") + i + UnicodeString(" -> '") + res2 + UnicodeString("' unlike '") + checkstr2[i] + UnicodeString("' ! ")); } } @@ -299,13 +301,13 @@ TestChoiceFormat::TestComplexExample( void ) it_errln("*** test-choiceFormat not allocatable!"); }else{ if (*form_A == *form_A2) { - it_out << "operator== tested." << endl; + it_logln("operator== tested."); }else{ it_errln("*** operator=="); } if (*form_A != *form_B) { - it_out << "operator!= tested." << endl; + it_logln("operator!= tested."); }else{ it_errln("*** operator!="); } @@ -315,7 +317,7 @@ TestChoiceFormat::TestComplexExample( void ) it_errln("*** ChoiceFormat->clone is nil."); }else{ if ((*form_A3 == *form_A) && (*form_A3 != *form_B)) { - it_out << "method clone tested." << endl; + it_logln("method clone tested."); }else{ it_errln("*** ChoiceFormat clone or operator==, or operator!= ."); } @@ -326,7 +328,7 @@ TestChoiceFormat::TestComplexExample( void ) form_Assigned = *form_B; ok = ok && (form_Assigned != *form_A) && (form_Assigned == *form_B); if (ok) { - it_out << "copy constructor and operator= tested." << endl; + it_logln("copy constructor and operator= tested."); }else{ it_errln("*** copy constructor or operator= or operator == or operator != ."); } @@ -347,7 +349,7 @@ TestChoiceFormat::TestComplexExample( void ) form_pat.toPattern( res1 ); if (res1 == "0.0#none|1.0#one|2.0#many") { - it_out << "ChoiceFormat contructor( newPattern, status) tested" << endl; + it_logln("ChoiceFormat contructor( newPattern, status) tested"); }else{ it_errln("*** ChoiceFormat contructor( newPattern, status) or toPattern result!"); } @@ -365,7 +367,7 @@ TestChoiceFormat::TestComplexExample( void ) form_pat.toPattern( res1 ); it_out << "ChoiceFormat adoptChoices toPattern: " << res1 << endl; if (res1 == "1.0#first|2.0#second") { - it_out << "ChoiceFormat adoptChoices tested" << endl; + it_logln("ChoiceFormat adoptChoices tested"); }else{ it_errln("*** ChoiceFormat adoptChoices result!"); } @@ -376,9 +378,9 @@ TestChoiceFormat::TestComplexExample( void ) form_pat.setChoices( d_a2, s_a2, 2 ); form_pat.toPattern( res1 ); - it_out << "ChoiceFormat adoptChoices toPattern: " << res1 << endl; + it_logln(UnicodeString("ChoiceFormat adoptChoices toPattern: ") + res1); if (res1 == "3.0#third|4.0#forth") { - it_out << "ChoiceFormat adoptChoices tested" << endl; + it_logln("ChoiceFormat adoptChoices tested"); }else{ it_errln("*** ChoiceFormat adoptChoices result!"); } @@ -388,7 +390,7 @@ TestChoiceFormat::TestComplexExample( void ) status = U_ZERO_ERROR; double arg_double = 3.0; res1 = form_pat.format( arg_double, str, fpos ); - it_out << "ChoiceFormat format:" << res1 << endl; + it_logln(UnicodeString("ChoiceFormat format:") + res1); if (res1 != "third") it_errln("*** ChoiceFormat format (double, ...) result!"); str = ""; @@ -396,7 +398,7 @@ TestChoiceFormat::TestComplexExample( void ) status = U_ZERO_ERROR; int32_t arg_long = 3; res1 = form_pat.format( arg_long, str, fpos ); - it_out << "ChoiceFormat format:" << res1 << endl; + it_logln(UnicodeString("ChoiceFormat format:") + res1); if (res1 != "third") it_errln("*** ChoiceFormat format (int32_t, ...) result!"); Formattable ft( (int32_t)3 ); @@ -410,7 +412,7 @@ TestChoiceFormat::TestComplexExample( void ) delete pattform; return; } - it_out << "ChoiceFormat format:" << res1 << endl; + it_logln(UnicodeString("ChoiceFormat format:") + res1); if (res1 != "third") it_errln("*** ChoiceFormat format (Formattable, ...) result!"); Formattable fta[] = { (int32_t)3 }; @@ -424,7 +426,7 @@ TestChoiceFormat::TestComplexExample( void ) delete pattform; return; } - it_out << "ChoiceFormat format:" << res1 << endl; + it_logln(UnicodeString("ChoiceFormat format:") + res1); if (res1 != "third") it_errln("*** ChoiceFormat format (Formattable[], cnt, ...) result!"); ParsePosition parse_pos = 0; @@ -433,7 +435,7 @@ TestChoiceFormat::TestComplexExample( void ) form_pat.parse( parsetext, result, parse_pos ); double rd = (result.getType() == Formattable::kLong) ? result.getLong() : result.getDouble(); if (rd == 3.0) { - it_out << "parse( ..., ParsePos ) tested." << endl; + it_logln("parse( ..., ParsePos ) tested."); }else{ it_errln("*** ChoiceFormat parse( ..., ParsePos )!"); } @@ -441,7 +443,7 @@ TestChoiceFormat::TestComplexExample( void ) form_pat.parse( parsetext, result, status ); rd = (result.getType() == Formattable::kLong) ? result.getLong() : result.getDouble(); if (rd == 3.0) { - it_out << "parse( ..., UErrorCode ) tested." << endl; + it_logln("parse( ..., UErrorCode ) tested."); }else{ it_errln("*** ChoiceFormat parse( ..., UErrorCode )!"); } @@ -455,7 +457,7 @@ TestChoiceFormat::TestComplexExample( void ) } */ - it_out << endl; + it_logln(); delete fileform; delete filenumform; diff --git a/icu4c/source/test/intltest/tfsmalls.cpp b/icu4c/source/test/intltest/tfsmalls.cpp index a109fd0112b..9de0192f7ec 100644 --- a/icu4c/source/test/intltest/tfsmalls.cpp +++ b/icu4c/source/test/intltest/tfsmalls.cpp @@ -31,7 +31,7 @@ void test_ParsePosition( void ) { ParsePosition* pp1 = new ParsePosition(); if (pp1 && (pp1->getIndex() == 0)) { - it_out << "PP constructor() tested." << endl; + it_logln("PP constructor() tested."); }else{ it_errln("*** PP getIndex or constructor() result"); } @@ -42,13 +42,13 @@ void test_ParsePosition( void ) int32_t to = 5; ParsePosition pp2( to ); if (pp2.getIndex() == 5) { - it_out << "PP getIndex and constructor(int32_t) tested." << endl; + it_logln("PP getIndex and constructor(int32_t) tested."); }else{ it_errln("*** PP getIndex or constructor(int32_t) result"); } pp2.setIndex( 3 ); if (pp2.getIndex() == 3) { - it_out << "PP setIndex tested." << endl; + it_logln("PP setIndex tested."); }else{ it_errln("*** PP getIndex or setIndex result"); } @@ -59,7 +59,7 @@ void test_ParsePosition( void ) pp3 = 5; ParsePosition pp4( pp3 ); if ((pp2 != pp3) && (pp3 == pp4)) { - it_out << "PP copy contructor, operator== and operator != tested." << endl; + it_logln("PP copy contructor, operator== and operator != tested."); }else{ it_errln("*** PP operator== or operator != result"); } @@ -67,7 +67,7 @@ void test_ParsePosition( void ) ParsePosition pp5; pp5 = pp4; if ((pp4 == pp5) && (!(pp4 != pp5))) { - it_out << "PP operator= tested." << endl; + it_logln("PP operator= tested."); }else{ it_errln("*** PP operator= operator== or operator != result"); } @@ -102,11 +102,11 @@ void test_FieldPosition_example( void ) int32_t tempOffset = (tempLen <= (tempLen - pos.getEndIndex())) ? tempLen : (tempLen - pos.getEndIndex()); temp[tempOffset] = '\0'; - it_out << "FP " << temp << res << endl; + it_logln(UnicodeString("FP ") + UnicodeString(temp) + res); } delete fmt; - it_out << endl; + it_logln(""); } @@ -116,7 +116,7 @@ void test_FieldPosition( void ) FieldPosition fp( 7 ); if (fp.getField() == 7) { - it_out << "FP constructor(int32_t) and getField tested." << endl; + it_logln("FP constructor(int32_t) and getField tested."); }else{ it_errln("*** FP constructor(int32_t) or getField"); } @@ -137,22 +137,22 @@ void test_FieldPosition( void ) if (fp.getEndIndex() != i+7) err3 = TRUE; } if (!err1) { - it_out << "FP setField and getField tested." << endl; + it_logln("FP setField and getField tested."); }else{ it_errln("*** FP setField or getField"); } if (!err2) { - it_out << "FP setBeginIndex and getBeginIndex tested." << endl; + it_logln("FP setBeginIndex and getBeginIndex tested."); }else{ it_errln("*** FP setBeginIndex or getBeginIndex"); } if (!err3) { - it_out << "FP setEndIndex and getEndIndex tested." << endl; + it_logln("FP setEndIndex and getEndIndex tested."); }else{ it_errln("*** FP setEndIndex or getEndIndex"); } - it_out << endl; + it_logln(""); } @@ -167,27 +167,27 @@ void test_Formattable( void ) Formattable fta, ftb; fta.setLong(1); ftb.setLong(2); if ((fta != ftb) || !(fta == ftb)) { - it_out << "FT setLong, operator== and operator!= tested." << endl; + it_logln("FT setLong, operator== and operator!= tested."); }else{ it_errln("*** Formattable setLong or operator== or !="); } fta = ftb; if ((fta == ftb) || !(fta != ftb)) { - it_out << "FT operator= tested." << endl; + it_logln("FT operator= tested."); }else{ it_errln("*** FT operator= or operator== or operator!="); } fta.setDouble( 3.0 ); if ((fta.getType() == Formattable::kDouble) && (fta.getDouble() == 3.0)) { - it_out << "FT set- and getDouble tested." << endl; + it_logln("FT set- and getDouble tested."); }else{ it_errln("*** FT set- or getDouble"); } fta.setDate( 4.0 ); if ((fta.getType() == Formattable::kDate) && (fta.getDate() == 4.0)) { - it_out << "FT set- and getDate tested." << endl; + it_logln("FT set- and getDate tested."); }else{ it_errln("*** FT set- or getDate"); } @@ -195,7 +195,7 @@ void test_Formattable( void ) fta.setString("abc"); UnicodeString res; if ((fta.getType() == Formattable::kString) && (fta.getString(res) == "abc")) { - it_out << "FT set- and getString tested." << endl; + it_logln("FT set- and getString tested."); }else{ it_errln("*** FT set- or getString"); } @@ -220,7 +220,7 @@ void test_Formattable( void ) && (ft_arr[2].getType() == Formattable::kLong) && (ft_arr[2].getLong() == (int32_t)3) && (ft_arr[3].getType() == Formattable::kString) && (ft_arr[3].getString(temp) == ucs) && (ft_arr[4].getType() == Formattable::kString) && (ft_arr[4].getString(temp) == *ucs_ptr) ) { - it_out << "FT constr. for date, double, long, ustring, ustring* and array tested" << endl; + it_logln("FT constr. for date, double, long, ustring, ustring* and array tested"); }else{ it_errln("*** FT constr. for date, double, long, ustring, ustring* or array"); } @@ -235,13 +235,12 @@ void test_Formattable( void ) } } if (same) { - it_out << "FT getArray tested" << endl; + it_logln("FT getArray tested"); }else{ it_errln("*** FT getArray comparison"); } }else{ - it_out << res_cnt << " " << ft_cnt << endl; - it_errln("*** FT getArray count"); + it_errln(UnicodeString("*** FT getArray count res_cnt=") + res_cnt + UnicodeString("ft_cnt=") + ft_cnt); } const Formattable ftarr1[] = { Formattable( (int32_t)1 ), Formattable( (int32_t)2 ) }; @@ -252,7 +251,7 @@ void test_Formattable( void ) ft_arr.setArray( ftarr1, ftarr1_cnt ); if ((ft_arr[0].getType() == Formattable::kLong) && (ft_arr[0].getLong() == (int32_t)1)) { - it_out << "FT setArray tested" << endl; + it_logln("FT setArray tested"); }else{ it_errln("*** FT setArray"); } @@ -263,7 +262,7 @@ void test_Formattable( void ) } if ((ft_dynarr[0].getType() == Formattable::kLong) && (ft_dynarr[0].getLong() == (int32_t)3) && (ft_dynarr[1].getType() == Formattable::kLong) && (ft_dynarr[1].getLong() == (int32_t)4)) { - it_out << "FT operator= and array operations tested" << endl; + it_logln("FT operator= and array operations tested"); }else{ it_errln("*** FT operator= or array operations"); } @@ -271,7 +270,7 @@ void test_Formattable( void ) ft_arr.adoptArray( ft_dynarr, ftarr2_cnt ); if ((ft_arr[0].getType() == Formattable::kLong) && (ft_arr[0].getLong() == (int32_t)3) && (ft_arr[1].getType() == Formattable::kLong) && (ft_arr[1].getLong() == (int32_t)4)) { - it_out << "FT adoptArray tested" << endl; + it_logln("FT adoptArray tested"); }else{ it_errln("*** FT adoptArray or operator[]"); } @@ -283,14 +282,13 @@ void test_Formattable( void ) fta.adoptString( ucs_dyn ); if ((fta.getType() == Formattable::kString) && (fta.getString(tmp2) == "ttt")) { - it_out << "FT adoptString tested" << endl; + it_logln("FT adoptString tested"); }else{ it_errln("*** FT adoptString or getString"); } fta.setLong(0); // calls 'dispose' and deletes adopted string ! - it_out << endl; - + it_logln(); } void TestFormatSmallClasses::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index b12ed915b3a..5cbf6a2eaab 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -17,13 +17,10 @@ #include "unicode/dtfmtsym.h" #include "unicode/normlzr.h" #include "unicode/translit.h" -#include "unicode/ucnv.h" -#include "unicode/ucnv_err.h" #include "unicode/uchar.h" #include "unicode/unifilt.h" #include "unicode/uniset.h" #include "unitohex.h" -#include "unicode/utypes.h" #include "unicode/ustring.h" #include "unicode/usetiter.h" #include "unicode/uscript.h" @@ -42,6 +39,7 @@ #include "unesctrn.h" #include "uni2name.h" #include "cstring.h" +#include /*********************************************************************** diff --git a/icu4c/source/test/intltest/uobjtest.cpp b/icu4c/source/test/intltest/uobjtest.cpp index edd450211f4..6f34592a77a 100644 --- a/icu4c/source/test/intltest/uobjtest.cpp +++ b/icu4c/source/test/intltest/uobjtest.cpp @@ -6,6 +6,7 @@ #include "uobjtest.h" #include +#include /** *