]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/testmap/testmap.c
ICU-59152.0.1.tar.gz
[apple/icu.git] / icuSources / test / testmap / testmap.c
index 793faa18f470ce89ef07e8bb59080e1d8429f3a2..87ad62a79d3cf97d7f01e579d31f46ae8973ad3b 100644 (file)
@@ -1,6 +1,8 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
 **********************************************************************
-* Copyright (C) 1998-2003, International Business Machines Corporation 
+* Copyright (C) 1998-2012, International Business Machines Corporation
 * and others.  All Rights Reserved.
 **********************************************************************
 *
 #include <string.h>
 #include "unicode/udata.h"
 #include "unicode/ucnv.h"
+#include "ucmndata.h"
 
-extern const  char U_IMPORT U_ICUDATA_ENTRY_POINT [];
+extern const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT;
 
 int
 main(int argc,
      char **argv)
 {
   UConverter *c;
-
-  int32_t month = -1, year = -1;
   UErrorCode status = U_ZERO_ERROR;
-  status = U_ZERO_ERROR;
-
 
   udata_setCommonData(NULL, &status);
   printf("setCommonData(NULL) -> %s [should fail]\n",  u_errorName(status));
@@ -41,8 +40,8 @@ main(int argc,
   }
 
   status = U_ZERO_ERROR;
-  udata_setCommonData(U_ICUDATA_ENTRY_POINT, &status);  
-  printf("setCommonData(%p) -> %s\n", U_ICUDATA_ENTRY_POINT, u_errorName(status));
+  udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status);  
+  printf("setCommonData(%p) -> %s\n", (void*)&U_ICUDATA_ENTRY_POINT, u_errorName(status));
   if(U_FAILURE(status))
   {
     printf("*** FAIL: should have returned U_ZERO_ERROR\n");
@@ -50,8 +49,9 @@ main(int argc,
   }
 
   status = U_ZERO_ERROR;
-  c = ucnv_open("iso-8859-7", &status);
-  printf("ucnv_open(iso-8859-7)-> %p, err = %s, name=%s\n", c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status)  );
+  c = ucnv_open("iso-8859-3", &status);
+  printf("ucnv_open(iso-8859-3)-> %p, err = %s, name=%s\n",
+         (void *)c, u_errorName(status), (!c)?"?":ucnv_getName(c,&status)  );
   if(status != U_ZERO_ERROR)
   {
     printf("\n*** FAIL: should have returned U_ZERO_ERROR;\n");
@@ -63,11 +63,11 @@ main(int argc,
   }
 
   status = U_ZERO_ERROR;
-  udata_setCommonData(U_ICUDATA_ENTRY_POINT, &status);
-  printf("setCommonData(%p) -> %s [should fail]\n", U_ICUDATA_ENTRY_POINT, u_errorName(status));
-  if ( status != U_USING_DEFAULT_WARNING )
+  udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status);
+  printf("setCommonData(%p) -> %s [should pass]\n", (void*) &U_ICUDATA_ENTRY_POINT, u_errorName(status));
+  if (U_FAILURE(status) || status == U_USING_DEFAULT_WARNING )
   {
-    printf("\n*** FAIL: should have returned U_USING_DEFAULT_ERROR\n");
+    printf("\n*** FAIL: should pass and not set U_USING_DEFAULT_ERROR\n");
     return 1;
   }