1 /*
2 **********************************************************************
3 * Copyright (C) 1998-2010, International Business Machines Corporation
4 * and others. All Rights Reserved.
5 **********************************************************************
6 *
7 * File date.c
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 4/26/2000 srl created
13 *******************************************************************************
14 */
15
16 #include "unicode/utypes.h"
17 #include <stdio.h>
18 #include <string.h>
19 #include "unicode/udata.h"
20 #include "unicode/ucnv.h"
21
22 extern const char U_IMPORT U_ICUDATA_ENTRY_POINT [];
23
24 int
main(int argc,char ** argv)25 main(int argc,
26 char **argv)
27 {
28 UConverter *c;
29 UErrorCode status = U_ZERO_ERROR;
30
31 udata_setCommonData(NULL, &status);
32 printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status));
33 if(status != U_ILLEGAL_ARGUMENT_ERROR)
34 {
35 printf("*** FAIL: should have returned U_ILLEGAL_ARGUMENT_ERROR\n");
36 return 1;
37 }
38
39 status = U_ZERO_ERROR;
40 udata_setCommonData(U_ICUDATA_ENTRY_POINT, &status);
41 printf("setCommonData(%p) -> %s\n", U_ICUDATA_ENTRY_POINT, u_errorName(status));
42 if(U_FAILURE(status))
43 {
44 printf("*** FAIL: should have returned U_ZERO_ERROR\n");
45 return 1;
46 }
47
48 status = U_ZERO_ERROR;
49 c = ucnv_open("iso-8859-7", &status);
50 printf("ucnv_open(iso-8859-7)-> %p, err = %s, name=%s\n",
51 (void *)c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status) );
52 if(status != U_ZERO_ERROR)
53 {
54 printf("\n*** FAIL: should have returned U_ZERO_ERROR;\n");
55 return 1;
56 }
57 else
58 {
59 ucnv_close(c);
60 }
61
62 status = U_ZERO_ERROR;
63 udata_setCommonData(U_ICUDATA_ENTRY_POINT, &status);
64 printf("setCommonData(%p) -> %s [should pass]\n", U_ICUDATA_ENTRY_POINT, u_errorName(status));
65 if (U_FAILURE(status) || status == U_USING_DEFAULT_WARNING )
66 {
67 printf("\n*** FAIL: should pass and not set U_USING_DEFAULT_ERROR\n");
68 return 1;
69 }
70
71 printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n");
72 return 0;
73 }
74