You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2012/10/03 20:57:07 UTC

[lucy-commits] svn commit: r1393673 - /lucy/trunk/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c

Author: marvin
Date: Wed Oct  3 18:57:07 2012
New Revision: 1393673

URL: http://svn.apache.org/viewvc?rev=1393673&view=rev
Log:
Remove Lucy-specific utf8proc test.

Modified:
    lucy/trunk/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c

Modified: lucy/trunk/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
URL: http://svn.apache.org/viewvc/lucy/trunk/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c?rev=1393673&r1=1393672&r2=1393673&view=diff
==============================================================================
--- lucy/trunk/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c (original)
+++ lucy/trunk/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c Wed Oct  3 18:57:07 2012
@@ -21,7 +21,6 @@
 #include "Clownfish/Test/Util/TestStringHelper.h"
 #include "Clownfish/Test/TestUtils.h"
 #include "Clownfish/Util/StringHelper.h"
-#include "utf8proc.h"
 
 /* This alternative implementation of utf8_valid() is (presumably) slower, but
  * it implements the standard in a more linear, easy-to-grok way.
@@ -275,60 +274,9 @@ test_back_utf8_char(TestBatch *batch) {
               "back_utf8_char returns NULL when end == start");
 }
 
-static void
-test_utf8proc_normalization(TestBatch *batch) {
-    SKIP(batch, "utf8proc can't handle control chars or Unicode non-chars");
-    return;
-
-    for (int32_t i = 0; i < 100; i++) {
-        CharBuf *source = TestUtils_random_string(rand() % 40);
-
-        // Normalize once.
-        uint8_t *normalized;
-        int32_t check = utf8proc_map(CB_Get_Ptr8(source), CB_Get_Size(source),
-                                     &normalized,
-                                     UTF8PROC_STABLE  |
-                                     UTF8PROC_COMPOSE |
-                                     UTF8PROC_COMPAT  |
-                                     UTF8PROC_CASEFOLD);
-        if (check < 0) {
-            lucy_Json_set_tolerant(1);
-            CharBuf *json = lucy_Json_to_json((Obj*)source);
-            if (!json) {
-                json = CB_newf("[failed to encode]");
-            }
-            FAIL(batch, "Failed to normalize: %s", CB_Get_Ptr8(json));
-            DECREF(json);
-            DECREF(source);
-            return;
-        }
-
-        // Normalize again.
-        size_t normalized_len = strlen((char*)normalized);
-        uint8_t *dupe;
-        int32_t dupe_check = utf8proc_map(normalized, normalized_len, &dupe,
-                                          UTF8PROC_STABLE  |
-                                          UTF8PROC_COMPOSE |
-                                          UTF8PROC_COMPAT  |
-                                          UTF8PROC_CASEFOLD);
-        if (dupe_check < 0) {
-            THROW(ERR, "Unexpected normalization error: %i32", dupe_check);
-        }
-        int comparison = strcmp((char*)normalized, (char*)dupe);
-        free(dupe);
-        free(normalized);
-        DECREF(source);
-        if (comparison != 0) {
-            FAIL(batch, "Not fully normalized");
-            return;
-        }
-    }
-    PASS(batch, "Normalization successful.");
-}
-
 void
 TestStrHelp_run_tests() {
-    TestBatch *batch = TestBatch_new(41);
+    TestBatch *batch = TestBatch_new(40);
 
     TestBatch_Plan(batch);
 
@@ -338,7 +286,6 @@ TestStrHelp_run_tests() {
     test_utf8_valid(batch);
     test_is_whitespace(batch);
     test_back_utf8_char(batch);
-    test_utf8proc_normalization(batch);
 
     DECREF(batch);
 }