From 3c7398060ae10232bc04d4f8a437acee06d76a4e Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Thu, 25 Apr 2002 18:59:32 +0000 Subject: [PATCH] ICU-1874 Make the tests work on individual files when ICU_DATA is set to ....\data\out\build\ X-SVN-Rev: 8512 --- icu4c/source/test/intltest/intltest.cpp | 25 ++++++++++++++++++++----- icu4c/source/test/intltest/normconf.cpp | 5 +++-- icu4c/source/test/intltest/ucdtest.cpp | 4 ++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index da6c0ea599..65fde3d888 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -1116,12 +1116,27 @@ const char* IntlTest::loadTestData(UErrorCode& err){ strcat(tdpath, tdrelativepath); strcat(tdpath,"testdata"); err =U_ZERO_ERROR; - test=ures_open(tdpath, "ja_data", &err); - /* Fall back did not succeed either so return */ + test=ures_open(tdpath, "testtypes", &err); + /* we could not find the data in tdpath + * try one more tdpathFallback + */ if(U_FAILURE(err)){ - err = U_FILE_ACCESS_ERROR; - errln("construction of NULL did not succeed : %s \n", u_errorName(err)); - return ""; + strcpy(tdpath,directory); + strcat(tdpath,".."U_FILE_SEP_STRING); + strcat(tdpath,".."U_FILE_SEP_STRING); + strcat(tdpath, tdrelativepath); + strcat(tdpath,"testdata"); + err =U_ZERO_ERROR; + test=ures_open(tdpath, "testtypes", &err); + /* Fall back did not succeed either so return */ + if(U_FAILURE(err)){ + err = U_FILE_ACCESS_ERROR; + errln("construction of NULL did not succeed : %s \n", u_errorName(err)); + return ""; + } + ures_close(test); + _testDataPath = tdpath; + return _testDataPath; } ures_close(test); _testDataPath = tdpath; diff --git a/icu4c/source/test/intltest/normconf.cpp b/icu4c/source/test/intltest/normconf.cpp index 11f784733a..8725e7d85b 100644 --- a/icu4c/source/test/intltest/normconf.cpp +++ b/icu4c/source/test/intltest/normconf.cpp @@ -64,6 +64,7 @@ void NormalizerConformanceTest::TestConformance(void) { char backupPath[256]; FileStream *input = NULL; UChar32 c; + UErrorCode err = U_ZERO_ERROR; /* Look inside ICU_DATA first */ strcpy(newPath, u_getDataDirectory()); @@ -75,8 +76,8 @@ void NormalizerConformanceTest::TestConformance(void) { #if defined (U_TOPSRCDIR) strcpy(backupPath, U_TOPSRCDIR U_FILE_SEP_STRING "data"); #else - strcpy(backupPath, u_getDataDirectory()); - strcat(backupPath, ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING "data"); + strcpy(backupPath, loadTestData(err)); + strcat(backupPath, U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING "data"); #endif strcat(backupPath, U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING TEST_SUITE_FILE); diff --git a/icu4c/source/test/intltest/ucdtest.cpp b/icu4c/source/test/intltest/ucdtest.cpp index 04bac225ed..ada5412b96 100644 --- a/icu4c/source/test/intltest/ucdtest.cpp +++ b/icu4c/source/test/intltest/ucdtest.cpp @@ -462,8 +462,8 @@ void UnicodeTest::TestUnicodeData() # if defined (U_TOPSRCDIR) strcpy(backupPath, U_TOPSRCDIR U_FILE_SEP_STRING "data"); # else - strcpy(backupPath, u_getDataDirectory()); - strcat(backupPath, ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING "data"); + strcpy(backupPath, loadTestData(errorCode)); + strcat(backupPath, U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING "data"); # endif strcat(backupPath, U_FILE_SEP_STRING); strcat(backupPath, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");