]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ********************************************************************** | |
51004dcb | 3 | * Copyright (C) 1998-2012, 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" | |
51004dcb | 21 | #include "ucmndata.h" |
b75a7d8f | 22 | |
51004dcb | 23 | extern const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT; |
b75a7d8f A |
24 | |
25 | int | |
26 | main(int argc, | |
27 | char **argv) | |
28 | { | |
29 | UConverter *c; | |
b75a7d8f | 30 | UErrorCode status = U_ZERO_ERROR; |
b75a7d8f A |
31 | |
32 | udata_setCommonData(NULL, &status); | |
33 | printf("setCommonData(NULL) -> %s [should fail]\n", u_errorName(status)); | |
34 | if(status != U_ILLEGAL_ARGUMENT_ERROR) | |
35 | { | |
36 | printf("*** FAIL: should have returned U_ILLEGAL_ARGUMENT_ERROR\n"); | |
37 | return 1; | |
38 | } | |
39 | ||
40 | status = U_ZERO_ERROR; | |
51004dcb A |
41 | udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status); |
42 | printf("setCommonData(%p) -> %s\n", (void*)&U_ICUDATA_ENTRY_POINT, u_errorName(status)); | |
b75a7d8f A |
43 | if(U_FAILURE(status)) |
44 | { | |
45 | printf("*** FAIL: should have returned U_ZERO_ERROR\n"); | |
46 | return 1; | |
47 | } | |
48 | ||
49 | status = U_ZERO_ERROR; | |
51004dcb A |
50 | c = ucnv_open("iso-8859-3", &status); |
51 | printf("ucnv_open(iso-8859-3)-> %p, err = %s, name=%s\n", | |
729e4ab9 | 52 | (void *)c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status) ); |
b75a7d8f A |
53 | if(status != U_ZERO_ERROR) |
54 | { | |
55 | printf("\n*** FAIL: should have returned U_ZERO_ERROR;\n"); | |
56 | return 1; | |
57 | } | |
58 | else | |
59 | { | |
60 | ucnv_close(c); | |
61 | } | |
62 | ||
63 | status = U_ZERO_ERROR; | |
51004dcb A |
64 | udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status); |
65 | printf("setCommonData(%p) -> %s [should pass]\n", (void*) &U_ICUDATA_ENTRY_POINT, u_errorName(status)); | |
729e4ab9 | 66 | if (U_FAILURE(status) || status == U_USING_DEFAULT_WARNING ) |
b75a7d8f | 67 | { |
729e4ab9 | 68 | printf("\n*** FAIL: should pass and not set U_USING_DEFAULT_ERROR\n"); |
b75a7d8f A |
69 | return 1; |
70 | } | |
71 | ||
72 | printf("\n*** PASS PASS PASS, test PASSED!!!!!!!!\n"); | |
73 | return 0; | |
74 | } |