]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/trietest.c
ICU-491.11.3.tar.gz
[apple/icu.git] / icuSources / test / cintltst / trietest.c
index c4a7c1733fc5ac5c2c037ce6c5ce5358f46eaa61..ac595b675764516d11649b90ccc1377cd120cc82 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 2001-2006, International Business Machines
+*   Copyright (C) 2001-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
@@ -16,6 +16,7 @@
 
 #include <stdio.h>
 #include "unicode/utypes.h"
+#include "unicode/utf16.h"
 #include "utrie.h"
 #include "cstring.h"
 #include "cmemory.h"
@@ -156,7 +157,7 @@ testTrieIteration(const char *testName,
         c=checkRanges[i].limit;
         if(c!=0) {
             --c;
-            UTF_APPEND_CHAR_UNSAFE(s, length, c);
+            U16_APPEND_UNSAFE(s, length, c);
             values[countValues++]=checkRanges[i].value;
         }
     }
@@ -179,7 +180,7 @@ testTrieIteration(const char *testName,
         if(
             c2==0 ?
                 c!=*(p-1) :
-                !UTF_IS_LEAD(c) || !UTF_IS_TRAIL(c2) || c!=*(p-2) || c2!=*(p-1)
+                !U16_IS_LEAD(c) || !U16_IS_TRAIL(c2) || c!=*(p-2) || c2!=*(p-1)
         ) {
             log_err("error: wrong (c, c2) from UTRIE_NEXT(%s): (U+%04lx, U+%04lx)\n",
                     testName, c, c2);
@@ -243,7 +244,7 @@ testTrieIteration(const char *testName,
         if(
             c2==0 ?
                 c!=*p:
-                !UTF_IS_LEAD(c) || !UTF_IS_TRAIL(c2) || c!=*p || c2!=*(p+1)
+                !U16_IS_LEAD(c) || !U16_IS_TRAIL(c2) || c!=*p || c2!=*(p+1)
         ) {
             log_err("error: wrong (c, c2) from UTRIE_PREVIOUS(%s): (U+%04lx, U+%04lx)\n",
                     testName, c, c2);
@@ -384,7 +385,7 @@ testTrieRangesWithMalloc(const char *testName,
                     log_err("error: unserialized trie(%s).fromBMP(U+%04lx)==0x%lx instead of 0x%lx\n",
                             testName, start, value2, value);
                 }
-                if(!UTF_IS_LEAD(start)) {
+                if(!U16_IS_LEAD(start)) {
                     if(dataIs32) {
                         value2=UTRIE_GET32_FROM_LEAD(&trie, start);
                     } else {
@@ -593,7 +594,7 @@ testTrieRanges(const char *testName,
                     log_err("error: unserialized trie(%s).fromBMP(U+%04lx)==0x%lx instead of 0x%lx\n",
                             testName, start, value2, value);
                 }
-                if(!UTF_IS_LEAD(start)) {
+                if(!U16_IS_LEAD(start)) {
                     if(dataIs32) {
                         value2=UTRIE_GET32_FROM_LEAD(&trie, start);
                     } else {
@@ -745,6 +746,9 @@ setRanges2[]={
     {0x2f800,0x2fedc,    0x7a,   TRUE},
     {0x72,   0xdd,       3,      TRUE},
     {0xdd,   0xde,       4,      FALSE},
+    {0x201,  0x220,      6,      TRUE},  /* 3 consecutive blocks with the same pattern but discontiguous value ranges */
+    {0x221,  0x240,      6,      TRUE},
+    {0x241,  0x260,      6,      TRUE},
     {0x2f987,0x2fa98,    5,      TRUE},
     {0x2f777,0x2f833,    0,      TRUE},
     {0x2f900,0x2ffee,    1,      FALSE},
@@ -758,6 +762,12 @@ checkRanges2[]={
     {0x72,   0x5555},
     {0xdd,   3},
     {0xde,   4},
+    {0x201,  0},
+    {0x220,  6},
+    {0x221,  0},
+    {0x240,  6},
+    {0x241,  0},
+    {0x260,  6},
     {0x2f833,0},
     {0x2f987,0x7a},
     {0x2fa98,5},