ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / thcoll.cpp
index 87fa4c895cbd21278f32bfd17adb46056423273c..fdc3ba051cd34044fce4cceec550325937f826a0 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 1999-2014, International Business Machines
+*   Copyright (C) 1999-2016, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *   Date        Name        Description
@@ -19,6 +19,7 @@
 #include "unicode/sortkey.h"
 #include "unicode/tblcoll.h"
 #include "unicode/ustring.h"
+#include "cmemory.h"
 #include "cstring.h"
 #include "filestrm.h"
 #include "textfile.h"
@@ -239,7 +240,7 @@ void CollationThaiTest::TestCornerCases(void) {
         // Periods are ignored entirely
         "\\u0e01.\\u0e01.",                      "<",    "\\u0e01\\u0e32",
     };
-    const int32_t TESTS_length = (int32_t)(sizeof(TESTS)/sizeof(TESTS[0]));
+    const int32_t TESTS_length = UPRV_LENGTHOF(TESTS);
 
     if (coll == 0) {
         errln("Error: could not construct Thai collator");
@@ -376,7 +377,7 @@ void CollationThaiTest::TestInvalidThai(void) {
 
   CollationElementIterator* c = ((RuleBasedCollator *)coll)->createCollationElementIterator( iteratorText );
 
-  for(i = 0; i < (int32_t)(sizeof(tests)/sizeof(tests[0])); i++) {
+  for(i = 0; i < UPRV_LENGTHOF(tests); i++) {
     len = u_unescape(tests[i], strings[i], 20);
     strings[i][len] = 0;
     toSort[i] = strings[i];
@@ -453,7 +454,7 @@ void CollationThaiTest::TestReordering(void) {
     errln("Unable to set the Thai collator clone to secondary strength");
     return;
   }
-  compareArray(*coll2, tests, sizeof(tests)/sizeof(tests[0]));
+  compareArray(*coll2, tests, UPRV_LENGTHOF(tests));
  
   const char *rule = "& c < ab";
   const char *testcontraction[] = { "\\u0E41ab", ">", "\\u0E41c"}; // After UCA 4.1 Thai are normal so won't break a contraction