]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/intltest/testidna.cpp
ICU-511.27.tar.gz
[apple/icu.git] / icuSources / test / intltest / testidna.cpp
index d15cc6a4992e341c0804577d1692196aad341833..c24dbe6067adf584f3a0ad1bf9cfd6d7944fab10 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *******************************************************************************
  *
- *   Copyright (C) 2003-2010, International Business Machines
+ *   Copyright (C) 2003-2012, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  *
  *******************************************************************************
@@ -1520,23 +1520,33 @@ void TestIDNA::TestIDNAMonkeyTest(){
 }
 
 void TestIDNA::TestCompareReferenceImpl(){
-    
+
     UChar src [2] = {0,0};
     int32_t srcLen = 0;
-    
 
-    for(int32_t i = 0x40000 ; i< 0x10ffff; i++){
-        if(quick==TRUE && i> 0x1FFFF){
+    // data even OK?
+    {
+      UErrorCode dataStatus = U_ZERO_ERROR;
+      loadTestData(dataStatus);
+      if(U_FAILURE(dataStatus)) {
+        dataerrln("Couldn't load test data: %s\n", u_errorName(dataStatus)); // save us from thousands and thousands of errors
+        return;
+      }
+    }
+
+    for (int32_t i = 0; i <= 0x10FFFF; i++){
+        if (quick == TRUE && i > 0x0FFF){
             return;
         }
-        if(i >= 0x30000 && i <= 0xF0000){
-           i+=0xB0000;
+        if(i == 0x30000){
+            // jump to E0000, no characters assigned in plain 3 to plain 13 as of Unicode 6.0
+            i = 0xE0000;
         }
-        if(i>0xFFFF){
-           src[0] = U16_LEAD(i);
-           src[1] = U16_TRAIL(i);
-           srcLen =2;
-        }else{
+        if (i > 0xFFFF){
+            src[0] = U16_LEAD(i);
+            src[1] = U16_TRAIL(i);
+            srcLen =2;
+        } else {
             src[0] = (UChar)i;
             src[1] = 0;
             srcLen = 1;