lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [04/27] Remove bundled Clownfish.
Date Sat, 12 Apr 2014 06:49:39 GMT
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c b/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
deleted file mode 100644
index 5840c34..0000000
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <time.h>
-
-#define CFISH_USE_SHORT_NAMES
-#define TESTCFISH_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include "Clownfish/Test/Util/TestNumberUtils.h"
-
-#include "Clownfish/Err.h"
-#include "Clownfish/Test.h"
-#include "Clownfish/TestHarness/TestBatchRunner.h"
-#include "Clownfish/TestHarness/TestUtils.h"
-#include "Clownfish/Util/Memory.h"
-#include "Clownfish/Util/NumberUtils.h"
-#include "Clownfish/VTable.h"
-
-TestNumberUtils*
-TestNumUtil_new() {
-    return (TestNumberUtils*)VTable_Make_Obj(TESTNUMBERUTILS);
-}
-
-static void
-test_u1(TestBatchRunner *runner) {
-    size_t    count   = 64;
-    uint64_t *ints    = TestUtils_random_u64s(NULL, count, 0, 2);
-    size_t    amount  = count / 8;
-    uint8_t  *bits    = (uint8_t*)CALLOCATE(amount, sizeof(uint8_t));
-
-    for (size_t i = 0; i < count; i++) {
-        if (ints[i]) { NumUtil_u1set(bits, i); }
-    }
-    for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u1get(bits, i), (long)ints[i],
-                    "u1 set/get");
-    }
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_u1flip(bits, i);
-    }
-    for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u1get(bits, i), !ints[i], "u1 flip");
-    }
-
-    FREEMEM(bits);
-    FREEMEM(ints);
-}
-
-static void
-test_u2(TestBatchRunner *runner) {
-    size_t    count = 32;
-    uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, 4);
-    uint8_t  *bits = (uint8_t*)CALLOCATE((count / 4), sizeof(uint8_t));
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_u2set(bits, i, (uint8_t)ints[i]);
-    }
-    for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u2get(bits, i), (long)ints[i], "u2");
-    }
-
-    FREEMEM(bits);
-    FREEMEM(ints);
-}
-
-static void
-test_u4(TestBatchRunner *runner) {
-    size_t    count = 128;
-    uint64_t *ints  = TestUtils_random_u64s(NULL, count, 0, 16);
-    uint8_t  *bits  = (uint8_t*)CALLOCATE((count / 2), sizeof(uint8_t));
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_u4set(bits, i, (uint8_t)ints[i]);
-    }
-    for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u4get(bits, i), (long)ints[i], "u4");
-    }
-
-    FREEMEM(bits);
-    FREEMEM(ints);
-}
-
-static void
-test_c32(TestBatchRunner *runner) {
-    uint64_t  mins[]   = { 0,   0x4000 - 100, (uint32_t)INT32_MAX - 100, UINT32_MAX - 10 };
-    uint64_t  limits[] = { 500, 0x4000 + 100, (uint32_t)INT32_MAX + 100, UINT32_MAX      };
-    uint32_t  set_num;
-    uint32_t  num_sets  = sizeof(mins) / sizeof(uint64_t);
-    size_t    count     = 64;
-    uint64_t *ints      = NULL;
-    size_t    amount    = count * C32_MAX_BYTES;
-    char     *encoded   = (char*)CALLOCATE(amount, sizeof(char));
-    char     *target    = encoded;
-    char     *limit     = target + amount;
-
-    for (set_num = 0; set_num < num_sets; set_num++) {
-        char *skip;
-        ints = TestUtils_random_u64s(ints, count,
-                                     mins[set_num], limits[set_num]);
-        target = encoded;
-        for (size_t i = 0; i < count; i++) {
-            NumUtil_encode_c32((uint32_t)ints[i], &target);
-        }
-        target = encoded;
-        skip   = encoded;
-        for (size_t i = 0; i < count; i++) {
-            TEST_INT_EQ(runner, NumUtil_decode_c32(&target), (long)ints[i],
-                        "c32 %lu", (long)ints[i]);
-            NumUtil_skip_cint(&skip);
-            if (target > limit) { THROW(ERR, "overrun"); }
-        }
-        TEST_TRUE(runner, skip == target, "skip %lu == %lu",
-                  (unsigned long)skip, (unsigned long)target);
-
-        target = encoded;
-        for (size_t i = 0; i < count; i++) {
-            NumUtil_encode_padded_c32((uint32_t)ints[i], &target);
-        }
-        TEST_TRUE(runner, target == limit,
-                  "padded c32 uses 5 bytes (%lu == %lu)", (unsigned long)target,
-                  (unsigned long)limit);
-        target = encoded;
-        skip   = encoded;
-        for (size_t i = 0; i < count; i++) {
-            TEST_INT_EQ(runner, NumUtil_decode_c32(&target), (long)ints[i],
-                        "padded c32 %lu", (long)ints[i]);
-            NumUtil_skip_cint(&skip);
-            if (target > limit) { THROW(ERR, "overrun"); }
-        }
-        TEST_TRUE(runner, skip == target, "skip padded %lu == %lu",
-                  (unsigned long)skip, (unsigned long)target);
-    }
-
-    target = encoded;
-    NumUtil_encode_c32(UINT32_MAX, &target);
-    target = encoded;
-    TEST_INT_EQ(runner, NumUtil_decode_c32(&target), UINT32_MAX, "c32 UINT32_MAX");
-
-    FREEMEM(encoded);
-    FREEMEM(ints);
-}
-
-static void
-test_c64(TestBatchRunner *runner) {
-    uint64_t  mins[]    = { 0,   0x4000 - 100, (uint64_t)UINT32_MAX - 100,  UINT64_MAX - 10 };
-    uint64_t  limits[]  = { 500, 0x4000 + 100, (uint64_t)UINT32_MAX + 1000, UINT64_MAX      };
-    uint32_t  set_num;
-    uint32_t  num_sets  = sizeof(mins) / sizeof(uint64_t);
-    size_t    count     = 64;
-    uint64_t *ints      = NULL;
-    size_t    amount    = count * C64_MAX_BYTES;
-    char     *encoded   = (char*)CALLOCATE(amount, sizeof(char));
-    char     *target    = encoded;
-    char     *limit     = target + amount;
-
-    for (set_num = 0; set_num < num_sets; set_num++) {
-        char *skip;
-        ints = TestUtils_random_u64s(ints, count,
-                                     mins[set_num], limits[set_num]);
-        target = encoded;
-        for (size_t i = 0; i < count; i++) {
-            NumUtil_encode_c64(ints[i], &target);
-        }
-        target = encoded;
-        skip   = encoded;
-        for (size_t i = 0; i < count; i++) {
-            uint64_t got = NumUtil_decode_c64(&target);
-            TEST_TRUE(runner, got == ints[i],
-                      "c64 %" PRIu64 " == %" PRIu64, got, ints[i]);
-            if (target > limit) { THROW(ERR, "overrun"); }
-            NumUtil_skip_cint(&skip);
-        }
-        TEST_TRUE(runner, skip == target, "skip %lu == %lu",
-                  (unsigned long)skip, (unsigned long)target);
-    }
-
-    target = encoded;
-    NumUtil_encode_c64(UINT64_MAX, &target);
-    target = encoded;
-
-    uint64_t got = NumUtil_decode_c64(&target);
-    TEST_TRUE(runner, got == UINT64_MAX, "c64 UINT64_MAX");
-
-    FREEMEM(encoded);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_u16(TestBatchRunner *runner) {
-    size_t    count     = 32;
-    uint64_t *ints      = TestUtils_random_u64s(NULL, count, 0, UINT16_MAX + 1);
-    size_t    amount    = (count + 1) * sizeof(uint16_t);
-    char     *allocated = (char*)CALLOCATE(amount, sizeof(char));
-    char     *encoded   = allocated + 1; // Intentionally misaligned.
-    char     *target    = encoded;
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_encode_bigend_u16((uint16_t)ints[i], &target);
-        target += sizeof(uint16_t);
-    }
-    target = encoded;
-    for (size_t i = 0; i < count; i++) {
-        uint16_t got = NumUtil_decode_bigend_u16(target);
-        TEST_INT_EQ(runner, got, (long)ints[i], "bigend u16");
-        target += sizeof(uint16_t);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_u16(1, &target);
-    TEST_INT_EQ(runner, encoded[0], 0, "Truly big-endian u16");
-    TEST_INT_EQ(runner, encoded[1], 1, "Truly big-endian u16");
-
-    FREEMEM(allocated);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_u32(TestBatchRunner *runner) {
-    size_t    count     = 32;
-    uint64_t *ints      = TestUtils_random_u64s(NULL, count, 0, UINT64_C(1) + UINT32_MAX);
-    size_t    amount    = (count + 1) * sizeof(uint32_t);
-    char     *allocated = (char*)CALLOCATE(amount, sizeof(char));
-    char     *encoded   = allocated + 1; // Intentionally misaligned.
-    char     *target    = encoded;
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_encode_bigend_u32((uint32_t)ints[i], &target);
-        target += sizeof(uint32_t);
-    }
-    target = encoded;
-    for (size_t i = 0; i < count; i++) {
-        uint32_t got = NumUtil_decode_bigend_u32(target);
-        TEST_INT_EQ(runner, got, (long)ints[i], "bigend u32");
-        target += sizeof(uint32_t);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_u32(1, &target);
-    TEST_INT_EQ(runner, encoded[0], 0, "Truly big-endian u32");
-    TEST_INT_EQ(runner, encoded[3], 1, "Truly big-endian u32");
-
-    FREEMEM(allocated);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_u64(TestBatchRunner *runner) {
-    size_t    count     = 32;
-    uint64_t *ints      = TestUtils_random_u64s(NULL, count, 0, UINT64_MAX);
-    size_t    amount    = (count + 1) * sizeof(uint64_t);
-    char     *allocated = (char*)CALLOCATE(amount, sizeof(char));
-    char     *encoded   = allocated + 1; // Intentionally misaligned.
-    char     *target    = encoded;
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_encode_bigend_u64(ints[i], &target);
-        target += sizeof(uint64_t);
-    }
-    target = encoded;
-    for (size_t i = 0; i < count; i++) {
-        uint64_t got = NumUtil_decode_bigend_u64(target);
-        TEST_TRUE(runner, got == ints[i], "bigend u64");
-        target += sizeof(uint64_t);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_u64(1, &target);
-    TEST_INT_EQ(runner, encoded[0], 0, "Truly big-endian");
-    TEST_INT_EQ(runner, encoded[7], 1, "Truly big-endian");
-
-    FREEMEM(allocated);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_f32(TestBatchRunner *runner) {
-    float    source[]  = { -1.3f, 0.0f, 100.2f };
-    size_t   count     = 3;
-    size_t   amount    = (count + 1) * sizeof(float);
-    uint8_t *allocated = (uint8_t*)CALLOCATE(amount, sizeof(uint8_t));
-    uint8_t *encoded   = allocated + 1; // Intentionally misaligned.
-    uint8_t *target    = encoded;
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_encode_bigend_f32(source[i], &target);
-        target += sizeof(float);
-    }
-    target = encoded;
-    for (size_t i = 0; i < count; i++) {
-        float got = NumUtil_decode_bigend_f32(target);
-        TEST_TRUE(runner, got == source[i], "bigend f32");
-        target += sizeof(float);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_f32(-2.0f, &target);
-    TEST_INT_EQ(runner, (encoded[0] & 0x80), 0x80,
-                "Truly big-endian (IEEE 754 sign bit set for negative number)");
-    TEST_INT_EQ(runner, encoded[0], 0xC0,
-                "IEEE 754 representation of -2.0f, byte 0");
-    for (size_t i = 1; i < sizeof(float); i++) {
-        TEST_INT_EQ(runner, encoded[i], 0,
-                    "IEEE 754 representation of -2.0f, byte %d", (int)i);
-    }
-
-    FREEMEM(allocated);
-}
-
-static void
-test_bigend_f64(TestBatchRunner *runner) {
-    double   source[]  = { -1.3, 0.0, 100.2 };
-    size_t   count     = 3;
-    size_t   amount    = (count + 1) * sizeof(double);
-    uint8_t *allocated = (uint8_t*)CALLOCATE(amount, sizeof(uint8_t));
-    uint8_t *encoded   = allocated + 1; // Intentionally misaligned.
-    uint8_t *target    = encoded;
-
-    for (size_t i = 0; i < count; i++) {
-        NumUtil_encode_bigend_f64(source[i], &target);
-        target += sizeof(double);
-    }
-    target = encoded;
-    for (size_t i = 0; i < count; i++) {
-        double got = NumUtil_decode_bigend_f64(target);
-        TEST_TRUE(runner, got == source[i], "bigend f64");
-        target += sizeof(double);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_f64(-2.0, &target);
-    TEST_INT_EQ(runner, (encoded[0] & 0x80), 0x80,
-                "Truly big-endian (IEEE 754 sign bit set for negative number)");
-    TEST_INT_EQ(runner, encoded[0], 0xC0,
-                "IEEE 754 representation of -2.0, byte 0");
-    for (size_t i = 1; i < sizeof(double); i++) {
-        TEST_INT_EQ(runner, encoded[i], 0,
-                    "IEEE 754 representation of -2.0, byte %d", (int)i);
-    }
-
-    FREEMEM(allocated);
-}
-
-void
-TestNumUtil_Run_IMP(TestNumberUtils *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 1196);
-    srand((unsigned int)time((time_t*)NULL));
-    test_u1(runner);
-    test_u2(runner);
-    test_u4(runner);
-    test_c32(runner);
-    test_c64(runner);
-    test_bigend_u16(runner);
-    test_bigend_u32(runner);
-    test_bigend_u64(runner);
-    test_bigend_f32(runner);
-    test_bigend_f64(runner);
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.cfh b/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.cfh
deleted file mode 100644
index cd9e165..0000000
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.cfh
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel TestClownfish;
-
-class Clownfish::Test::Util::TestNumberUtils cnick TestNumUtil
-    inherits Clownfish::TestHarness::TestBatch {
-
-    inert incremented TestNumberUtils*
-    new();
-
-    void
-    Run(TestNumberUtils *self, TestBatchRunner *runner);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
deleted file mode 100644
index 339de02..0000000
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string.h>
-
-#define CFISH_USE_SHORT_NAMES
-#define TESTCFISH_USE_SHORT_NAMES
-
-#include "Clownfish/Test/Util/TestStringHelper.h"
-
-#include "Clownfish/String.h"
-#include "Clownfish/Err.h"
-#include "Clownfish/Test.h"
-#include "Clownfish/TestHarness/TestBatchRunner.h"
-#include "Clownfish/Util/StringHelper.h"
-#include "Clownfish/VTable.h"
-
-/* This alternative implementation of utf8_valid() is (presumably) slower, but
- * it implements the standard in a more linear, easy-to-grok way.
- */
-#define TRAIL_OK(n) (n >= 0x80 && n <= 0xBF)
-TestStringHelper*
-TestStrHelp_new() {
-    return (TestStringHelper*)VTable_Make_Obj(TESTSTRINGHELPER);
-}
-
-static bool
-S_utf8_valid_alt(const char *maybe_utf8, size_t size) {
-    const uint8_t *string = (const uint8_t*)maybe_utf8;
-    const uint8_t *const end = string + size;
-    while (string < end) {
-        int count = StrHelp_UTF8_COUNT[*string];
-        bool valid = false;
-        if (count == 1) {
-            if (string[0] <= 0x7F) {
-                valid = true;
-            }
-        }
-        else if (count == 2) {
-            if (string[0] >= 0xC2 && string[0] <= 0xDF) {
-                if (TRAIL_OK(string[1])) {
-                    valid = true;
-                }
-            }
-        }
-        else if (count == 3) {
-            if (string[0] == 0xE0) {
-                if (string[1] >= 0xA0 && string[1] <= 0xBF
-                    && TRAIL_OK(string[2])
-                   ) {
-                    valid = true;
-                }
-            }
-            else if (string[0] >= 0xE1 && string[0] <= 0xEC) {
-                if (TRAIL_OK(string[1])
-                    && TRAIL_OK(string[2])
-                   ) {
-                    valid = true;
-                }
-            }
-            else if (string[0] == 0xED) {
-                if (string[1] >= 0x80 && string[1] <= 0x9F
-                    && TRAIL_OK(string[2])
-                   ) {
-                    valid = true;
-                }
-            }
-            else if (string[0] >= 0xEE && string[0] <= 0xEF) {
-                if (TRAIL_OK(string[1])
-                    && TRAIL_OK(string[2])
-                   ) {
-                    valid = true;
-                }
-            }
-        }
-        else if (count == 4) {
-            if (string[0] == 0xF0) {
-                if (string[1] >= 0x90 && string[1] <= 0xBF
-                    && TRAIL_OK(string[2])
-                    && TRAIL_OK(string[3])
-                   ) {
-                    valid = true;
-                }
-            }
-            else if (string[0] >= 0xF1 && string[0] <= 0xF3) {
-                if (TRAIL_OK(string[1])
-                    && TRAIL_OK(string[2])
-                    && TRAIL_OK(string[3])
-                   ) {
-                    valid = true;
-                }
-            }
-            else if (string[0] == 0xF4) {
-                if (string[1] >= 0x80 && string[1] <= 0x8F
-                    && TRAIL_OK(string[2])
-                    && TRAIL_OK(string[3])
-                   ) {
-                    valid = true;
-                }
-            }
-        }
-
-        if (!valid) {
-            return false;
-        }
-        string += count;
-    }
-
-    if (string != end) {
-        return false;
-    }
-
-    return true;
-}
-
-static void
-test_overlap(TestBatchRunner *runner) {
-    int32_t result;
-    result = StrHelp_overlap("", "", 0, 0);
-    TEST_INT_EQ(runner, result, 0, "two empty strings");
-    result = StrHelp_overlap("", "foo", 0, 3);
-    TEST_INT_EQ(runner, result, 0, "first string is empty");
-    result = StrHelp_overlap("foo", "", 3, 0);
-    TEST_INT_EQ(runner, result, 0, "second string is empty");
-    result = StrHelp_overlap("foo", "foo", 3, 3);
-    TEST_INT_EQ(runner, result, 3, "equal strings");
-    result = StrHelp_overlap("foo bar", "foo", 7, 3);
-    TEST_INT_EQ(runner, result, 3, "first string is longer");
-    result = StrHelp_overlap("foo", "foo bar", 3, 7);
-    TEST_INT_EQ(runner, result, 3, "second string is longer");
-}
-
-
-static void
-test_to_base36(TestBatchRunner *runner) {
-    char buffer[StrHelp_MAX_BASE36_BYTES];
-    StrHelp_to_base36(UINT64_MAX, buffer);
-    TEST_STR_EQ(runner, "3w5e11264sgsf", buffer, "base36 UINT64_MAX");
-    StrHelp_to_base36(1, buffer);
-    TEST_STR_EQ(runner, "1", buffer, "base36 1");
-    TEST_INT_EQ(runner, buffer[1], 0, "base36 NULL termination");
-}
-
-static void
-test_utf8_round_trip(TestBatchRunner *runner) {
-    int32_t code_point;
-    for (code_point = 0; code_point <= 0x10FFFF; code_point++) {
-        char buffer[4];
-        uint32_t size = StrHelp_encode_utf8_char(code_point, buffer);
-        char *start = buffer;
-        char *end   = start + size;
-
-        // Verify length returned by encode_utf8_char().
-        if (size != StrHelp_UTF8_COUNT[(unsigned char)buffer[0]]) {
-            break;
-        }
-        // Verify that utf8_valid() agrees with alternate implementation.
-        if (!!StrHelp_utf8_valid(start, size)
-            != !!S_utf8_valid_alt(start, size)
-           ) {
-            break;
-        }
-
-        // Verify back_utf8_char().
-        if (StrHelp_back_utf8_char(end, start) != start) {
-            break;
-        }
-
-        // Verify round trip of encode/decode.
-        if (StrHelp_decode_utf8_char(buffer) != code_point) {
-            break;
-        }
-    }
-    if (code_point == 0x110000) {
-        PASS(runner, "Successfully round tripped 0 - 0x10FFFF");
-    }
-    else {
-        FAIL(runner, "Failed round trip at 0x%.1X", (unsigned)code_point);
-    }
-}
-
-static void
-S_test_validity(TestBatchRunner *runner, const char *content, size_t size,
-                bool expected, const char *description) {
-    bool sane = StrHelp_utf8_valid(content, size);
-    bool double_check = S_utf8_valid_alt(content, size);
-    if (sane != double_check) {
-        FAIL(runner, "Disagreement: %s", description);
-    }
-    else {
-        TEST_TRUE(runner, sane == expected, "%s", description);
-    }
-}
-
-static void
-test_utf8_valid(TestBatchRunner *runner) {
-    // Musical symbol G clef:
-    // Code point: U+1D11E
-    // UTF-16:     0xD834 0xDD1E
-    // UTF-8       0xF0 0x9D 0x84 0x9E
-    S_test_validity(runner, "\xF0\x9D\x84\x9E", 4, true,
-                    "Musical symbol G clef");
-    S_test_validity(runner, "\xED\xA0\xB4\xED\xB4\x9E", 6, false,
-                    "G clef as UTF-8 encoded UTF-16 surrogates");
-    S_test_validity(runner, ".\xED\xA0\xB4.", 5, false,
-                    "Isolated high surrogate");
-    S_test_validity(runner, ".\xED\xB4\x9E.", 5, false,
-                    "Isolated low surrogate");
-
-    // Shortest form.
-    S_test_validity(runner, ".\xC1\x9C.", 4, false,
-                    "Non-shortest form ASCII backslash");
-    S_test_validity(runner, ".\xC0\xAF.", 4, false,
-                    "Non-shortest form ASCII slash");
-    S_test_validity(runner, ".\xC0\x80.", 4, false,
-                    "Non-shortest form ASCII NUL character");
-
-    // Range.
-    S_test_validity(runner, "\xF8\x88\x80\x80\x80", 5, false, "5-byte UTF-8");
-
-    // Bad continuations.
-    S_test_validity(runner, "\xE2\x98\xBA\xE2\x98\xBA", 6, true,
-                    "SmileySmiley");
-    S_test_validity(runner, "\xE2\xBA\xE2\x98\xBA", 5, false,
-                    "missing first continuation byte");
-    S_test_validity(runner, "\xE2\x98\xE2\x98\xBA", 5, false,
-                    "missing second continuation byte");
-    S_test_validity(runner, "\xE2\xE2\x98\xBA", 4, false,
-                    "missing both continuation bytes");
-    S_test_validity(runner, "\xBA\xE2\x98\xBA\xE2\xBA", 5, false,
-                    "missing first continuation byte (end)");
-    S_test_validity(runner, "\xE2\x98\xBA\xE2\x98", 5, false,
-                    "missing second continuation byte (end)");
-    S_test_validity(runner, "\xE2\x98\xBA\xE2", 4, false,
-                    "missing both continuation bytes (end)");
-    S_test_validity(runner, "\xBA\xE2\x98\xBA", 4, false,
-                    "isolated continuation byte 0xBA");
-    S_test_validity(runner, "\x98\xE2\x98\xBA", 4, false,
-                    "isolated continuation byte 0x98");
-    S_test_validity(runner, "\xE2\x98\xBA\xBA", 4, false,
-                    "isolated continuation byte 0xBA (end)");
-    S_test_validity(runner, "\xE2\x98\xBA\x98", 4, false,
-                    "isolated continuation byte 0x98 (end)");
-}
-
-static void
-test_is_whitespace(TestBatchRunner *runner) {
-    TEST_TRUE(runner, StrHelp_is_whitespace(' '), "space is whitespace");
-    TEST_TRUE(runner, StrHelp_is_whitespace('\n'), "newline is whitespace");
-    TEST_TRUE(runner, StrHelp_is_whitespace('\t'), "tab is whitespace");
-    TEST_TRUE(runner, StrHelp_is_whitespace('\v'),
-              "vertical tab is whitespace");
-    TEST_TRUE(runner, StrHelp_is_whitespace(0x180E),
-              "Mongolian vowel separator is whitespace");
-    TEST_FALSE(runner, StrHelp_is_whitespace('a'), "'a' isn't whitespace");
-    TEST_FALSE(runner, StrHelp_is_whitespace(0), "NULL isn't whitespace");
-    TEST_FALSE(runner, StrHelp_is_whitespace(0x263A),
-               "Smiley isn't whitespace");
-}
-
-static void
-test_back_utf8_char(TestBatchRunner *runner) {
-    char buffer[4];
-    char *buf = buffer + 1;
-    uint32_t len = StrHelp_encode_utf8_char(0x263A, buffer);
-    char *end = buffer + len;
-    TEST_TRUE(runner, StrHelp_back_utf8_char(end, buffer) == buffer,
-              "back_utf8_char");
-    TEST_TRUE(runner, StrHelp_back_utf8_char(end, buf) == NULL,
-              "back_utf8_char returns NULL rather than back up beyond start");
-    TEST_TRUE(runner, StrHelp_back_utf8_char(buffer, buffer) == NULL,
-              "back_utf8_char returns NULL when end == start");
-}
-
-void
-TestStrHelp_Run_IMP(TestStringHelper *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 40);
-    test_overlap(runner);
-    test_to_base36(runner);
-    test_utf8_round_trip(runner);
-    test_utf8_valid(runner);
-    test_is_whitespace(runner);
-    test_back_utf8_char(runner);
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.cfh b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.cfh
deleted file mode 100644
index 0f8351a..0000000
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.cfh
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel TestClownfish;
-
-class Clownfish::Test::Util::TestStringHelper cnick TestStrHelp
-    inherits Clownfish::TestHarness::TestBatch {
-
-    inert incremented TestStringHelper*
-    new();
-
-    void
-    Run(TestStringHelper *self, TestBatchRunner *runner);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestBatch.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestBatch.cfh b/clownfish/runtime/core/Clownfish/TestHarness/TestBatch.cfh
deleted file mode 100644
index 21b1117..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestBatch.cfh
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-/** Abstract base class for test modules.
- */
-abstract class Clownfish::TestHarness::TestBatch inherits Clownfish::Obj {
-    /** Run the tests of the test batch.
-     */
-    abstract void
-    Run(TestBatch *self, TestBatchRunner *runner);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c b/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
deleted file mode 100644
index 72cebf2..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-#define C_CFISH_TESTBATCHRUNNER
-#define CFISH_USE_SHORT_NAMES
-
-#include "Clownfish/TestHarness/TestBatchRunner.h"
-
-#include "Clownfish/String.h"
-#include "Clownfish/Err.h"
-#include "Clownfish/TestHarness/TestBatch.h"
-#include "Clownfish/TestHarness/TestFormatter.h"
-#include "Clownfish/VArray.h"
-#include "Clownfish/VTable.h"
-
-struct try_run_tests_context {
-    TestBatchRunner *runner;
-    TestBatch       *batch;
-};
-
-static void
-S_try_run_tests(void *context);
-
-static bool
-S_vtest_true(TestBatchRunner *self, bool condition, const char *pattern,
-             va_list args);
-
-TestBatchRunner*
-TestBatchRunner_new(TestFormatter *formatter) {
-    TestBatchRunner *self = (TestBatchRunner*)VTable_Make_Obj(TESTBATCHRUNNER);
-    return TestBatchRunner_init(self, formatter);
-}
-
-TestBatchRunner*
-TestBatchRunner_init(TestBatchRunner *self, TestFormatter *formatter) {
-    // Assign.
-    self->formatter   = (TestFormatter*)INCREF(formatter);
-
-    // Initialize.
-    self->num_planned = 0;
-    self->test_num    = 0;
-    self->num_passed  = 0;
-    self->num_failed  = 0;
-    self->num_skipped = 0;
-
-    return self;
-}
-
-void
-TestBatchRunner_Destroy_IMP(TestBatchRunner *self) {
-    DECREF(self->formatter);
-    SUPER_DESTROY(self, TESTBATCHRUNNER);
-}
-
-bool
-TestBatchRunner_Run_Batch_IMP(TestBatchRunner *self, TestBatch *batch) {
-    struct try_run_tests_context args;
-    args.runner = self;
-    args.batch  = batch;
-    Err *err = Err_trap(S_try_run_tests, &args);
-
-    bool failed = false;
-    if (err) {
-        failed = true;
-        String *mess = Err_Get_Mess(err);
-        Err_warn_mess((String*)INCREF(mess));
-    }
-    if (self->num_failed > 0) {
-        failed = true;
-        TestFormatter_batch_comment(self->formatter, "%d/%d tests failed.\n",
-                                    self->num_failed, self->test_num);
-    }
-    if (self->test_num != self->num_planned) {
-        failed = true;
-        TestFormatter_batch_comment(self->formatter,
-                                    "Bad plan: You planned %d tests but ran"
-                                    " %d.\n",
-                                    self->num_planned, self->test_num);
-    }
-
-    return !failed;
-}
-
-static void
-S_try_run_tests(void *context) {
-    struct try_run_tests_context *args
-        = (struct try_run_tests_context*)context;
-    TestBatch_Run(args->batch, args->runner);
-}
-
-void
-TestBatchRunner_Plan_IMP(TestBatchRunner *self, TestBatch *batch,
-                         uint32_t num_planned) {
-    self->num_planned = num_planned;
-    TestFormatter_Batch_Prologue(self->formatter, batch, num_planned);
-}
-
-uint32_t
-TestBatchRunner_Get_Num_Planned_IMP(TestBatchRunner *self) {
-    return self->num_planned;
-}
-
-uint32_t
-TestBatchRunner_Get_Num_Tests_IMP(TestBatchRunner *self) {
-    return self->test_num;
-}
-
-uint32_t
-TestBatchRunner_Get_Num_Failed_IMP(TestBatchRunner *self) {
-    return self->num_failed;
-}
-
-bool
-TestBatchRunner_test_true(TestBatchRunner *self, bool condition,
-                          const char *pattern, ...) {
-    va_list args;
-    va_start(args, pattern);
-    bool result = TestBatchRunner_VTest_True(self, condition, pattern, args);
-    va_end(args);
-    return result;
-}
-
-bool
-TestBatchRunner_test_false(TestBatchRunner *self, bool condition,
-                           const char *pattern, ...) {
-    va_list args;
-    va_start(args, pattern);
-    bool result = TestBatchRunner_VTest_False(self, condition, pattern, args);
-    va_end(args);
-    return result;
-}
-
-bool
-TestBatchRunner_test_int_equals(TestBatchRunner *self, long got, long expected,
-                                const char *pattern, ...) {
-    va_list args;
-    va_start(args, pattern);
-    bool result = TestBatchRunner_VTest_Int_Equals(self, got, expected,
-                                                   pattern, args);
-    va_end(args);
-    return result;
-}
-
-bool
-TestBatchRunner_test_float_equals(TestBatchRunner *self, double got,
-                                  double expected, const char *pattern, ...) {
-    va_list args;
-    va_start(args, pattern);
-    bool result = TestBatchRunner_VTest_Float_Equals(self, got, expected,
-                                                     pattern, args);
-    va_end(args);
-    return result;
-}
-
-bool
-TestBatchRunner_test_string_equals(TestBatchRunner *self, const char *got,
-                                   const char *expected, const char *pattern,
-                                   ...) {
-    va_list args;
-    va_start(args, pattern);
-    bool result = TestBatchRunner_VTest_String_Equals(self, got, expected,
-                                                      pattern, args);
-    va_end(args);
-    return result;
-}
-
-bool
-TestBatchRunner_pass(TestBatchRunner *self, const char *pattern, ...) {
-    va_list args;
-    va_start(args, pattern);
-    bool result = TestBatchRunner_VPass(self, pattern, args);
-    va_end(args);
-    return result;
-}
-
-bool
-TestBatchRunner_fail(TestBatchRunner *self, const char *pattern, ...) {
-    va_list args;
-    va_start(args, pattern);
-    bool result = TestBatchRunner_VFail(self, pattern, args);
-    va_end(args);
-    return result;
-}
-
-void
-TestBatchRunner_skip(TestBatchRunner *self, const char *pattern, ...) {
-    va_list args;
-    va_start(args, pattern);
-    TestBatchRunner_VSkip(self, pattern, args);
-    va_end(args);
-}
-
-bool
-TestBatchRunner_VTest_True_IMP(TestBatchRunner *self, bool condition,
-                               const char *pattern, va_list args) {
-    return S_vtest_true(self, condition, pattern, args);
-}
-
-bool
-TestBatchRunner_VTest_False_IMP(TestBatchRunner *self, bool condition,
-                                const char *pattern, va_list args) {
-    return S_vtest_true(self, !condition, pattern, args);
-}
-
-bool
-TestBatchRunner_VTest_Int_Equals_IMP(TestBatchRunner *self, long got,
-                                     long expected, const char *pattern,
-                                     va_list args) {
-    bool pass = (got == expected);
-    S_vtest_true(self, pass, pattern, args);
-    if (!pass) {
-        TestFormatter_test_comment(self->formatter,
-                                   "Expected '%ld', got '%ld'.\n",
-                                   expected, got);
-    }
-    return pass;
-}
-
-bool
-TestBatchRunner_VTest_Float_Equals_IMP(TestBatchRunner *self, double got,
-                                       double expected, const char *pattern,
-                                       va_list args) {
-    double relative_error = got / expected - 1.0;
-    bool   pass           = (fabs(relative_error) < 1e-6);
-    S_vtest_true(self, pass, pattern, args);
-    if (!pass) {
-        TestFormatter_test_comment(self->formatter,
-                                   "Expected '%e', got '%e'.\n",
-                                   expected, got);
-    }
-    return pass;
-}
-
-bool
-TestBatchRunner_VTest_String_Equals_IMP(TestBatchRunner *self, const char *got,
-                                        const char *expected,
-                                        const char *pattern, va_list args) {
-    bool pass = (strcmp(got, expected) == 0);
-    S_vtest_true(self, pass, pattern, args);
-    if (!pass) {
-        TestFormatter_test_comment(self->formatter,
-                                   "Expected '%s', got '%s'.\n",
-                                   expected, got);
-    }
-    return pass;
-}
-
-bool
-TestBatchRunner_VPass_IMP(TestBatchRunner *self, const char *pattern,
-                          va_list args) {
-    return S_vtest_true(self, true, pattern, args);
-}
-
-bool
-TestBatchRunner_VFail_IMP(TestBatchRunner *self, const char *pattern,
-                          va_list args) {
-    return S_vtest_true(self, false, pattern, args);
-}
-
-void
-TestBatchRunner_VSkip_IMP(TestBatchRunner *self, const char *pattern,
-                          va_list args) {
-    self->test_num++;
-    // TODO: Add a VTest_Skip method to TestFormatter
-    TestFormatter_VTest_Result(self->formatter, true, self->test_num,
-                               pattern, args);
-    self->num_skipped++;
-}
-
-static bool
-S_vtest_true(TestBatchRunner* self, bool condition, const char *pattern,
-             va_list args) {
-    // Increment test number.
-    self->test_num++;
-
-    if (condition) {
-        self->num_passed++;
-    }
-    else {
-        self->num_failed++;
-    }
-
-    TestFormatter_VTest_Result(self->formatter, condition, self->test_num,
-                               pattern, args);
-
-    return condition;
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh b/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
deleted file mode 100644
index cde51f7..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-/** Run a single test batch and collect statistics.
- */
-class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj {
-    TestFormatter *formatter;
-    uint32_t       test_num;
-    uint32_t       num_planned;
-    uint32_t       num_passed;
-    uint32_t       num_failed;
-    uint32_t       num_skipped;
-
-    inert incremented TestBatchRunner*
-    new(TestFormatter *formatter);
-
-    inert TestBatchRunner*
-    init(TestBatchRunner *self, TestFormatter *formatter);
-
-    public void
-    Destroy(TestBatchRunner *self);
-
-    /** Run the test batch and print test output and diagnosis.
-     *
-     * @return true if the test batch passed.
-     */
-    bool
-    Run_Batch(TestBatchRunner *self, TestBatch *batch);
-
-    void
-    Plan(TestBatchRunner *self, TestBatch *batch, uint32_t num_planned);
-
-    /** Return the number of tests planned.
-     */
-    uint32_t
-    Get_Num_Planned(TestBatchRunner *self);
-
-    /** Return the number of tests run.
-     */
-    uint32_t
-    Get_Num_Tests(TestBatchRunner *self);
-
-    /** Return the number of failed tests.
-     */
-    uint32_t
-    Get_Num_Failed(TestBatchRunner *self);
-
-    inert bool
-    test_true(TestBatchRunner *self, bool condition, const char *pattern, ...);
-
-    inert bool
-    test_false(TestBatchRunner *self, bool condition, const char *pattern,
-               ...);
-
-    inert bool
-    test_int_equals(TestBatchRunner *self, long got, long expected,
-                    const char *pattern, ...);
-
-    inert bool
-    test_float_equals(TestBatchRunner *self, double got, double expected,
-                      const char *pattern, ...);
-
-    inert bool
-    test_string_equals(TestBatchRunner *self, const char *got,
-                       const char *expected, const char *pattern, ...);
-
-    inert bool
-    pass(TestBatchRunner *self, const char *pattern, ...);
-
-    inert bool
-    fail(TestBatchRunner *self, const char *pattern, ...);
-
-    inert void
-    skip(TestBatchRunner *self, const char *pattern, ...);
-
-    bool
-    VTest_True(TestBatchRunner *self, bool condition, const char *pattern,
-               va_list args);
-
-    bool
-    VTest_False(TestBatchRunner *self, bool condition, const char *pattern,
-                va_list args);
-
-    bool
-    VTest_Int_Equals(TestBatchRunner *self, long got, long expected,
-                     const char *pattern, va_list args);
-
-    bool
-    VTest_Float_Equals(TestBatchRunner *self, double got, double expected,
-                       const char *pattern, va_list args);
-
-    bool
-    VTest_String_Equals(TestBatchRunner *self, const char *got,
-                        const char *expected, const char *pattern,
-                        va_list args);
-
-    bool
-    VPass(TestBatchRunner *self, const char *pattern, va_list args);
-
-    bool
-    VFail(TestBatchRunner *self, const char *pattern, va_list args);
-
-    void
-    VSkip(TestBatchRunner *self, const char *pattern, va_list args);
-}
-
-__C__
-#ifdef CFISH_USE_SHORT_NAMES
-  #define TEST_TRUE            cfish_TestBatchRunner_test_true
-  #define TEST_FALSE           cfish_TestBatchRunner_test_false
-  #define TEST_INT_EQ          cfish_TestBatchRunner_test_int_equals
-  #define TEST_FLOAT_EQ        cfish_TestBatchRunner_test_float_equals
-  #define TEST_STR_EQ          cfish_TestBatchRunner_test_string_equals
-  #define PASS                 cfish_TestBatchRunner_pass
-  #define FAIL                 cfish_TestBatchRunner_fail
-  #define SKIP                 cfish_TestBatchRunner_skip
-#endif
-__END_C__
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c b/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c
deleted file mode 100644
index c5016be..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-
-#define C_CFISH_TESTFORMATTER
-#define CFISH_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include "Clownfish/TestHarness/TestFormatter.h"
-
-#include "Clownfish/String.h"
-#include "Clownfish/Err.h"
-#include "Clownfish/TestHarness/TestBatch.h"
-#include "Clownfish/TestHarness/TestSuiteRunner.h"
-#include "Clownfish/Util/Memory.h"
-#include "Clownfish/VTable.h"
-
-TestFormatter*
-TestFormatter_init(TestFormatter *self) {
-    ABSTRACT_CLASS_CHECK(self, TESTFORMATTER);
-    return self;
-}
-
-void
-TestFormatter_test_result(TestFormatter *self, bool pass, uint32_t test_num,
-                          const char *fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    TestFormatter_VTest_Result(self, pass, test_num, fmt, args);
-    va_end(args);
-}
-
-void
-TestFormatter_test_comment(TestFormatter *self, const char *fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    TestFormatter_VTest_Comment(self, fmt, args);
-    va_end(args);
-}
-
-void
-TestFormatter_batch_comment(TestFormatter *self, const char *fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    TestFormatter_VBatch_Comment(self, fmt, args);
-    va_end(args);
-}
-
-TestFormatterCF*
-TestFormatterCF_new() {
-    TestFormatterCF *self
-        = (TestFormatterCF*)VTable_Make_Obj(TESTFORMATTERCF);
-    return TestFormatterCF_init(self);
-}
-
-TestFormatterCF*
-TestFormatterCF_init(TestFormatterCF *self) {
-    return (TestFormatterCF*)TestFormatter_init((TestFormatter*)self);
-}
-
-void
-TestFormatterCF_Batch_Prologue_IMP(TestFormatterCF *self, TestBatch *batch,
-                                   uint32_t num_planned) {
-    UNUSED_VAR(self);
-    UNUSED_VAR(num_planned);
-    String *class_name = TestBatch_Get_Class_Name(batch);
-    char *utf8 = Str_To_Utf8(class_name);
-    printf("Running %s...\n", utf8);
-    FREEMEM(utf8);
-}
-
-void
-TestFormatterCF_VTest_Result_IMP(TestFormatterCF *self, bool pass,
-                                 uint32_t test_num, const char *fmt,
-                                 va_list args) {
-    UNUSED_VAR(self);
-    if (!pass) {
-        printf("  Failed test %u: ", test_num);
-        vprintf(fmt, args);
-        printf("\n");
-    }
-}
-
-void
-TestFormatterCF_VTest_Comment_IMP(TestFormatterCF *self, const char *fmt,
-                                  va_list args) {
-    UNUSED_VAR(self);
-    printf("    ");
-    vprintf(fmt, args);
-}
-
-void
-TestFormatterCF_VBatch_Comment_IMP(TestFormatterCF *self, const char *fmt,
-                                   va_list args) {
-    UNUSED_VAR(self);
-    printf("  ");
-    vprintf(fmt, args);
-}
-
-void
-TestFormatterCF_Summary_IMP(TestFormatterCF *self, TestSuiteRunner *runner) {
-    UNUSED_VAR(self);
-    uint32_t num_batches = TestSuiteRunner_Get_Num_Batches(runner);
-    uint32_t num_batches_failed
-        = TestSuiteRunner_Get_Num_Batches_Failed(runner);
-    uint32_t num_tests = TestSuiteRunner_Get_Num_Tests(runner);
-    uint32_t num_tests_failed = TestSuiteRunner_Get_Num_Tests_Failed(runner);
-
-    if (num_batches == 0) {
-        printf("No tests planned or run.\n");
-    }
-    else if (num_batches_failed == 0) {
-        printf("%u batches passed. %u tests passed.\n", num_batches,
-               num_tests);
-        printf("Result: PASS\n");
-    }
-    else {
-        printf("%u/%u batches failed. %u/%u tests failed.\n",
-               num_batches_failed, num_batches, num_tests_failed, num_tests);
-        printf("Result: FAIL\n");
-    }
-}
-
-TestFormatterTAP*
-TestFormatterTAP_new() {
-    TestFormatterTAP *self
-        = (TestFormatterTAP*)VTable_Make_Obj(TESTFORMATTERTAP);
-    return TestFormatterTAP_init(self);
-}
-
-TestFormatterTAP*
-TestFormatterTAP_init(TestFormatterTAP *self) {
-    return (TestFormatterTAP*)TestFormatter_init((TestFormatter*)self);
-}
-
-void
-TestFormatterTAP_Batch_Prologue_IMP(TestFormatterTAP *self, TestBatch *batch,
-                                uint32_t num_planned) {
-    UNUSED_VAR(self);
-    UNUSED_VAR(batch);
-    printf("1..%u\n", num_planned);
-}
-
-void
-TestFormatterTAP_VTest_Result_IMP(TestFormatterTAP *self, bool pass,
-                                  uint32_t test_num, const char *fmt,
-                                  va_list args) {
-    UNUSED_VAR(self);
-    const char *result = pass ? "ok" : "not ok";
-    printf("%s %u - ", result, test_num);
-    vprintf(fmt, args);
-    printf("\n");
-}
-
-void
-TestFormatterTAP_VTest_Comment_IMP(TestFormatterTAP *self, const char *fmt,
-                                   va_list args) {
-    UNUSED_VAR(self);
-    printf("#   ");
-    vprintf(fmt, args);
-}
-
-void
-TestFormatterTAP_VBatch_Comment_IMP(TestFormatterTAP *self, const char *fmt,
-                                    va_list args) {
-    UNUSED_VAR(self);
-    printf("# ");
-    vprintf(fmt, args);
-}
-
-void
-TestFormatterTAP_Summary_IMP(TestFormatterTAP *self, TestSuiteRunner *runner) {
-    UNUSED_VAR(self);
-    UNUSED_VAR(runner);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.cfh b/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.cfh
deleted file mode 100644
index 92ca911..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.cfh
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-/** Abstract base class for Clownfish test formatters.
- */
-abstract class Clownfish::TestHarness::TestFormatter inherits Clownfish::Obj {
-    inert TestFormatter*
-    init(TestFormatter *self);
-
-    inert void
-    test_result(TestFormatter *self, bool pass, uint32_t test_num,
-                const char *fmt, ...);
-
-    inert void
-    test_comment(TestFormatter *self, const char *fmt, ...);
-
-    inert void
-    batch_comment(TestFormatter *self, const char *fmt, ...);
-
-    /** Print output at the beginning of a test batch.
-     *
-     * @param batch The test batch.
-     */
-    abstract void
-    Batch_Prologue(TestFormatter *self, TestBatch *batch,
-                   uint32_t num_planned);
-
-    /** Print the result of a single test.
-     *
-     * @param pass True if the test passed, false otherwise.
-     * @param test_num The sequence number of the test.
-     * @param fmt printf-style format string.
-     * @param args Additional arguments.
-     */
-    abstract void
-    VTest_Result(TestFormatter *self, bool pass, uint32_t test_num,
-                 const char *fmt, va_list args);
-
-    /** Print additional diagnosis for a test.
-     *
-     * @param fmt printf-style format string.
-     * @param args Additional arguments.
-     */
-    abstract void
-    VTest_Comment(TestFormatter *self, const char *fmt, va_list args);
-
-    /** Print additional diagnosis for a test batch.
-     *
-     * @param fmt printf-style format string.
-     * @param args Additional arguments.
-     */
-    abstract void
-    VBatch_Comment(TestFormatter *self, const char *fmt, va_list args);
-
-    /** Print test summary after running all test batches.
-     *
-     * @param runner The test runner.
-     */
-    abstract void
-    Summary(TestFormatter *self, TestSuiteRunner *runner);
-}
-
-/** TestFormatter for "Clownfish" format.
- *
- * A TestFormatter that produces human-readable output in a custom
- * "Clownfish" format.
- */
-class Clownfish::Test::Formatter::TestFormatterCF
-    inherits Clownfish::TestHarness::TestFormatter {
-
-    inert incremented TestFormatterCF*
-    new();
-
-    inert TestFormatterCF*
-    init(TestFormatterCF *self);
-
-    void
-    Batch_Prologue(TestFormatterCF *self, TestBatch *batch,
-                   uint32_t num_planned);
-
-    void
-    VTest_Result(TestFormatterCF *self, bool pass, uint32_t test_num,
-                 const char *fmt, va_list args);
-
-    void
-    VTest_Comment(TestFormatterCF *self, const char *fmt, va_list args);
-
-    void
-    VBatch_Comment(TestFormatterCF *self, const char *fmt, va_list args);
-
-    void
-    Summary(TestFormatterCF *self, TestSuiteRunner *runner);
-}
-
-/** TestFormatter for TAP output.
- *
- * A TestFormatter that produces TAP output (Test Anything Protocol).
- * See http://testanything.org/
- */
-class Clownfish::Test::Formatter::TestFormatterTAP
-    inherits Clownfish::TestHarness::TestFormatter {
-
-    inert incremented TestFormatterTAP*
-    new();
-
-    inert TestFormatterTAP*
-    init(TestFormatterTAP *self);
-
-    void
-    Batch_Prologue(TestFormatterTAP *self, TestBatch *batch,
-                   uint32_t num_planned);
-
-    void
-    VTest_Result(TestFormatterTAP *self, bool pass, uint32_t test_num,
-                 const char *fmt, va_list args);
-
-    void
-    VTest_Comment(TestFormatterTAP *self, const char *fmt, va_list args);
-
-    void
-    VBatch_Comment(TestFormatterTAP *self, const char *fmt, va_list args);
-
-    void
-    Summary(TestFormatterTAP *self, TestSuiteRunner *runner);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.c b/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.c
deleted file mode 100644
index a396b16..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-
-#define C_CFISH_TESTSUITE
-#define CHY_USE_SHORT_NAMES
-#define CFISH_USE_SHORT_NAMES
-#define TESTCFISH_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include "Clownfish/TestHarness/TestSuite.h"
-
-#include "Clownfish/String.h"
-#include "Clownfish/Err.h"
-#include "Clownfish/TestHarness/TestBatch.h"
-#include "Clownfish/TestHarness/TestBatchRunner.h"
-#include "Clownfish/TestHarness/TestFormatter.h"
-#include "Clownfish/TestHarness/TestSuiteRunner.h"
-#include "Clownfish/VArray.h"
-#include "Clownfish/VTable.h"
-
-static void
-S_unbuffer_stdout();
-
-TestSuite*
-TestSuite_new() {
-    TestSuite *self = (TestSuite*)VTable_Make_Obj(TESTSUITE);
-    return TestSuite_init(self);
-}
-
-TestSuite*
-TestSuite_init(TestSuite *self) {
-    self->batches = VA_new(0);
-    return self;
-}
-
-void
-TestSuite_Destroy_IMP(TestSuite *self) {
-    DECREF(self->batches);
-    SUPER_DESTROY(self, TESTSUITE);
-}
-
-void
-TestSuite_Add_Batch_IMP(TestSuite *self, TestBatch *batch) {
-    VA_Push(self->batches, (Obj*)batch);
-}
-
-bool
-TestSuite_Run_Batch_IMP(TestSuite *self, String *class_name,
-                    TestFormatter *formatter) {
-    S_unbuffer_stdout();
-
-    uint32_t size = VA_Get_Size(self->batches);
-
-    for (uint32_t i = 0; i < size; ++i) {
-        TestBatch *batch = (TestBatch*)VA_Fetch(self->batches, i);
-
-        if (Str_Equals(TestBatch_Get_Class_Name(batch), (Obj*)class_name)) {
-            TestBatchRunner *runner = TestBatchRunner_new(formatter);
-            bool result = TestBatchRunner_Run_Batch(runner, batch);
-            DECREF(runner);
-            return result;
-        }
-    }
-
-    THROW(ERR, "Couldn't find test class '%o'", class_name);
-    UNREACHABLE_RETURN(bool);
-}
-
-bool
-TestSuite_Run_All_Batches_IMP(TestSuite *self, TestFormatter *formatter) {
-    S_unbuffer_stdout();
-
-    TestSuiteRunner *runner = TestSuiteRunner_new(formatter);
-    uint32_t size = VA_Get_Size(self->batches);
-
-    for (uint32_t i = 0; i < size; ++i) {
-        TestBatch *batch = (TestBatch*)VA_Fetch(self->batches, i);
-        TestSuiteRunner_Run_Batch(runner, batch);
-    }
-
-    bool result = TestSuiteRunner_Finish(runner);
-
-    DECREF(runner);
-    return result;
-}
-
-static void
-S_unbuffer_stdout() {
-    int check_val = setvbuf(stdout, NULL, _IONBF, 0);
-    if (check_val != 0) {
-        fprintf(stderr, "Failed when trying to unbuffer stdout\n");
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.cfh b/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.cfh
deleted file mode 100644
index 52bfa2c..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestSuite.cfh
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-/** Manage a collection of test batches.
- */
-class Clownfish::TestHarness::TestSuite inherits Clownfish::Obj {
-    VArray *batches;
-
-    inert incremented TestSuite*
-    new();
-
-    inert TestSuite*
-    init(TestSuite *self);
-
-    public void
-    Destroy(TestSuite *self);
-
-    void
-    Add_Batch(TestSuite *self, decremented TestBatch *batch);
-
-    bool
-    Run_Batch(TestSuite *self, String *class_name, TestFormatter *formatter);
-
-    bool
-    Run_All_Batches(TestSuite *self, TestFormatter *formatter);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.c b/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.c
deleted file mode 100644
index 64be5bd..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define C_CFISH_TESTSUITERUNNER
-#define CFISH_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
-
-#include "Clownfish/TestHarness/TestSuiteRunner.h"
-
-#include "Clownfish/Err.h"
-#include "Clownfish/TestHarness/TestBatch.h"
-#include "Clownfish/TestHarness/TestBatchRunner.h"
-#include "Clownfish/TestHarness/TestFormatter.h"
-#include "Clownfish/VTable.h"
-
-TestSuiteRunner*
-TestSuiteRunner_new(TestFormatter *formatter) {
-    TestSuiteRunner *self = (TestSuiteRunner*)VTable_Make_Obj(TESTSUITERUNNER);
-    return TestSuiteRunner_init(self, formatter);
-}
-
-TestSuiteRunner*
-TestSuiteRunner_init(TestSuiteRunner *self, TestFormatter *formatter) {
-    self->formatter          = (TestFormatter*)INCREF(formatter);
-    self->num_tests          = 0;
-    self->num_tests_failed   = 0;
-    self->num_batches        = 0;
-    self->num_batches_failed = 0;
-
-    return self;
-}
-
-void
-TestSuiteRunner_Destroy_IMP(TestSuiteRunner *self) {
-    DECREF(self->formatter);
-    SUPER_DESTROY(self, TESTSUITERUNNER);
-}
-
-bool
-TestSuiteRunner_Run_Batch_IMP(TestSuiteRunner *self, TestBatch *batch) {
-    TestBatchRunner *batch_runner = TestBatchRunner_new(self->formatter);
-    bool success = TestBatchRunner_Run_Batch(batch_runner, batch);
-
-    self->num_tests        += TestBatchRunner_Get_Num_Tests(batch_runner);
-    self->num_tests_failed += TestBatchRunner_Get_Num_Failed(batch_runner);
-    self->num_batches      += 1;
-
-    if (!success) {
-        self->num_batches_failed += 1;
-    }
-
-    DECREF(batch_runner);
-    return success;
-}
-
-bool
-TestSuiteRunner_Finish_IMP(TestSuiteRunner *self) {
-    TestFormatter_Summary(self->formatter, self);
-
-    return self->num_batches != 0 && self->num_batches_failed == 0;
-}
-
-uint32_t
-TestSuiteRunner_Get_Num_Tests_IMP(TestSuiteRunner *self) {
-    return self->num_tests;
-}
-
-uint32_t
-TestSuiteRunner_Get_Num_Tests_Failed_IMP(TestSuiteRunner *self) {
-    return self->num_tests_failed;
-}
-
-uint32_t
-TestSuiteRunner_Get_Num_Batches_IMP(TestSuiteRunner *self) {
-    return self->num_batches;
-}
-
-uint32_t
-TestSuiteRunner_Get_Num_Batches_Failed_IMP(TestSuiteRunner *self) {
-    return self->num_batches_failed;
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.cfh b/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.cfh
deleted file mode 100644
index e9202f1..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestSuiteRunner.cfh
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-/** Run multiple test batches and collect statistics.
- */
-class Clownfish::TestHarness::TestSuiteRunner inherits Clownfish::Obj {
-    TestFormatter *formatter;
-    uint32_t       num_tests;
-    uint32_t       num_tests_failed;
-    uint32_t       num_batches;
-    uint32_t       num_batches_failed;
-
-    inert incremented TestSuiteRunner*
-    new(TestFormatter *formatter);
-
-    /**
-     * @param formatter The test formatter to format the test output.
-     */
-    inert TestSuiteRunner*
-    init(TestSuiteRunner *self, TestFormatter *formatter);
-
-    public void
-    Destroy(TestSuiteRunner *self);
-
-    /** Run a test batch and collect statistics.
-     *
-     * @param batch The test batch.
-     * @return true if the test batch passed.
-     */
-    bool
-    Run_Batch(TestSuiteRunner *self, TestBatch *batch);
-
-    /** Print a summary after running all test batches.
-     *
-     * @return true if any tests were run and all test batches passed.
-     */
-    bool
-    Finish(TestSuiteRunner *self);
-
-    /** Return the number of tests run.
-     */
-    uint32_t
-    Get_Num_Tests(TestSuiteRunner *self);
-
-    /** Return the number of failed tests.
-     */
-    uint32_t
-    Get_Num_Tests_Failed(TestSuiteRunner *self);
-
-    /** Return the number of test batches run.
-     */
-    uint32_t
-    Get_Num_Batches(TestSuiteRunner *self);
-
-    /** Return the number of failed test batches.
-     */
-    uint32_t
-    Get_Num_Batches_Failed(TestSuiteRunner *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
deleted file mode 100644
index 3bf4d12..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#define CHY_USE_SHORT_NAMES
-#define CFISH_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include "Clownfish/TestHarness/TestUtils.h"
-
-#include "Clownfish/CharBuf.h"
-#include "Clownfish/String.h"
-#include "Clownfish/Util/Memory.h"
-
-uint64_t
-TestUtils_random_u64() {
-    uint64_t num = ((uint64_t)(rand()   & 0x7FFF) << 60)
-                   | ((uint64_t)(rand() & 0x7FFF) << 45)
-                   | ((uint64_t)(rand() & 0x7FFF) << 30)
-                   | ((uint64_t)(rand() & 0x7FFF) << 15)
-                   | ((uint64_t)(rand() & 0x7FFF) << 0);
-    return num;
-}
-
-int64_t*
-TestUtils_random_i64s(int64_t *buf, size_t count, int64_t min,
-                      int64_t limit) {
-    uint64_t  range = min < limit ? (uint64_t)limit - (uint64_t)min : 0;
-    int64_t *ints = buf ? buf : (int64_t*)CALLOCATE(count, sizeof(int64_t));
-    for (size_t i = 0; i < count; i++) {
-        ints[i] = min + TestUtils_random_u64() % range;
-    }
-    return ints;
-}
-
-uint64_t*
-TestUtils_random_u64s(uint64_t *buf, size_t count, uint64_t min,
-                      uint64_t limit) {
-    uint64_t  range = min < limit ? limit - min : 0;
-    uint64_t *ints = buf ? buf : (uint64_t*)CALLOCATE(count, sizeof(uint64_t));
-    for (size_t i = 0; i < count; i++) {
-        ints[i] = min + TestUtils_random_u64() % range;
-    }
-    return ints;
-}
-
-double*
-TestUtils_random_f64s(double *buf, size_t count) {
-    double *f64s = buf ? buf : (double*)CALLOCATE(count, sizeof(double));
-    for (size_t i = 0; i < count; i++) {
-        uint64_t num = TestUtils_random_u64();
-        f64s[i] = U64_TO_DOUBLE(num) / UINT64_MAX;
-    }
-    return f64s;
-}
-
-static int32_t
-S_random_code_point(void) {
-    int32_t code_point = 0;
-    while (1) {
-        uint8_t chance = (rand() % 9) + 1;
-        switch (chance) {
-            case 1: case 2: case 3:
-                code_point = rand() % 0x80;
-                break;
-            case 4: case 5: case 6:
-                code_point = (rand() % (0x0800  - 0x0080)) + 0x0080;
-                break;
-            case 7: case 8:
-                code_point = (rand() % (0x10000 - 0x0800)) + 0x0800;
-                break;
-            case 9: {
-                    uint64_t num = TestUtils_random_u64();
-                    code_point = (num % (0x10FFFF - 0x10000)) + 0x10000;
-                }
-        }
-        if (code_point > 0x10FFFF) {
-            continue; // Too high.
-        }
-        if (code_point > 0xD7FF && code_point < 0xE000) {
-            continue; // UTF-16 surrogate.
-        }
-        break;
-    }
-    return code_point;
-}
-
-String*
-TestUtils_random_string(size_t length) {
-    CharBuf *buf = CB_new(length);
-    while (length--) {
-        CB_Cat_Char(buf, S_random_code_point());
-    }
-    String *string = CB_Yield_String(buf);
-    DECREF(buf);
-    return string;
-}
-
-String*
-TestUtils_get_str(const char *ptr) {
-    return Str_new_from_utf8(ptr, strlen(ptr));
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh
deleted file mode 100644
index 90a9e36..0000000
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-inert class Clownfish::TestHarness::TestUtils  {
-
-    /** Testing-only String factory which uses strlen().
-     */
-    inert incremented String*
-    get_str(const char *utf8);
-
-    /** Return a random unsigned 64-bit integer.
-     */
-    inert uint64_t
-    random_u64();
-
-    /** Return an array of <code>count</code> random 64-bit integers where
-     * <code>min <= n < limit</code>.
-     *
-     * If <code>buf</code> is NULL, it will be allocated, otherwise it will
-     * be used.
-     */
-    inert int64_t*
-    random_i64s(int64_t *buf, size_t count, int64_t min, int64_t limit);
-
-    /** Return an array of <code>count</code> random unsigned, 64-bit integers
-     * where <code>min <= n < limit</code>.
-     *
-     * If <code>buf</code> is NULL, it will be allocated, otherwise it will
-     * be used.
-     */
-    inert uint64_t*
-    random_u64s(uint64_t *buf, size_t count, uint64_t min, uint64_t limit);
-
-    /** Return an array of <code>count</code> random double-precision floating
-     * point numbers between 0 and 1.
-     *
-     * If <code>buf</code> is NULL, it will be allocated, otherwise it will
-     * be used.
-     */
-    inert double*
-    random_f64s(double *buf, size_t count);
-
-    /** Return a string with a random (legal) sequence of code points.
-     * @param length Length of the string in code points.
-     */
-    inert incremented String*
-    random_string(size_t length);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Util/Atomic.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/Atomic.c b/clownfish/runtime/core/Clownfish/Util/Atomic.c
deleted file mode 100644
index 730cd41..0000000
--- a/clownfish/runtime/core/Clownfish/Util/Atomic.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define C_CFISH_ATOMIC
-#define CFISH_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include "Clownfish/Util/Atomic.h"
-
-/********************************** Windows ********************************/
-#ifdef CHY_HAS_WINDOWS_H
-#include <windows.h>
-
-bool
-cfish_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
-                            void *new_value) {
-    return InterlockedCompareExchangePointer(target, new_value, old_value)
-           == old_value;
-}
-
-/************************** Fall back to ptheads ***************************/
-#elif defined(CHY_HAS_PTHREAD_H)
-
-#include <pthread.h>
-pthread_mutex_t cfish_Atomic_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-#endif
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Util/Atomic.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/Atomic.cfh b/clownfish/runtime/core/Clownfish/Util/Atomic.cfh
deleted file mode 100644
index 2d3bf64..0000000
--- a/clownfish/runtime/core/Clownfish/Util/Atomic.cfh
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-/** Provide atomic memory operations.
- */
-inert class Clownfish::Util::Atomic { }
-
-__C__
-
-/** Compare and swap a pointer.  Test whether the value at <code>target</code>
- * matches <code>old_value</code>.  If it does, set <code>target</code> to
- * <code>new_value</code> and return true.  Otherwise, return false.
- */
-static CFISH_INLINE bool
-cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value);
-
-/************************** Single threaded *******************************/
-#ifdef CFISH_NOTHREADS
-
-static CFISH_INLINE bool
-cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
-    if (*target == old_value) {
-        *target = new_value;
-        return true;
-    }
-    else {
-        return false;
-    }
-}
-
-/************************** Mac OS X 10.4 and later ***********************/
-#elif defined(CFISH_HAS_OSATOMIC_CAS_PTR)
-#include <libkern/OSAtomic.h>
-
-static CFISH_INLINE bool
-cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
-    return OSAtomicCompareAndSwapPtr(old_value, new_value, target);
-}
-
-/********************************** Windows *******************************/
-#elif defined(CFISH_HAS_WINDOWS_H)
-
-bool
-cfish_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
-                            void *new_value);
-
-static CFISH_INLINE bool
-cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
-    return cfish_Atomic_wrapped_cas_ptr(target, old_value, new_value);
-}
-
-/**************************** Solaris 10 and later ************************/
-#elif defined(CFISH_HAS_SYS_ATOMIC_H)
-#include <sys/atomic.h>
-
-static CFISH_INLINE bool
-cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
-    return atomic_cas_ptr(target, old_value, new_value) == old_value;
-}
-
-/************************ Fall back to pthread.h. **************************/
-#elif defined(CFISH_HAS_PTHREAD_H)
-#include <pthread.h>
-
-extern pthread_mutex_t cfish_Atomic_mutex;
-
-static CFISH_INLINE bool
-cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
-    pthread_mutex_lock(&cfish_Atomic_mutex);
-    if (*target == old_value) {
-        *target = new_value;
-        pthread_mutex_unlock(&cfish_Atomic_mutex);
-        return true;
-    }
-    else {
-        pthread_mutex_unlock(&cfish_Atomic_mutex);
-        return false;
-    }
-}
-
-/******************** No support for atomics at all. ***********************/
-#else
-
-#error "No support for atomic operations."
-
-#endif // Big platform if-else chain.
-
-#ifdef CFISH_USE_SHORT_NAMES
-  #define Atomic_cas_ptr cfish_Atomic_cas_ptr
-#endif
-
-__END_C__
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Util/Memory.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/Memory.c b/clownfish/runtime/core/Clownfish/Util/Memory.c
deleted file mode 100644
index dcf3214..0000000
--- a/clownfish/runtime/core/Clownfish/Util/Memory.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define C_CFISH_MEMORY
-#define CFISH_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "Clownfish/Util/Memory.h"
-
-void*
-Memory_wrapped_malloc(size_t count) {
-    void *pointer = malloc(count);
-    if (pointer == NULL && count != 0) {
-        fprintf(stderr, "Can't malloc %" PRIu64 " bytes.\n", (uint64_t)count);
-        exit(1);
-    }
-    return pointer;
-}
-
-void*
-Memory_wrapped_calloc(size_t count, size_t size) {
-    void *pointer = calloc(count, size);
-    if (pointer == NULL && count != 0) {
-        fprintf(stderr, "Can't calloc %" PRIu64 " elements of size %" PRIu64 ".\n",
-                (uint64_t)count, (uint64_t)size);
-        exit(1);
-    }
-    return pointer;
-}
-
-void*
-Memory_wrapped_realloc(void *ptr, size_t size) {
-    void *pointer = realloc(ptr, size);
-    if (pointer == NULL && size != 0) {
-        fprintf(stderr, "Can't realloc %" PRIu64 " bytes.\n", (uint64_t)size);
-        exit(1);
-    }
-    return pointer;
-}
-
-void
-Memory_wrapped_free(void *ptr) {
-    free(ptr);
-}
-
-size_t
-Memory_oversize(size_t minimum, size_t width) {
-    // For larger arrays, grow by an excess of 1/8; grow faster when the array
-    // is small.
-    size_t extra = minimum / 8;
-    if (extra < 3) {
-        extra = 3;
-    }
-    size_t amount = minimum + extra;
-
-    // Detect wraparound and return SIZE_MAX instead.
-    if (amount + 7 < minimum) {
-        return SIZE_MAX;
-    }
-
-    // Round up for small widths so that the number of bytes requested will be
-    // a multiple of the machine's word size.
-    if (sizeof(size_t) == 8) { // 64-bit
-        switch (width) {
-            case 1:
-                amount = (amount + 7) & INT64_C(0xFFFFFFFFFFFFFFF8);
-                break;
-            case 2:
-                amount = (amount + 3) & INT64_C(0xFFFFFFFFFFFFFFFC);
-                break;
-            case 4:
-                amount = (amount + 1) & INT64_C(0xFFFFFFFFFFFFFFFE);
-                break;
-            default:
-                break;
-        }
-    }
-    else { // 32-bit
-        switch (width) {
-            case 1:
-                amount = (amount + 3) & ((size_t)0xFFFFFFFC);
-                break;
-            case 2:
-                amount = (amount + 1) & ((size_t)0xFFFFFFFE);
-                break;
-            default:
-                break;
-        }
-    }
-
-    return amount;
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Util/Memory.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/Memory.cfh b/clownfish/runtime/core/Clownfish/Util/Memory.cfh
deleted file mode 100644
index 69ae85f..0000000
--- a/clownfish/runtime/core/Clownfish/Util/Memory.cfh
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Clownfish;
-
-inert class Clownfish::Util::Memory {
-
-    /** Attempt to allocate memory with malloc, but print an error and exit if the
-     * call fails.
-     */
-    inert nullable void*
-    wrapped_malloc(size_t count);
-
-    /** Attempt to allocate memory with calloc, but print an error and exit if the
-     * call fails.
-     */
-    inert nullable void*
-    wrapped_calloc(size_t count, size_t size);
-
-    /** Attempt to allocate memory with realloc, but print an error and exit if
-     * the call fails.
-     */
-    inert nullable void*
-    wrapped_realloc(void *ptr, size_t size);
-
-    /** Free memory.  (Wrapping is necessary in cases where memory allocated
-     * within the Clownfish library has to be freed in an external environment
-     * where "free" may have been redefined.)
-     */
-    inert void
-    wrapped_free(void *ptr);
-
-    /** Provide a number which is somewhat larger than the supplied number, so
-     * that incremental array growth does not trigger pathological
-     * reallocation.
-     *
-     * @param minimum The minimum number of array elements.
-     * @param width The size of each array element in bytes.
-     */
-    inert size_t
-    oversize(size_t minimum, size_t width);
-}
-
-__C__
-
-#define CFISH_MALLOCATE    cfish_Memory_wrapped_malloc
-#define CFISH_CALLOCATE    cfish_Memory_wrapped_calloc
-#define CFISH_REALLOCATE   cfish_Memory_wrapped_realloc
-#define CFISH_FREEMEM      cfish_Memory_wrapped_free
-
-#ifdef CFISH_USE_SHORT_NAMES
-  #define MALLOCATE                       CFISH_MALLOCATE
-  #define CALLOCATE                       CFISH_CALLOCATE
-  #define REALLOCATE                      CFISH_REALLOCATE
-  #define FREEMEM                         CFISH_FREEMEM
-#endif
-
-__END_C__
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/core/Clownfish/Util/NumberUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/NumberUtils.c b/clownfish/runtime/core/Clownfish/Util/NumberUtils.c
deleted file mode 100644
index dd65059..0000000
--- a/clownfish/runtime/core/Clownfish/Util/NumberUtils.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define C_CFISH_NUMBERUTILS
-#define CFISH_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
-
-#include <string.h>
-
-#include "Clownfish/Util/NumberUtils.h"
-
-const uint8_t NumUtil_u1masks[8] = {
-    0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
-};
-
-const uint8_t NumUtil_u2shifts[4] = { 0x0, 0x2, 0x4,  0x6  };
-const uint8_t NumUtil_u2masks[4]  = { 0x3, 0xC, 0x30, 0xC0 };
-
-const uint8_t NumUtil_u4shifts[2] = { 0x00, 0x04 };
-const uint8_t NumUtil_u4masks[2]  = { 0x0F, 0xF0 };
-
-


Mime
View raw message