d6ff2cbfec
X-SVN-Rev: 1323
74 lines
1.9 KiB
C
74 lines
1.9 KiB
C
/*
|
|
**********************************************************************
|
|
* Copyright (C) 1998-2000, International Business Machines Corporation
|
|
* and others. All Rights Reserved.
|
|
**********************************************************************
|
|
*
|
|
* File date.c
|
|
*
|
|
* Modification History:
|
|
*
|
|
* Date Name Description
|
|
* 4/26/2000 srl created
|
|
*******************************************************************************
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "unicode/udata.h"
|
|
#include "unicode/ucnv.h"
|
|
|
|
extern const uint8_t U_IMPORT icudata_dat[];
|
|
|
|
int
|
|
main(int argc,
|
|
char **argv)
|
|
{
|
|
UConverter *c;
|
|
|
|
int32_t month = -1, year = -1;
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
udata_setCommonData(NULL, &status);
|
|
printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status));
|
|
if(status != U_ILLEGAL_ARGUMENT_ERROR)
|
|
{
|
|
printf("*** FAIL: should have returned U_ILLEGAL_ARGUMENT_ERROR\n");
|
|
return 1;
|
|
}
|
|
|
|
status = U_ZERO_ERROR;
|
|
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;
|
|
}
|
|
|
|
status = U_ZERO_ERROR;
|
|
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) );
|
|
if(status != U_ZERO_ERROR)
|
|
{
|
|
printf("\n*** FAIL: should have returned U_ZERO_ERROR;\n");
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
ucnv_close(c);
|
|
}
|
|
|
|
status = U_ZERO_ERROR;
|
|
udata_setCommonData(icudata_dat, &status);
|
|
printf("setCommonData(%p) -> %s [should fail]\n", icudata_dat, u_errorName(status));
|
|
if ( status != U_USING_DEFAULT_ERROR )
|
|
{
|
|
printf("\n*** FAIL: should have returned U_USING_DEFAULT_ERROR\n");
|
|
return 1;
|
|
}
|
|
|
|
printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n");
|
|
return 0;
|
|
}
|