]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/testmap/testmap.c
ICU-491.11.3.tar.gz
[apple/icu.git] / icuSources / test / testmap / testmap.c
CommitLineData
b75a7d8f
A
1/*
2**********************************************************************
729e4ab9 3* Copyright (C) 1998-2010, International Business Machines Corporation
b75a7d8f
A
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
22extern const char U_IMPORT U_ICUDATA_ENTRY_POINT [];
23
24int
25main(int argc,
26 char **argv)
27{
28 UConverter *c;
b75a7d8f 29 UErrorCode status = U_ZERO_ERROR;
b75a7d8f
A
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);
729e4ab9
A
50 printf("ucnv_open(iso-8859-7)-> %p, err = %s, name=%s\n",
51 (void *)c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status) );
b75a7d8f
A
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);
729e4ab9
A
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 )
b75a7d8f 66 {
729e4ab9 67 printf("\n*** FAIL: should pass and not set U_USING_DEFAULT_ERROR\n");
b75a7d8f
A
68 return 1;
69 }
70
71 printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n");
72 return 0;
73}