]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/ucsdetst.c
ICU-59173.0.1.tar.gz
[apple/icu.git] / icuSources / test / cintltst / ucsdetst.c
index d2ad1e044767db9e9e19b0a5c69d69ff7f48b8fd..e39c46aaa7a4f8bcde04a32e9ee84b25627166a1 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) 2005-2009, International Business Machines Corporation and *
+ * Copyright (c) 2005-2016, International Business Machines Corporation and *
  * others. All Rights Reserved.                                             *
  ****************************************************************************
  */
 #include "unicode/ustring.h"
 
 #include "cintltst.h"
+#include "cmemory.h"
 
 #include <stdlib.h>
 #include <string.h>
 
-#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
-
 #define NEW_ARRAY(type,count) (type *) malloc((count) * sizeof(type))
 #define DELETE_ARRAY(array) free(array)
 
@@ -166,7 +167,7 @@ static void TestUTF16(void)
         0x0020, 0x0627, 0x0644, 0x062d, 0x0627, 0x0633, 0x0648, 0x0628,
         0x0020, 0x002b, 0x0020, 0x0627, 0x0646, 0x062a, 0x0631, 0x0646,
         0x064a, 0x062a, 0x0000};
-    int32_t beLength = 0, leLength = 0, cLength = ARRAY_SIZE(chars);
+    int32_t beLength = 0, leLength = 0, cLength = UPRV_LENGTHOF(chars);
     char *beBytes = extractBytes(chars, cLength, "UTF-16BE", &beLength);
     char *leBytes = extractBytes(chars, cLength, "UTF-16LE", &leLength);
     UCharsetDetector *csd = ucsdet_open(&status);
@@ -400,7 +401,7 @@ static void TestBufferOverflow(void) {
         goto bail;
     }
 
-    for (idx = 0; idx < ARRAY_SIZE(testStrings); idx++) {
+    for (idx = 0; idx < UPRV_LENGTHOF(testStrings); idx++) {
         ucsdet_setText(csd, testStrings[idx], -1, &status);
         match = ucsdet_detect(csd, &status);
 
@@ -470,7 +471,7 @@ static void TestIBM424(void)
             0x0000
     };
 
-    int32_t bLength = 0, brLength = 0, cLength = ARRAY_SIZE(chars), crLength = ARRAY_SIZE(chars_reverse);
+    int32_t bLength = 0, brLength = 0, cLength = UPRV_LENGTHOF(chars), crLength = UPRV_LENGTHOF(chars_reverse);
     
     char *bytes = extractBytes(chars, cLength, "IBM424", &bLength);
     char *bytes_r = extractBytes(chars_reverse, crLength, "IBM424", &brLength);
@@ -548,7 +549,7 @@ static void TestIBM420(void)
         0x0000,
     };
     
-    int32_t bLength = 0, brLength = 0, cLength = ARRAY_SIZE(chars), crLength = ARRAY_SIZE(chars_reverse);
+    int32_t bLength = 0, brLength = 0, cLength = UPRV_LENGTHOF(chars), crLength = UPRV_LENGTHOF(chars_reverse);
     
     char *bytes = extractBytes(chars, cLength, "IBM420", &bLength);
     char *bytes_r = extractBytes(chars_reverse, crLength, "IBM420", &brLength);