]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/testmap/testmap.c
ICU-66108.tar.gz
[apple/icu.git] / icuSources / test / testmap / testmap.c
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
b75a7d8f
A
3/*
4**********************************************************************
51004dcb 5* Copyright (C) 1998-2012, International Business Machines Corporation
b75a7d8f
A
6* and others. All Rights Reserved.
7**********************************************************************
8*
9* File date.c
10*
11* Modification History:
12*
13* Date Name Description
14* 4/26/2000 srl created
15*******************************************************************************
16*/
17
18#include "unicode/utypes.h"
19#include <stdio.h>
20#include <string.h>
21#include "unicode/udata.h"
22#include "unicode/ucnv.h"
51004dcb 23#include "ucmndata.h"
b75a7d8f 24
51004dcb 25extern const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT;
b75a7d8f
A
26
27int
28main(int argc,
29 char **argv)
30{
31 UConverter *c;
b75a7d8f 32 UErrorCode status = U_ZERO_ERROR;
b75a7d8f
A
33
34 udata_setCommonData(NULL, &status);
35 printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status));
36 if(status != U_ILLEGAL_ARGUMENT_ERROR)
37 {
38 printf("*** FAIL: should have returned U_ILLEGAL_ARGUMENT_ERROR\n");
39 return 1;
40 }
41
42 status = U_ZERO_ERROR;
51004dcb
A
43 udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status);
44 printf("setCommonData(%p) -> %s\n", (void*)&U_ICUDATA_ENTRY_POINT, u_errorName(status));
b75a7d8f
A
45 if(U_FAILURE(status))
46 {
47 printf("*** FAIL: should have returned U_ZERO_ERROR\n");
48 return 1;
49 }
50
51 status = U_ZERO_ERROR;
51004dcb
A
52 c = ucnv_open("iso-8859-3", &status);
53 printf("ucnv_open(iso-8859-3)-> %p, err = %s, name=%s\n",
729e4ab9 54 (void *)c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status) );
b75a7d8f
A
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;
51004dcb
A
66 udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status);
67 printf("setCommonData(%p) -> %s [should pass]\n", (void*) &U_ICUDATA_ENTRY_POINT, u_errorName(status));
729e4ab9 68 if (U_FAILURE(status) || status == U_USING_DEFAULT_WARNING )
b75a7d8f 69 {
729e4ab9 70 printf("\n*** FAIL: should pass and not set U_USING_DEFAULT_ERROR\n");
b75a7d8f
A
71 return 1;
72 }
73
74 printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n");
75 return 0;
76}