]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/testmap/testmap.c
ICU-8.11.tar.gz
[apple/icu.git] / icuSources / test / testmap / testmap.c
1 /*
2 **********************************************************************
3 * Copyright (C) 1998-2003, 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
25 main(int argc,
26 char **argv)
27 {
28 UConverter *c;
29
30 int32_t month = -1, year = -1;
31 UErrorCode status = U_ZERO_ERROR;
32 status = U_ZERO_ERROR;
33
34
35 udata_setCommonData(NULL, &status);
36 printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status));
37 if(status != U_ILLEGAL_ARGUMENT_ERROR)
38 {
39 printf("*** FAIL: should have returned U_ILLEGAL_ARGUMENT_ERROR\n");
40 return 1;
41 }
42
43 status = U_ZERO_ERROR;
44 udata_setCommonData(U_ICUDATA_ENTRY_POINT, &status);
45 printf("setCommonData(%p) -> %s\n", U_ICUDATA_ENTRY_POINT, u_errorName(status));
46 if(U_FAILURE(status))
47 {
48 printf("*** FAIL: should have returned U_ZERO_ERROR\n");
49 return 1;
50 }
51
52 status = U_ZERO_ERROR;
53 c = ucnv_open("iso-8859-7", &status);
54 printf("ucnv_open(iso-8859-7)-> %p, err = %s, name=%s\n", c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status) );
55 if(status != U_ZERO_ERROR)
56 {
57 printf("\n*** FAIL: should have returned U_ZERO_ERROR;\n");
58 return 1;
59 }
60 else
61 {
62 ucnv_close(c);
63 }
64
65 status = U_ZERO_ERROR;
66 udata_setCommonData(U_ICUDATA_ENTRY_POINT, &status);
67 printf("setCommonData(%p) -> %s [should fail]\n", U_ICUDATA_ENTRY_POINT, u_errorName(status));
68 if ( status != U_USING_DEFAULT_WARNING )
69 {
70 printf("\n*** FAIL: should have returned U_USING_DEFAULT_ERROR\n");
71 return 1;
72 }
73
74 printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n");
75 return 0;
76 }