ICU-1874 Make the tests work on individual files when ICU_DATA is set to ....\data\out\build\

X-SVN-Rev: 8512
This commit is contained in:
George Rhoten 2002-04-25 18:59:32 +00:00
parent 985ce87495
commit 3c7398060a
3 changed files with 25 additions and 9 deletions

View File

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

View File

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

View File

@ -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");