From db04e06f4e7fa733e22da895559262afd376b8eb Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Sat, 9 Jul 2005 03:15:06 +0000 Subject: [PATCH] ICU-4620 test fixes for uconfig.h X-SVN-Rev: 18183 --- icu4c/source/test/cintltst/cintltst.c | 5 +++-- icu4c/source/test/cintltst/cldrtest.c | 4 ++++ icu4c/source/test/cintltst/custrtrn.c | 15 +++++++++++++-- icu4c/source/test/iotest/filetst.c | 4 +++- icu4c/source/test/iotest/iotest.cpp | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/icu4c/source/test/cintltst/cintltst.c b/icu4c/source/test/cintltst/cintltst.c index d5d6e3e3fb0..c1c6465e6a3 100644 --- a/icu4c/source/test/cintltst/cintltst.c +++ b/icu4c/source/test/cintltst/cintltst.c @@ -32,6 +32,7 @@ #include "unicode/uclean.h" #include "unicode/ucal.h" #include "uoptions.h" +#include "putilimp.h" /* for uprv_getUTCtime() */ #ifdef XP_MAC_CONSOLE # include @@ -119,7 +120,7 @@ int main(int argc, const char* const argv[]) U_MAIN_INIT_ARGS(argc, argv); - startTime = ucal_getNow(); + startTime = uprv_getUTCtime(); argv2 = (const char**) malloc(sizeof(char*) * argc); if (argv2 == NULL) { @@ -264,7 +265,7 @@ int main(int argc, const char* const argv[]) free((void*)argv2); - endTime = ucal_getNow(); + endTime = uprv_getUTCtime(); diffTime = (int32_t)(endTime - startTime); printf("Elapsed Time: %02d:%02d:%02d.%03d\n", ((diffTime%U_MILLIS_PER_DAY)/U_MILLIS_PER_HOUR), diff --git a/icu4c/source/test/cintltst/cldrtest.c b/icu4c/source/test/cintltst/cldrtest.c index 61234a0b6dc..2cc4ef0f9b9 100644 --- a/icu4c/source/test/cintltst/cldrtest.c +++ b/icu4c/source/test/cintltst/cldrtest.c @@ -1135,6 +1135,7 @@ static void TestExemplarSet(void){ } static void TestCurrencyList(void){ +#if !UCONFIG_NO_FORMATTING UErrorCode errorCode = U_ZERO_ERROR; int32_t structLocaleCount, currencyCount; UEnumeration *en = ucurr_openISOCurrencies(UCURR_ALL, &errorCode); @@ -1165,6 +1166,7 @@ static void TestCurrencyList(void){ } ures_close(currencies); uenum_close(en); +#endif } #define TESTCASE(name) addTest(root, &name, "tsutil/cldrtest/" #name) @@ -1177,5 +1179,7 @@ void addCLDRTest(TestNode** root) TESTCASE(TestConsistentCountryInfo); TESTCASE(VerifyTranslation); TESTCASE(TestExemplarSet); +#if !UCONFIG_NO_FORMATTING TESTCASE(TestCurrencyList); +#endif } diff --git a/icu4c/source/test/cintltst/custrtrn.c b/icu4c/source/test/cintltst/custrtrn.c index fcf18891c6d..e08632abe8d 100644 --- a/icu4c/source/test/cintltst/custrtrn.c +++ b/icu4c/source/test/cintltst/custrtrn.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2001-2004, International Business Machines Corporation and + * Copyright (c) 2001-2005, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -462,6 +462,7 @@ static const uint16_t src16WithNulls[] = { }; static void Test_UChar_WCHART_API(void){ +#if (defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32)) || (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) UErrorCode err = U_ZERO_ERROR; const UChar* uSrc = src16j; int32_t uSrcLen = sizeof(src16j)/2; @@ -669,10 +670,14 @@ static void Test_UChar_WCHART_API(void){ u_errorName(err), wDestLen, buffer[3]); } } +#else + log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); +#endif } static void Test_widestrs() { +#if (defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32)) || (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) wchar_t ws[100]; UChar rts[100]; int32_t wcap = sizeof(ws) / sizeof(*ws); @@ -707,10 +712,14 @@ static void Test_widestrs() if(wl != rtl){ log_err("u_strFromWCS: wcs = %S, wl = %d,rts = %s, rtl = %d!\n", wcs, wl, u_austrcpy(astr, rts), rtl); } +#else + log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); +#endif } static void Test_WCHART_LongString(){ +#if (defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32)) || (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) UErrorCode status = U_ZERO_ERROR; const char* testdatapath=loadTestData(&status); UResourceBundle *theBundle = ures_open(testdatapath, "testtypes", &status); @@ -767,6 +776,8 @@ Test_WCHART_LongString(){ free(uDest); /* close the bundle */ ures_close(theBundle); - +#else + log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); +#endif } diff --git a/icu4c/source/test/iotest/filetst.c b/icu4c/source/test/iotest/filetst.c index a271dcb8512..1c09dd0a02c 100644 --- a/icu4c/source/test/iotest/filetst.c +++ b/icu4c/source/test/iotest/filetst.c @@ -1395,6 +1395,7 @@ static void TestVargs(void) { static void TestUnicodeFormat(void) { +#if !UCONFIG_NO_FORMATTING /* Make sure that invariant conversion doesn't happen on the _u formats. */ UChar myUString[256]; UFILE *myFile; @@ -1421,6 +1422,7 @@ static void TestUnicodeFormat(void) if (u_strcmp(TEST_STR, myUString) != 0) { log_err("u_fscanf_u doesn't work.\n"); } +#endif } @@ -1444,6 +1446,6 @@ addFileTest(TestNode** root) { addTest(root, &TestFilePrintCompatibility, "file/TestFilePrintCompatibility"); addTest(root, &TestBadScanfFormat, "file/TestBadScanfFormat"); addTest(root, &TestVargs, "file/TestVargs"); -#endif addTest(root, &TestUnicodeFormat, "file/TestUnicodeFormat"); +#endif } diff --git a/icu4c/source/test/iotest/iotest.cpp b/icu4c/source/test/iotest/iotest.cpp index bf981da1848..4bb0af3cb2f 100644 --- a/icu4c/source/test/iotest/iotest.cpp +++ b/icu4c/source/test/iotest/iotest.cpp @@ -925,7 +925,7 @@ int main(int argc, char* argv[]) DataDrivenLogger::cleanUp(); u_cleanup(); - endTime = ucal_getNow(); + endTime = uprv_getUTCtime(); diffTime = (int32_t)(endTime - startTime); printf("Elapsed Time: %02d:%02d:%02d.%03d\n", ((diffTime%U_MILLIS_PER_DAY)/U_MILLIS_PER_HOUR),