ICU-375 merge testmap from 1.4.1.2 and adapt to reimplemented udata

X-SVN-Rev: 1323
This commit is contained in:
Markus Scherer 2000-05-03 23:14:11 +00:00
parent 7c7a980e20
commit d6ff2cbfec
2 changed files with 24 additions and 52 deletions

View File

@ -438,6 +438,18 @@ Package=<4>
############################################################################### ###############################################################################
Project: "testmap"=..\test\testmap\testmap.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "toolutil"=..\tools\toolutil\toolutil.dsp - Package Owner=<4> Project: "toolutil"=..\tools\toolutil\toolutil.dsp - Package Owner=<4>
Package=<5> Package=<5>

View File

@ -18,9 +18,7 @@
#include "unicode/udata.h" #include "unicode/udata.h"
#include "unicode/ucnv.h" #include "unicode/ucnv.h"
#ifdef UDATA_MAP_DLL
extern const uint8_t U_IMPORT icudata_dat[]; extern const uint8_t U_IMPORT icudata_dat[];
#endif
int int
main(int argc, main(int argc,
@ -30,84 +28,46 @@ main(int argc,
int32_t month = -1, year = -1; int32_t month = -1, year = -1;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UErrorCode status2 = U_ZERO_ERROR;
#ifdef UDATA_MAP_DLL
printf("MAPPED DLL, memory mapped code path present.\n");
udata_setCommonData(icudata_dat, &status);
printf("setCommonData(%p) -> %s\n", icudata_dat, u_errorName(status));
if(U_FAILURE(status))
{
printf("*** FAIL: should have returned U_ZERO_ERROR\n");
return 1;
}
#else
#ifdef UDATA_MAP
printf("memory mapped code path present. Mapped DLL not built.\n");
udata_setCommonData(NULL, &status); udata_setCommonData(NULL, &status);
printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status)); printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status));
if(status != U_ILLEGAL_ARGUMENT_ERROR) if(status != U_ILLEGAL_ARGUMENT_ERROR)
{ {
printf("*** FAIL: should have returned U_ILLEGAL_ARGUMENT_ERROR\n"); printf("*** FAIL: should have returned U_ILLEGAL_ARGUMENT_ERROR\n");
return 1; return 1;
} }
# else /* non map .. DLL ? */ status = U_ZERO_ERROR;
udata_setCommonData(icudata_dat, &status);
printf("Mapped DLL not built. Memory mapped code path NOT present.\n"); printf("setCommonData(%p) -> %s\n", icudata_dat, u_errorName(status));
# ifdef UDATA_DLL if(U_FAILURE(status))
printf("DLL code path present!\n");
# endif
udata_setCommonData(NULL, &status);
printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status));
if(status != U_UNSUPPORTED_ERROR)
{ {
printf("\n*** FAIL: should have returned U_UNSUPPORTED_ERROR\n"); printf("*** FAIL: should have returned U_ZERO_ERROR\n");
return 1; return 1;
} }
#endif status = U_ZERO_ERROR;
#endif
c = ucnv_open("shift_jis", &status); c = ucnv_open("shift_jis", &status);
printf("ucnv_open(shift_jis)-> %p, err = %s, name=%s\n", c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status) );
printf("ucnv_open(shift_jis)-> %p, err = %s, name=%s\n", c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status2) );
#ifdef UDATA_MAP_DLL
if(status != U_ZERO_ERROR) if(status != U_ZERO_ERROR)
{ {
printf("\n*** FAIL: should have returned U_ZERO_ERROR;\n"); printf("\n*** FAIL: should have returned U_ZERO_ERROR;\n");
return 1; return 1;
} }
else
{
ucnv_close(c);
}
status = U_ZERO_ERROR;
udata_setCommonData(icudata_dat, &status); udata_setCommonData(icudata_dat, &status);
printf("setCommonData(%p) -> %s [should fail]\n", icudata_dat, u_errorName(status)); printf("setCommonData(%p) -> %s [should fail]\n", icudata_dat, u_errorName(status));
if ( status != U_USING_DEFAULT_ERROR ) if ( status != U_USING_DEFAULT_ERROR )
{ {
printf("\n*** FAIL: should have returned U_USING_DEFAULT_ERROR\n"); printf("\n*** FAIL: should have returned U_USING_DEFAULT_ERROR\n");
return 1; return 1;
} }
#else
if(status == U_ZERO_ERROR)
{
printf("\n*** FAIL: should have failed.\n");
return 1;
}
#endif
printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n"); printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n");
return 0; return 0;
} }