ICU-4620 test fixes for uconfig.h

X-SVN-Rev: 18183
This commit is contained in:
Steven R. Loomis 2005-07-09 03:15:06 +00:00
parent a49bbbffb8
commit db04e06f4e
5 changed files with 24 additions and 6 deletions

View file

@ -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 <console.h>
@ -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),

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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),