You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/05/30 22:36:25 UTC

[lucy-commits] [07/26] Move Clownfish runtime tests to a separate parcel

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestHash.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestHash.c b/core/Lucy/Test/Object/TestHash.c
deleted file mode 100644
index 635d8e1..0000000
--- a/core/Lucy/Test/Object/TestHash.c
+++ /dev/null
@@ -1,286 +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 "Lucy/Util/ToolSet.h"
-#include <stdlib.h>
-#include <time.h>
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/TestUtils.h"
-#include "Lucy/Test/Object/TestHash.h"
-#include "Clownfish/Hash.h"
-
-TestHash*
-TestHash_new(TestFormatter *formatter) {
-    TestHash *self = (TestHash*)VTable_Make_Obj(TESTHASH);
-    return TestHash_init(self, formatter);
-}
-
-TestHash*
-TestHash_init(TestHash *self, TestFormatter *formatter) {
-    return (TestHash*)TestBatch_init((TestBatch*)self, 29, formatter);
-}
-
-static void
-test_Equals(TestBatch *batch) {
-    Hash *hash  = Hash_new(0);
-    Hash *other = Hash_new(0);
-    ZombieCharBuf *stuff = ZCB_WRAP_STR("stuff", 5);
-
-    TEST_TRUE(batch, Hash_Equals(hash, (Obj*)other),
-              "Empty hashes are equal");
-
-    Hash_Store_Str(hash, "foo", 3, (Obj*)CFISH_TRUE);
-    TEST_FALSE(batch, Hash_Equals(hash, (Obj*)other),
-               "Add one pair and Equals returns false");
-
-    Hash_Store_Str(other, "foo", 3, (Obj*)CFISH_TRUE);
-    TEST_TRUE(batch, Hash_Equals(hash, (Obj*)other),
-              "Add a matching pair and Equals returns true");
-
-    Hash_Store_Str(other, "foo", 3, INCREF(stuff));
-    TEST_FALSE(batch, Hash_Equals(hash, (Obj*)other),
-               "Non-matching value spoils Equals");
-
-    DECREF(hash);
-    DECREF(other);
-}
-
-static void
-test_Store_and_Fetch(TestBatch *batch) {
-    Hash          *hash         = Hash_new(100);
-    Hash          *dupe         = Hash_new(100);
-    const uint32_t starting_cap = Hash_Get_Capacity(hash);
-    VArray        *expected     = VA_new(100);
-    VArray        *got          = VA_new(100);
-    ZombieCharBuf *twenty       = ZCB_WRAP_STR("20", 2);
-    ZombieCharBuf *forty        = ZCB_WRAP_STR("40", 2);
-    ZombieCharBuf *foo          = ZCB_WRAP_STR("foo", 3);
-
-    for (int32_t i = 0; i < 100; i++) {
-        CharBuf *cb = CB_newf("%i32", i);
-        Hash_Store(hash, (Obj*)cb, (Obj*)cb);
-        Hash_Store(dupe, (Obj*)cb, INCREF(cb));
-        VA_Push(expected, INCREF(cb));
-    }
-    TEST_TRUE(batch, Hash_Equals(hash, (Obj*)dupe), "Equals");
-
-    TEST_INT_EQ(batch, Hash_Get_Capacity(hash), starting_cap,
-                "Initial capacity sufficient (no rebuilds)");
-
-    for (int32_t i = 0; i < 100; i++) {
-        Obj *key  = VA_Fetch(expected, i);
-        Obj *elem = Hash_Fetch(hash, key);
-        VA_Push(got, (Obj*)INCREF(elem));
-    }
-
-    TEST_TRUE(batch, VA_Equals(got, (Obj*)expected),
-              "basic Store and Fetch");
-    TEST_INT_EQ(batch, Hash_Get_Size(hash), 100,
-                "size incremented properly by Hash_Store");
-
-    TEST_TRUE(batch, Hash_Fetch(hash, (Obj*)foo) == NULL,
-              "Fetch against non-existent key returns NULL");
-
-    Hash_Store(hash, (Obj*)forty, INCREF(foo));
-    TEST_TRUE(batch, ZCB_Equals(foo, Hash_Fetch(hash, (Obj*)forty)),
-              "Hash_Store replaces existing value");
-    TEST_FALSE(batch, Hash_Equals(hash, (Obj*)dupe),
-               "replacement value spoils equals");
-    TEST_INT_EQ(batch, Hash_Get_Size(hash), 100,
-                "size unaffected after value replaced");
-
-    TEST_TRUE(batch, Hash_Delete(hash, (Obj*)forty) == (Obj*)foo,
-              "Delete returns value");
-    DECREF(foo);
-    TEST_INT_EQ(batch, Hash_Get_Size(hash), 99,
-                "size decremented by successful Delete");
-    TEST_TRUE(batch, Hash_Delete(hash, (Obj*)forty) == NULL,
-              "Delete returns NULL when key not found");
-    TEST_INT_EQ(batch, Hash_Get_Size(hash), 99,
-                "size not decremented by unsuccessful Delete");
-    DECREF(Hash_Delete(dupe, (Obj*)forty));
-    TEST_TRUE(batch, VA_Equals(got, (Obj*)expected), "Equals after Delete");
-
-    Hash_Clear(hash);
-    TEST_TRUE(batch, Hash_Fetch(hash, (Obj*)twenty) == NULL, "Clear");
-    TEST_TRUE(batch, Hash_Get_Size(hash) == 0, "size is 0 after Clear");
-
-    DECREF(hash);
-    DECREF(dupe);
-    DECREF(got);
-    DECREF(expected);
-}
-
-static void
-test_Keys_Values_Iter(TestBatch *batch) {
-    Hash     *hash     = Hash_new(0); // trigger multiple rebuilds.
-    VArray   *expected = VA_new(100);
-    VArray   *keys;
-    VArray   *values;
-
-    for (uint32_t i = 0; i < 500; i++) {
-        CharBuf *cb = CB_newf("%u32", i);
-        Hash_Store(hash, (Obj*)cb, (Obj*)cb);
-        VA_Push(expected, INCREF(cb));
-    }
-
-    VA_Sort(expected, NULL, NULL);
-
-    keys   = Hash_Keys(hash);
-    values = Hash_Values(hash);
-    VA_Sort(keys, NULL, NULL);
-    VA_Sort(values, NULL, NULL);
-    TEST_TRUE(batch, VA_Equals(keys, (Obj*)expected), "Keys");
-    TEST_TRUE(batch, VA_Equals(values, (Obj*)expected), "Values");
-    VA_Clear(keys);
-    VA_Clear(values);
-
-    {
-        Obj *key;
-        Obj *value;
-        Hash_Iterate(hash);
-        while (Hash_Next(hash, &key, &value)) {
-            VA_Push(keys, INCREF(key));
-            VA_Push(values, INCREF(value));
-        }
-    }
-
-    VA_Sort(keys, NULL, NULL);
-    VA_Sort(values, NULL, NULL);
-    TEST_TRUE(batch, VA_Equals(keys, (Obj*)expected), "Keys from Iter");
-    TEST_TRUE(batch, VA_Equals(values, (Obj*)expected), "Values from Iter");
-
-    {
-        ZombieCharBuf *forty = ZCB_WRAP_STR("40", 2);
-        ZombieCharBuf *nope  = ZCB_WRAP_STR("nope", 4);
-        Obj *key = Hash_Find_Key(hash, (Obj*)forty, ZCB_Hash_Sum(forty));
-        TEST_TRUE(batch, Obj_Equals(key, (Obj*)forty), "Find_Key");
-        key = Hash_Find_Key(hash, (Obj*)nope, ZCB_Hash_Sum(nope)),
-        TEST_TRUE(batch, key == NULL,
-                  "Find_Key returns NULL for non-existent key");
-    }
-
-    DECREF(hash);
-    DECREF(expected);
-    DECREF(keys);
-    DECREF(values);
-}
-
-static void
-test_Dump_and_Load(TestBatch *batch) {
-    Hash *hash = Hash_new(0);
-    Obj  *dump;
-    Hash *loaded;
-
-    Hash_Store_Str(hash, "foo", 3,
-                   (Obj*)CB_new_from_trusted_utf8("foo", 3));
-    dump = (Obj*)Hash_Dump(hash);
-    loaded = (Hash*)Obj_Load(dump, dump);
-    TEST_TRUE(batch, Hash_Equals(hash, (Obj*)loaded),
-              "Dump => Load round trip");
-    DECREF(dump);
-    DECREF(loaded);
-
-    /* TODO: Fix Hash_Load().
-
-    Hash_Store_Str(hash, "_class", 6,
-        (Obj*)CB_new_from_trusted_utf8("not_a_class", 11));
-    dump = (Obj*)Hash_Dump(hash);
-    loaded = (Hash*)Obj_Load(dump, dump);
-
-    TEST_TRUE(batch, Hash_Equals(hash, (Obj*)loaded),
-              "Load still works with _class if it's not a real class");
-    DECREF(dump);
-    DECREF(loaded);
-
-    */
-
-    DECREF(hash);
-}
-
-static void
-test_serialization(TestBatch *batch) {
-    Hash  *wanted = Hash_new(0);
-    Hash  *got;
-
-    for (uint32_t i = 0; i < 10; i++) {
-        CharBuf *cb = TestUtils_random_string(rand() % 1200);
-        Integer32 *num = Int32_new(i);
-        Hash_Store(wanted, (Obj*)cb, (Obj*)num);
-        Hash_Store(wanted, (Obj*)num, (Obj*)cb);
-    }
-
-    got = (Hash*)TestUtils_freeze_thaw((Obj*)wanted);
-    TEST_TRUE(batch, got && Hash_Equals(wanted, (Obj*)got),
-              "Round trip through serialization.");
-
-    DECREF(got);
-    DECREF(wanted);
-}
-
-static void
-test_stress(TestBatch *batch) {
-    Hash     *hash     = Hash_new(0); // trigger multiple rebuilds.
-    VArray   *expected = VA_new(1000);
-    VArray   *keys;
-    VArray   *values;
-
-    for (uint32_t i = 0; i < 1000; i++) {
-        CharBuf *cb = TestUtils_random_string(rand() % 1200);
-        while (Hash_Fetch(hash, (Obj*)cb)) {
-            DECREF(cb);
-            cb = TestUtils_random_string(rand() % 1200);
-        }
-        Hash_Store(hash, (Obj*)cb, (Obj*)cb);
-        VA_Push(expected, INCREF(cb));
-    }
-
-    VA_Sort(expected, NULL, NULL);
-
-    // Overwrite for good measure.
-    for (uint32_t i = 0; i < 1000; i++) {
-        CharBuf *cb = (CharBuf*)VA_Fetch(expected, i);
-        Hash_Store(hash, (Obj*)cb, INCREF(cb));
-    }
-
-    keys   = Hash_Keys(hash);
-    values = Hash_Values(hash);
-    VA_Sort(keys, NULL, NULL);
-    VA_Sort(values, NULL, NULL);
-    TEST_TRUE(batch, VA_Equals(keys, (Obj*)expected), "stress Keys");
-    TEST_TRUE(batch, VA_Equals(values, (Obj*)expected), "stress Values");
-
-    DECREF(keys);
-    DECREF(values);
-    DECREF(expected);
-    DECREF(hash);
-}
-
-void
-TestHash_run_tests(TestHash *self) {
-    TestBatch *batch = (TestBatch*)self;
-    srand((unsigned int)time((time_t*)NULL));
-    test_Equals(batch);
-    test_Store_and_Fetch(batch);
-    test_Keys_Values_Iter(batch);
-    test_Dump_and_Load(batch);
-    test_serialization(batch);
-    test_stress(batch);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestHash.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestHash.cfh b/core/Lucy/Test/Object/TestHash.cfh
deleted file mode 100644
index 95dd31d..0000000
--- a/core/Lucy/Test/Object/TestHash.cfh
+++ /dev/null
@@ -1,32 +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 Lucy;
-
-class Lucy::Test::Object::TestHash
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestHash*
-    new(TestFormatter *formatter);
-
-    inert TestHash*
-    init(TestHash *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestHash *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestLockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestLockFreeRegistry.c b/core/Lucy/Test/Object/TestLockFreeRegistry.c
deleted file mode 100644
index 3e1ffe4..0000000
--- a/core/Lucy/Test/Object/TestLockFreeRegistry.c
+++ /dev/null
@@ -1,86 +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>
-
-#include "Lucy/Util/ToolSet.h"
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/TestUtils.h"
-#include "Lucy/Test/Object/TestLockFreeRegistry.h"
-#include "Clownfish/LockFreeRegistry.h"
-
-TestLockFreeRegistry*
-TestLFReg_new(TestFormatter *formatter) {
-    TestLockFreeRegistry *self = (TestLockFreeRegistry*)VTable_Make_Obj(TESTLOCKFREEREGISTRY);
-    return TestLFReg_init(self, formatter);
-}
-
-TestLockFreeRegistry*
-TestLFReg_init(TestLockFreeRegistry *self, TestFormatter *formatter) {
-    return (TestLockFreeRegistry*)TestBatch_init((TestBatch*)self, 6, formatter);
-}
-
-StupidHashCharBuf*
-StupidHashCharBuf_new(const char *text) {
-    return (StupidHashCharBuf*)CB_new_from_utf8(text, strlen(text));
-}
-
-int32_t
-StupidHashCharBuf_hash_sum(StupidHashCharBuf *self) {
-    UNUSED_VAR(self);
-    return 1;
-}
-
-static void
-test_all(TestBatch *batch) {
-    LockFreeRegistry *registry = LFReg_new(10);
-    StupidHashCharBuf *foo = StupidHashCharBuf_new("foo");
-    StupidHashCharBuf *bar = StupidHashCharBuf_new("bar");
-    StupidHashCharBuf *baz = StupidHashCharBuf_new("baz");
-    StupidHashCharBuf *foo_dupe = StupidHashCharBuf_new("foo");
-
-    TEST_TRUE(batch, LFReg_Register(registry, (Obj*)foo, (Obj*)foo),
-              "Register() returns true on success");
-    TEST_FALSE(batch,
-               LFReg_Register(registry, (Obj*)foo_dupe, (Obj*)foo_dupe),
-               "Can't Register() keys that test equal");
-
-    TEST_TRUE(batch, LFReg_Register(registry, (Obj*)bar, (Obj*)bar),
-              "Register() key with the same Hash_Sum but that isn't Equal");
-
-    TEST_TRUE(batch, LFReg_Fetch(registry, (Obj*)foo_dupe) == (Obj*)foo,
-              "Fetch()");
-    TEST_TRUE(batch, LFReg_Fetch(registry, (Obj*)bar) == (Obj*)bar,
-              "Fetch() again");
-    TEST_TRUE(batch, LFReg_Fetch(registry, (Obj*)baz) == NULL,
-              "Fetch() non-existent key returns NULL");
-
-    DECREF(foo_dupe);
-    DECREF(baz);
-    DECREF(bar);
-    DECREF(foo);
-    DECREF(registry);
-}
-
-void
-TestLFReg_run_tests(TestLockFreeRegistry *self) {
-    TestBatch *batch = (TestBatch*)self;
-    test_all(batch);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestLockFreeRegistry.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestLockFreeRegistry.cfh b/core/Lucy/Test/Object/TestLockFreeRegistry.cfh
deleted file mode 100644
index f73cd91..0000000
--- a/core/Lucy/Test/Object/TestLockFreeRegistry.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 Lucy;
-
-class Lucy::Test::Object::TestLockFreeRegistry cnick TestLFReg
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestLockFreeRegistry*
-    new(TestFormatter *formatter);
-
-    inert TestLockFreeRegistry*
-    init(TestLockFreeRegistry *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestLockFreeRegistry *self);
-}
-
-/** Private test-only class for stressing LockFreeRegistry.
- */
-class Lucy::Test::Object::StupidHashCharBuf inherits Clownfish::CharBuf {
-    inert incremented StupidHashCharBuf*
-    new(const char *text);
-
-    /** Always returns 1, guaranteeing collisions. */
-    public int32_t
-    Hash_Sum(StupidHashCharBuf *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestNum.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestNum.c b/core/Lucy/Test/Object/TestNum.c
deleted file mode 100644
index a76b058..0000000
--- a/core/Lucy/Test/Object/TestNum.c
+++ /dev/null
@@ -1,321 +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_LUCY_TESTNUM
-#include "Lucy/Util/ToolSet.h"
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/TestUtils.h"
-#include "Lucy/Test/Object/TestNum.h"
-
-TestNum*
-TestNum_new(TestFormatter *formatter) {
-    TestNum *self = (TestNum*)VTable_Make_Obj(TESTNUM);
-    return TestNum_init(self, formatter);
-}
-
-TestNum*
-TestNum_init(TestNum *self, TestFormatter *formatter) {
-    return (TestNum*)TestBatch_init((TestBatch*)self, 58, formatter);
-}
-
-static void
-test_To_String(TestBatch *batch) {
-    Float32   *f32 = Float32_new(1.33f);
-    Float64   *f64 = Float64_new(1.33);
-    Integer32 *i32 = Int32_new(INT32_MAX);
-    Integer64 *i64 = Int64_new(INT64_MAX);
-    CharBuf *f32_string = Float32_To_String(f32);
-    CharBuf *f64_string = Float64_To_String(f64);
-    CharBuf *i32_string = Int32_To_String(i32);
-    CharBuf *i64_string = Int64_To_String(i64);
-    CharBuf *true_string  = Bool_To_String(CFISH_TRUE);
-    CharBuf *false_string = Bool_To_String(CFISH_FALSE);
-
-    TEST_TRUE(batch, CB_Starts_With_Str(f32_string, "1.3", 3),
-              "Float32_To_String");
-    TEST_TRUE(batch, CB_Starts_With_Str(f64_string, "1.3", 3),
-              "Float64_To_String");
-    TEST_TRUE(batch, CB_Equals_Str(i32_string, "2147483647", 10),
-              "Int32_To_String");
-    TEST_TRUE(batch, CB_Equals_Str(i64_string, "9223372036854775807", 19),
-              "Int64_To_String");
-    TEST_TRUE(batch, CB_Equals_Str(true_string, "true", 4),
-              "Bool_To_String [true]");
-    TEST_TRUE(batch, CB_Equals_Str(false_string, "false", 5),
-              "Bool_To_String [false]");
-
-    DECREF(false_string);
-    DECREF(true_string);
-    DECREF(i64_string);
-    DECREF(i32_string);
-    DECREF(f64_string);
-    DECREF(f32_string);
-    DECREF(i64);
-    DECREF(i32);
-    DECREF(f64);
-    DECREF(f32);
-}
-
-static void
-test_accessors(TestBatch *batch) {
-    Float32   *f32 = Float32_new(1.0);
-    Float64   *f64 = Float64_new(1.0);
-    Integer32 *i32 = Int32_new(1);
-    Integer64 *i64 = Int64_new(1);
-    float  wanted32 = 1.33f;
-    double wanted64 = 1.33;
-    float  got32;
-    double got64;
-
-    Float32_Set_Value(f32, 1.33f);
-    TEST_FLOAT_EQ(batch, Float32_Get_Value(f32), 1.33f,
-                  "F32 Set_Value Get_Value");
-
-    Float64_Set_Value(f64, 1.33);
-    got64 = Float64_Get_Value(f64);
-    TEST_TRUE(batch, *(int64_t*)&got64 == *(int64_t*)&wanted64,
-              "F64 Set_Value Get_Value");
-
-    TEST_TRUE(batch, Float32_To_I64(f32) == 1, "Float32_To_I64");
-    TEST_TRUE(batch, Float64_To_I64(f64) == 1, "Float64_To_I64");
-
-    got32 = (float)Float32_To_F64(f32);
-    TEST_TRUE(batch, *(int32_t*)&got32 == *(int32_t*)&wanted32,
-              "Float32_To_F64");
-
-    got64 = Float64_To_F64(f64);
-    TEST_TRUE(batch, *(int64_t*)&got64 == *(int64_t*)&wanted64,
-              "Float64_To_F64");
-
-    Int32_Set_Value(i32, INT32_MIN);
-    TEST_INT_EQ(batch, Int32_Get_Value(i32), INT32_MIN,
-                "I32 Set_Value Get_Value");
-
-    Int64_Set_Value(i64, INT64_MIN);
-    TEST_TRUE(batch, Int64_Get_Value(i64) == INT64_MIN,
-              "I64 Set_Value Get_Value");
-
-    Int32_Set_Value(i32, -1);
-    Int64_Set_Value(i64, -1);
-    TEST_TRUE(batch, Int32_To_F64(i32) == -1, "Int32_To_F64");
-    TEST_TRUE(batch, Int64_To_F64(i64) == -1, "Int64_To_F64");
-
-    TEST_INT_EQ(batch, Bool_Get_Value(CFISH_TRUE), true,
-                "Bool_Get_Value [true]");
-    TEST_INT_EQ(batch, Bool_Get_Value(CFISH_FALSE), false,
-                "Bool_Get_Value [false]");
-    TEST_TRUE(batch, Bool_To_I64(CFISH_TRUE) == true,
-              "Bool_To_I64 [true]");
-    TEST_TRUE(batch, Bool_To_I64(CFISH_FALSE) == false,
-              "Bool_To_I64 [false]");
-    TEST_TRUE(batch, Bool_To_F64(CFISH_TRUE) == 1.0,
-              "Bool_To_F64 [true]");
-    TEST_TRUE(batch, Bool_To_F64(CFISH_FALSE) == 0.0,
-              "Bool_To_F64 [false]");
-
-    DECREF(i64);
-    DECREF(i32);
-    DECREF(f64);
-    DECREF(f32);
-}
-
-static void
-test_Equals_and_Compare_To(TestBatch *batch) {
-    Float32   *f32 = Float32_new(1.0);
-    Float64   *f64 = Float64_new(1.0);
-    Integer32 *i32 = Int32_new(INT32_MAX);
-    Integer64 *i64 = Int64_new(INT64_MAX);
-
-    TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)f64) == 0,
-              "F32_Compare_To equal");
-    TEST_TRUE(batch, Float32_Equals(f32, (Obj*)f64),
-              "F32_Equals equal");
-
-    Float64_Set_Value(f64, 2.0);
-    TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)f64) < 0,
-              "F32_Compare_To less than");
-    TEST_FALSE(batch, Float32_Equals(f32, (Obj*)f64),
-               "F32_Equals less than");
-
-    Float64_Set_Value(f64, 0.0);
-    TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)f64) > 0,
-              "F32_Compare_To greater than");
-    TEST_FALSE(batch, Float32_Equals(f32, (Obj*)f64),
-               "F32_Equals greater than");
-
-    Float64_Set_Value(f64, 1.0);
-    Float32_Set_Value(f32, 1.0);
-    TEST_TRUE(batch, Float64_Compare_To(f64, (Obj*)f32) == 0,
-              "F64_Compare_To equal");
-    TEST_TRUE(batch, Float64_Equals(f64, (Obj*)f32),
-              "F64_Equals equal");
-
-    Float32_Set_Value(f32, 2.0);
-    TEST_TRUE(batch, Float64_Compare_To(f64, (Obj*)f32) < 0,
-              "F64_Compare_To less than");
-    TEST_FALSE(batch, Float64_Equals(f64, (Obj*)f32),
-               "F64_Equals less than");
-
-    Float32_Set_Value(f32, 0.0);
-    TEST_TRUE(batch, Float64_Compare_To(f64, (Obj*)f32) > 0,
-              "F64_Compare_To greater than");
-    TEST_FALSE(batch, Float64_Equals(f64, (Obj*)f32),
-               "F64_Equals greater than");
-
-    Float64_Set_Value(f64, INT64_MAX * 2.0);
-    TEST_TRUE(batch, Float64_Compare_To(f64, (Obj*)i64) > 0,
-              "Float64 comparison to Integer64");
-    TEST_TRUE(batch, Int64_Compare_To(i64, (Obj*)f64) < 0,
-              "Integer64 comparison to Float64");
-
-    Float32_Set_Value(f32, INT32_MAX * 2.0f);
-    TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)i32) > 0,
-              "Float32 comparison to Integer32");
-    TEST_TRUE(batch, Int32_Compare_To(i32, (Obj*)f32) < 0,
-              "Integer32 comparison to Float32");
-
-    Int64_Set_Value(i64, INT64_C(0x6666666666666666));
-    Integer64 *i64_copy = Int64_new(INT64_C(0x6666666666666666));
-    TEST_TRUE(batch, Int64_Compare_To(i64, (Obj*)i64_copy) == 0,
-              "Integer64 comparison to same number");
-
-    TEST_TRUE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_TRUE),
-              "CFISH_TRUE Equals itself");
-    TEST_TRUE(batch, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_FALSE),
-              "CFISH_FALSE Equals itself");
-    TEST_FALSE(batch, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_TRUE),
-               "CFISH_FALSE not Equals CFISH_TRUE ");
-    TEST_FALSE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_FALSE),
-               "CFISH_TRUE not Equals CFISH_FALSE ");
-    TEST_FALSE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CHARBUF),
-               "CFISH_TRUE not Equals random other object ");
-
-    DECREF(i64_copy);
-    DECREF(i64);
-    DECREF(i32);
-    DECREF(f64);
-    DECREF(f32);
-}
-
-static void
-test_Clone(TestBatch *batch) {
-    Float32   *f32 = Float32_new(1.33f);
-    Float64   *f64 = Float64_new(1.33);
-    Integer32 *i32 = Int32_new(INT32_MAX);
-    Integer64 *i64 = Int64_new(INT64_MAX);
-    Float32   *f32_dupe = Float32_Clone(f32);
-    Float64   *f64_dupe = Float64_Clone(f64);
-    Integer32 *i32_dupe = Int32_Clone(i32);
-    Integer64 *i64_dupe = Int64_Clone(i64);
-    TEST_TRUE(batch, Float32_Equals(f32, (Obj*)f32_dupe),
-              "Float32 Clone");
-    TEST_TRUE(batch, Float64_Equals(f64, (Obj*)f64_dupe),
-              "Float64 Clone");
-    TEST_TRUE(batch, Int32_Equals(i32, (Obj*)i32_dupe),
-              "Integer32 Clone");
-    TEST_TRUE(batch, Int64_Equals(i64, (Obj*)i64_dupe),
-              "Integer64 Clone");
-    TEST_TRUE(batch, Bool_Equals(CFISH_TRUE, (Obj*)Bool_Clone(CFISH_TRUE)),
-              "BoolNum Clone");
-    DECREF(i64_dupe);
-    DECREF(i32_dupe);
-    DECREF(f64_dupe);
-    DECREF(f32_dupe);
-    DECREF(i64);
-    DECREF(i32);
-    DECREF(f64);
-    DECREF(f32);
-}
-
-static void
-test_Mimic(TestBatch *batch) {
-    Float32   *f32 = Float32_new(1.33f);
-    Float64   *f64 = Float64_new(1.33);
-    Integer32 *i32 = Int32_new(INT32_MAX);
-    Integer64 *i64 = Int64_new(INT64_MAX);
-    Float32   *f32_dupe = Float32_new(0.0f);
-    Float64   *f64_dupe = Float64_new(0.0);
-    Integer32 *i32_dupe = Int32_new(0);
-    Integer64 *i64_dupe = Int64_new(0);
-    Float32_Mimic(f32_dupe, (Obj*)f32);
-    Float64_Mimic(f64_dupe, (Obj*)f64);
-    Int32_Mimic(i32_dupe, (Obj*)i32);
-    Int64_Mimic(i64_dupe, (Obj*)i64);
-    TEST_TRUE(batch, Float32_Equals(f32, (Obj*)f32_dupe),
-              "Float32 Mimic");
-    TEST_TRUE(batch, Float64_Equals(f64, (Obj*)f64_dupe),
-              "Float64 Mimic");
-    TEST_TRUE(batch, Int32_Equals(i32, (Obj*)i32_dupe),
-              "Integer32 Mimic");
-    TEST_TRUE(batch, Int64_Equals(i64, (Obj*)i64_dupe),
-              "Integer64 Mimic");
-    DECREF(i64_dupe);
-    DECREF(i32_dupe);
-    DECREF(f64_dupe);
-    DECREF(f32_dupe);
-    DECREF(i64);
-    DECREF(i32);
-    DECREF(f64);
-    DECREF(f32);
-}
-
-static void
-test_serialization(TestBatch *batch) {
-    Float32   *f32 = Float32_new(1.33f);
-    Float64   *f64 = Float64_new(1.33);
-    Integer32 *i32 = Int32_new(-1);
-    Integer64 *i64 = Int64_new(-1);
-    Float32   *f32_thaw = (Float32*)TestUtils_freeze_thaw((Obj*)f32);
-    Float64   *f64_thaw = (Float64*)TestUtils_freeze_thaw((Obj*)f64);
-    Integer32 *i32_thaw = (Integer32*)TestUtils_freeze_thaw((Obj*)i32);
-    Integer64 *i64_thaw = (Integer64*)TestUtils_freeze_thaw((Obj*)i64);
-    BoolNum   *true_thaw = (BoolNum*)TestUtils_freeze_thaw((Obj*)CFISH_TRUE);
-
-    TEST_TRUE(batch, Float32_Equals(f32, (Obj*)f32_thaw),
-              "Float32 freeze/thaw");
-    TEST_TRUE(batch, Float64_Equals(f64, (Obj*)f64_thaw),
-              "Float64 freeze/thaw");
-    TEST_TRUE(batch, Int32_Equals(i32, (Obj*)i32_thaw),
-              "Integer32 freeze/thaw");
-    TEST_TRUE(batch, Int64_Equals(i64, (Obj*)i64_thaw),
-              "Integer64 freeze/thaw");
-    TEST_TRUE(batch, Bool_Equals(CFISH_TRUE, (Obj*)true_thaw),
-              "BoolNum freeze/thaw");
-
-    DECREF(i64_thaw);
-    DECREF(i32_thaw);
-    DECREF(f64_thaw);
-    DECREF(f32_thaw);
-    DECREF(i64);
-    DECREF(i32);
-    DECREF(f64);
-    DECREF(f32);
-}
-
-void
-TestNum_run_tests(TestNum *self) {
-    TestBatch *batch = (TestBatch*)self;
-    test_To_String(batch);
-    test_accessors(batch);
-    test_Equals_and_Compare_To(batch);
-    test_Clone(batch);
-    test_Mimic(batch);
-    test_serialization(batch);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestNum.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestNum.cfh b/core/Lucy/Test/Object/TestNum.cfh
deleted file mode 100644
index 231571e..0000000
--- a/core/Lucy/Test/Object/TestNum.cfh
+++ /dev/null
@@ -1,32 +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 Lucy;
-
-class Lucy::Test::Object::TestNum
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestNum*
-    new(TestFormatter *formatter);
-
-    inert TestNum*
-    init(TestNum *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestNum *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestObj.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestObj.c b/core/Lucy/Test/Object/TestObj.c
deleted file mode 100644
index 1cd137b..0000000
--- a/core/Lucy/Test/Object/TestObj.c
+++ /dev/null
@@ -1,211 +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_LUCY_TESTOBJ
-#include "Lucy/Util/ToolSet.h"
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/Object/TestObj.h"
-
-TestObj*
-TestObj_new(TestFormatter *formatter) {
-    TestObj *self = (TestObj*)VTable_Make_Obj(TESTOBJ);
-    return TestObj_init(self, formatter);
-}
-
-TestObj*
-TestObj_init(TestObj *self, TestFormatter *formatter) {
-    return (TestObj*)TestBatch_init((TestBatch*)self, 20, formatter);
-}
-
-static Obj*
-S_new_testobj() {
-    ZombieCharBuf *klass = ZCB_WRAP_STR("TestObj", 7);
-    Obj *obj;
-    VTable *vtable = VTable_fetch_vtable((CharBuf*)klass);
-    if (!vtable) {
-        vtable = VTable_singleton((CharBuf*)klass, OBJ);
-    }
-    obj = VTable_Make_Obj(vtable);
-    return Obj_init(obj);
-}
-
-static void
-test_refcounts(TestBatch *batch) {
-    Obj *obj = S_new_testobj();
-
-    TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 1,
-                "Correct starting refcount");
-
-    Obj_Inc_RefCount(obj);
-    TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 2, "Inc_RefCount");
-
-    Obj_Dec_RefCount(obj);
-    TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 1, "Dec_RefCount");
-
-    DECREF(obj);
-}
-
-static void
-test_To_String(TestBatch *batch) {
-    Obj *testobj = S_new_testobj();
-    CharBuf *string = Obj_To_String(testobj);
-    ZombieCharBuf *temp = ZCB_WRAP(string);
-    while (ZCB_Get_Size(temp)) {
-        if (ZCB_Starts_With_Str(temp, "TestObj", 7)) { break; }
-        ZCB_Nip_One(temp);
-    }
-    TEST_TRUE(batch, ZCB_Starts_With_Str(temp, "TestObj", 7), "To_String");
-    DECREF(string);
-    DECREF(testobj);
-}
-
-static void
-test_Dump(TestBatch *batch) {
-    Obj *testobj = S_new_testobj();
-    CharBuf *string = Obj_To_String(testobj);
-    Obj *dump = Obj_Dump(testobj);
-    TEST_TRUE(batch, Obj_Equals(dump, (Obj*)string),
-              "Default Dump returns To_String");
-    DECREF(dump);
-    DECREF(string);
-    DECREF(testobj);
-}
-
-static void
-test_Equals(TestBatch *batch) {
-    Obj *testobj = S_new_testobj();
-    Obj *other   = S_new_testobj();
-
-    TEST_TRUE(batch, Obj_Equals(testobj, testobj),
-              "Equals is true for the same object");
-    TEST_FALSE(batch, Obj_Equals(testobj, other),
-               "Distinct objects are not equal");
-
-    DECREF(testobj);
-    DECREF(other);
-}
-
-static void
-test_Hash_Sum(TestBatch *batch) {
-    Obj *testobj = S_new_testobj();
-    int64_t address64 = PTR_TO_I64(testobj);
-    int32_t address32 = (int32_t)address64;
-    TEST_TRUE(batch, (Obj_Hash_Sum(testobj) == address32),
-              "Hash_Sum uses memory address");
-    DECREF(testobj);
-}
-
-static void
-test_Is_A(TestBatch *batch) {
-    CharBuf *charbuf   = CB_new(0);
-    VTable  *bb_vtable = CB_Get_VTable(charbuf);
-    CharBuf *klass     = CB_Get_Class_Name(charbuf);
-
-    TEST_TRUE(batch, CB_Is_A(charbuf, CHARBUF), "CharBuf Is_A CharBuf.");
-    TEST_TRUE(batch, CB_Is_A(charbuf, OBJ), "CharBuf Is_A Obj.");
-    TEST_TRUE(batch, bb_vtable == CHARBUF, "Get_VTable");
-    TEST_TRUE(batch, CB_Equals(VTable_Get_Name(CHARBUF), (Obj*)klass),
-              "Get_Class_Name");
-
-    DECREF(charbuf);
-}
-
-static void
-S_attempt_init(void *context) {
-    Obj_init((Obj*)context);
-}
-
-static void
-S_attempt_Clone(void *context) {
-    Obj_Clone((Obj*)context);
-}
-
-static void
-S_attempt_Make(void *context) {
-    Obj_Make((Obj*)context);
-}
-
-static void
-S_attempt_Compare_To(void *context) {
-    Obj_Compare_To((Obj*)context, (Obj*)context);
-}
-
-static void
-S_attempt_To_I64(void *context) {
-    Obj_To_I64((Obj*)context);
-}
-
-static void
-S_attempt_To_F64(void *context) {
-    Obj_To_F64((Obj*)context);
-}
-
-static void
-S_attempt_Load(void *context) {
-    Obj_Load((Obj*)context, (Obj*)context);
-}
-
-static void
-S_attempt_Mimic(void *context) {
-    Obj_Mimic((Obj*)context, (Obj*)context);
-}
-
-static void
-S_verify_abstract_error(TestBatch *batch, Err_Attempt_t routine,
-                        void *context, const char *name) {
-    char message[100];
-    sprintf(message, "%s() is abstract", name);
-    Err *error = Err_trap(routine, context);
-    TEST_TRUE(batch, error != NULL
-              && Err_Is_A(error, ERR) 
-              && CB_Find_Str(Err_Get_Mess(error), "bstract", 7) != -1,
-              message);
-    DECREF(error);
-}
-
-static void
-test_abstract_routines(TestBatch *batch) {
-    Obj *blank = VTable_Make_Obj(OBJ);
-    S_verify_abstract_error(batch, S_attempt_init, blank, "init");
-
-    Obj *obj = S_new_testobj();
-    S_verify_abstract_error(batch, S_attempt_Clone,      obj, "Clone");
-    S_verify_abstract_error(batch, S_attempt_Make,       obj, "Make");
-    S_verify_abstract_error(batch, S_attempt_Compare_To, obj, "Compare_To");
-    S_verify_abstract_error(batch, S_attempt_To_I64,     obj, "To_I64");
-    S_verify_abstract_error(batch, S_attempt_To_F64,     obj, "To_F64");
-    S_verify_abstract_error(batch, S_attempt_Load,       obj, "Load");
-    S_verify_abstract_error(batch, S_attempt_Mimic,      obj, "Mimic");
-    DECREF(obj);
-}
-
-void
-TestObj_run_tests(TestObj *self) {
-    TestBatch *batch = (TestBatch*)self;
-    test_refcounts(batch);
-    test_To_String(batch);
-    test_Dump(batch);
-    test_Equals(batch);
-    test_Hash_Sum(batch);
-    test_Is_A(batch);
-    test_abstract_routines(batch);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestObj.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestObj.cfh b/core/Lucy/Test/Object/TestObj.cfh
deleted file mode 100644
index f1c5114..0000000
--- a/core/Lucy/Test/Object/TestObj.cfh
+++ /dev/null
@@ -1,32 +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 Lucy;
-
-class Lucy::Test::Object::TestObj
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestObj*
-    new(TestFormatter *formatter);
-
-    inert TestObj*
-    init(TestObj *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestObj *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestVArray.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestVArray.c b/core/Lucy/Test/Object/TestVArray.c
deleted file mode 100644
index ef28162..0000000
--- a/core/Lucy/Test/Object/TestVArray.c
+++ /dev/null
@@ -1,345 +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_LUCY_TESTVARRAY
-#include "Lucy/Util/ToolSet.h"
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/TestUtils.h"
-#include "Lucy/Test/Object/TestVArray.h"
-
-TestVArray*
-TestVArray_new(TestFormatter *formatter) {
-    TestVArray *self = (TestVArray*)VTable_Make_Obj(TESTVARRAY);
-    return TestVArray_init(self, formatter);
-}
-
-TestVArray*
-TestVArray_init(TestVArray *self, TestFormatter *formatter) {
-    return (TestVArray*)TestBatch_init((TestBatch*)self, 45, formatter);
-}
-
-static CharBuf*
-S_new_cb(const char *text) {
-    return CB_new_from_utf8(text, strlen(text));
-}
-
-static void
-test_Equals(TestBatch *batch) {
-    VArray *array = VA_new(0);
-    VArray *other = VA_new(0);
-    ZombieCharBuf *stuff = ZCB_WRAP_STR("stuff", 5);
-
-    TEST_TRUE(batch, VA_Equals(array, (Obj*)other),
-              "Empty arrays are equal");
-
-    VA_Push(array, (Obj*)CFISH_TRUE);
-    TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
-               "Add one elem and Equals returns false");
-
-    VA_Push(other, (Obj*)CFISH_TRUE);
-    TEST_TRUE(batch, VA_Equals(array, (Obj*)other),
-              "Add a matching elem and Equals returns true");
-
-    VA_Store(array, 2, (Obj*)CFISH_TRUE);
-    TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
-               "Add elem after a NULL and Equals returns false");
-
-    VA_Store(other, 2, (Obj*)CFISH_TRUE);
-    TEST_TRUE(batch, VA_Equals(array, (Obj*)other),
-              "Empty elems don't spoil Equals");
-
-    VA_Store(other, 2, INCREF(stuff));
-    TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
-               "Non-matching value spoils Equals");
-
-    VA_Excise(array, 1, 2); // removes empty elems
-    VA_Delete(other, 1);    // leaves NULL in place of deleted elem
-    VA_Delete(other, 2);
-    TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
-               "Empty trailing elements spoil Equals");
-
-    DECREF(array);
-    DECREF(other);
-}
-
-static void
-test_Store_Fetch(TestBatch *batch) {
-    VArray *array = VA_new(0);
-    CharBuf *elem;
-
-    TEST_TRUE(batch, VA_Fetch(array, 2) == NULL, "Fetch beyond end");
-
-    VA_Store(array, 2, (Obj*)CB_newf("foo"));
-    elem = (CharBuf*)CERTIFY(VA_Fetch(array, 2), CHARBUF);
-    TEST_INT_EQ(batch, 3, VA_Get_Size(array), "Store updates size");
-    TEST_TRUE(batch, CB_Equals_Str(elem, "foo", 3), "Store");
-
-    INCREF(elem);
-    TEST_INT_EQ(batch, 2, CB_Get_RefCount(elem),
-                "start with refcount of 2");
-    VA_Store(array, 2, (Obj*)CB_newf("bar"));
-    TEST_INT_EQ(batch, 1, CB_Get_RefCount(elem),
-                "Displacing elem via Store updates refcount");
-    DECREF(elem);
-    elem = (CharBuf*)CERTIFY(VA_Fetch(array, 2), CHARBUF);
-    TEST_TRUE(batch, CB_Equals_Str(elem, "bar", 3), "Store displacement");
-
-    DECREF(array);
-}
-
-static void
-test_Push_Pop_Shift_Unshift(TestBatch *batch) {
-    VArray *array = VA_new(0);
-    CharBuf *elem;
-
-    TEST_INT_EQ(batch, VA_Get_Size(array), 0, "size starts at 0");
-    VA_Push(array, (Obj*)CB_newf("a"));
-    VA_Push(array, (Obj*)CB_newf("b"));
-    VA_Push(array, (Obj*)CB_newf("c"));
-
-    TEST_INT_EQ(batch, VA_Get_Size(array), 3, "size after Push");
-    TEST_TRUE(batch, NULL != CERTIFY(VA_Fetch(array, 2), CHARBUF), "Push");
-
-    elem = (CharBuf*)CERTIFY(VA_Shift(array), CHARBUF);
-    TEST_TRUE(batch, CB_Equals_Str(elem, "a", 1), "Shift");
-    TEST_INT_EQ(batch, VA_Get_Size(array), 2, "size after Shift");
-    DECREF(elem);
-
-    elem = (CharBuf*)CERTIFY(VA_Pop(array), CHARBUF);
-    TEST_TRUE(batch, CB_Equals_Str(elem, "c", 1), "Pop");
-    TEST_INT_EQ(batch, VA_Get_Size(array), 1, "size after Pop");
-    DECREF(elem);
-
-    VA_Unshift(array, (Obj*)CB_newf("foo"));
-    elem = (CharBuf*)CERTIFY(VA_Fetch(array, 0), CHARBUF);
-    TEST_TRUE(batch, CB_Equals_Str(elem, "foo", 3), "Unshift");
-    TEST_INT_EQ(batch, VA_Get_Size(array), 2, "size after Shift");
-
-    DECREF(array);
-}
-
-static void
-test_Delete(TestBatch *batch) {
-    VArray *wanted = VA_new(5);
-    VArray *got    = VA_new(5);
-    uint32_t i;
-
-    for (i = 0; i < 5; i++) { VA_Push(got, (Obj*)CB_newf("%u32", i)); }
-    VA_Store(wanted, 0, (Obj*)CB_newf("0", i));
-    VA_Store(wanted, 1, (Obj*)CB_newf("1", i));
-    VA_Store(wanted, 4, (Obj*)CB_newf("4", i));
-    DECREF(VA_Delete(got, 2));
-    DECREF(VA_Delete(got, 3));
-    TEST_TRUE(batch, VA_Equals(wanted, (Obj*)got), "Delete");
-
-    DECREF(wanted);
-    DECREF(got);
-}
-
-static void
-test_Resize(TestBatch *batch) {
-    VArray *array = VA_new(3);
-    uint32_t i;
-
-    for (i = 0; i < 2; i++) { VA_Push(array, (Obj*)CB_newf("%u32", i)); }
-    TEST_INT_EQ(batch, VA_Get_Capacity(array), 3, "Start with capacity 3");
-
-    VA_Resize(array, 4);
-    TEST_INT_EQ(batch, VA_Get_Size(array), 4, "Resize up");
-    TEST_INT_EQ(batch, VA_Get_Capacity(array), 4,
-                "Resize changes capacity");
-
-    VA_Resize(array, 2);
-    TEST_INT_EQ(batch, VA_Get_Size(array), 2, "Resize down");
-    TEST_TRUE(batch, VA_Fetch(array, 2) == NULL, "Resize down zaps elem");
-
-    DECREF(array);
-}
-
-static void
-test_Excise(TestBatch *batch) {
-    VArray *wanted = VA_new(5);
-    VArray *got    = VA_new(5);
-
-    for (uint32_t i = 0; i < 5; i++) {
-        VA_Push(wanted, (Obj*)CB_newf("%u32", i));
-        VA_Push(got, (Obj*)CB_newf("%u32", i));
-    }
-
-    VA_Excise(got, 7, 1);
-    TEST_TRUE(batch, VA_Equals(wanted, (Obj*)got),
-              "Excise outside of range is no-op");
-
-    VA_Excise(got, 2, 2);
-    DECREF(VA_Delete(wanted, 2));
-    DECREF(VA_Delete(wanted, 3));
-    VA_Store(wanted, 2, VA_Delete(wanted, 4));
-    VA_Resize(wanted, 3);
-    TEST_TRUE(batch, VA_Equals(wanted, (Obj*)got),
-              "Excise multiple elems");
-
-    VA_Excise(got, 2, 2);
-    VA_Resize(wanted, 2);
-    TEST_TRUE(batch, VA_Equals(wanted, (Obj*)got),
-              "Splicing too many elems truncates");
-
-    VA_Excise(got, 0, 1);
-    VA_Store(wanted, 0, VA_Delete(wanted, 1));
-    VA_Resize(wanted, 1);
-    TEST_TRUE(batch, VA_Equals(wanted, (Obj*)got),
-              "Excise first elem");
-
-    DECREF(got);
-    DECREF(wanted);
-}
-
-static void
-test_Push_VArray(TestBatch *batch) {
-    VArray *wanted  = VA_new(0);
-    VArray *got     = VA_new(0);
-    VArray *scratch = VA_new(0);
-    uint32_t i;
-
-    for (i = 0; i < 4; i++) { VA_Push(wanted, (Obj*)CB_newf("%u32", i)); }
-    for (i = 0; i < 2; i++) { VA_Push(got, (Obj*)CB_newf("%u32", i)); }
-    for (i = 2; i < 4; i++) { VA_Push(scratch, (Obj*)CB_newf("%u32", i)); }
-
-    VA_Push_VArray(got, scratch);
-    TEST_TRUE(batch, VA_Equals(wanted, (Obj*)got), "Push_VArray");
-
-    DECREF(wanted);
-    DECREF(got);
-    DECREF(scratch);
-}
-
-static void
-test_Slice(TestBatch *batch) {
-    VArray *array = VA_new(0);
-    for (uint32_t i = 0; i < 10; i++) { VA_Push(array, (Obj*)CB_newf("%u32", i)); }
-    {
-        VArray *slice = VA_Slice(array, 0, 10);
-        TEST_TRUE(batch, VA_Equals(array, (Obj*)slice), "Slice entire array");
-        DECREF(slice);
-    }
-    {
-        VArray *slice = VA_Slice(array, 0, 11);
-        TEST_TRUE(batch, VA_Equals(array, (Obj*)slice),
-            "Exceed length");
-        DECREF(slice);
-    }
-    {
-        VArray *wanted = VA_new(0);
-        VA_Push(wanted, (Obj*)CB_newf("9"));
-        VArray *slice = VA_Slice(array, 9, 11);
-        TEST_TRUE(batch, VA_Equals(slice, (Obj*)wanted),
-            "Exceed length, start near end");
-        DECREF(slice);
-        DECREF(wanted);
-    }
-    {
-        VArray *slice = VA_Slice(array, 0, 0);
-        TEST_TRUE(batch, VA_Get_Size(slice) == 0, "empty slice");
-        DECREF(slice);
-    }
-    {
-        VArray *slice = VA_Slice(array, 20, 1);
-        TEST_TRUE(batch, VA_Get_Size(slice) ==  0, "exceed offset");
-        DECREF(slice);
-    }
-    {
-        VArray *wanted = VA_new(0);
-        VA_Push(wanted, (Obj*)CB_newf("9"));
-        VArray *slice = VA_Slice(array, 9, UINT32_MAX - 1);
-        TEST_TRUE(batch, VA_Get_Size(slice) == 1, "guard against overflow");
-        DECREF(slice);
-        DECREF(wanted);
-    }
-    DECREF(array);
-}
-
-static void
-test_Clone_and_Shallow_Copy(TestBatch *batch) {
-    VArray *array = VA_new(0);
-    VArray *twin;
-    uint32_t i;
-
-    for (i = 0; i < 10; i++) {
-        VA_Push(array, (Obj*)CB_newf("%u32", i));
-    }
-    twin = VA_Shallow_Copy(array);
-    TEST_TRUE(batch, VA_Equals(array, (Obj*)twin), "Shallow_Copy");
-    TEST_TRUE(batch, VA_Fetch(array, 1) == VA_Fetch(twin, 1),
-              "Shallow_Copy doesn't clone elements");
-    DECREF(twin);
-
-    twin = VA_Clone(array);
-    TEST_TRUE(batch, VA_Equals(array, (Obj*)twin), "Clone");
-    TEST_TRUE(batch, VA_Fetch(array, 1) != VA_Fetch(twin, 1),
-              "Clone performs deep clone");
-
-    DECREF(array);
-    DECREF(twin);
-}
-
-static void
-test_Dump_and_Load(TestBatch *batch) {
-    VArray *array = VA_new(0);
-    Obj    *dump;
-    VArray *loaded;
-
-    VA_Push(array, (Obj*)S_new_cb("foo"));
-    dump = (Obj*)VA_Dump(array);
-    loaded = (VArray*)Obj_Load(dump, dump);
-    TEST_TRUE(batch, VA_Equals(array, (Obj*)loaded),
-              "Dump => Load round trip");
-
-    DECREF(array);
-    DECREF(dump);
-    DECREF(loaded);
-}
-
-static void
-test_serialization(TestBatch *batch) {
-    VArray *array = VA_new(0);
-    VArray *dupe;
-    VA_Store(array, 1, (Obj*)CB_newf("foo"));
-    VA_Store(array, 3, (Obj*)CB_newf("bar"));
-    dupe = (VArray*)TestUtils_freeze_thaw((Obj*)array);
-    TEST_TRUE(batch, dupe && VA_Equals(array, (Obj*)dupe),
-              "Round trip through FREEZE/THAW");
-    DECREF(dupe);
-    DECREF(array);
-}
-
-void
-TestVArray_run_tests(TestVArray *self) {
-    TestBatch *batch = (TestBatch*)self;
-    test_Equals(batch);
-    test_Store_Fetch(batch);
-    test_Push_Pop_Shift_Unshift(batch);
-    test_Delete(batch);
-    test_Resize(batch);
-    test_Excise(batch);
-    test_Push_VArray(batch);
-    test_Slice(batch);
-    test_Clone_and_Shallow_Copy(batch);
-    test_Dump_and_Load(batch);
-    test_serialization(batch);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Object/TestVArray.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestVArray.cfh b/core/Lucy/Test/Object/TestVArray.cfh
deleted file mode 100644
index 14a8e15..0000000
--- a/core/Lucy/Test/Object/TestVArray.cfh
+++ /dev/null
@@ -1,32 +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 Lucy;
-
-class Lucy::Test::Object::TestVArray
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestVArray*
-    new(TestFormatter *formatter);
-
-    inert TestVArray*
-    init(TestVArray *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestVArray *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index d3c41f7..e724694 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -78,7 +78,7 @@ TestUtils_random_f64s(double *buf, size_t count) {
     return f64s;
 }
 
-uint32_t
+static uint32_t
 S_random_code_point(void) {
     uint32_t code_point = 0;
     while (1) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Util/TestAtomic.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestAtomic.c b/core/Lucy/Test/Util/TestAtomic.c
deleted file mode 100644
index c4d8554..0000000
--- a/core/Lucy/Test/Util/TestAtomic.c
+++ /dev/null
@@ -1,68 +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 "Lucy/Util/ToolSet.h"
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/Util/TestAtomic.h"
-#include "Clownfish/Util/Atomic.h"
-
-TestAtomic*
-TestAtomic_new(TestFormatter *formatter) {
-    TestAtomic *self = (TestAtomic*)VTable_Make_Obj(TESTATOMIC);
-    return TestAtomic_init(self, formatter);
-}
-
-TestAtomic*
-TestAtomic_init(TestAtomic *self, TestFormatter *formatter) {
-    return (TestAtomic*)TestBatch_init((TestBatch*)self, 6, formatter);
-}
-
-static void
-test_cas_ptr(TestBatch *batch) {
-    int    foo = 1;
-    int    bar = 2;
-    int   *foo_pointer = &foo;
-    int   *bar_pointer = &bar;
-    int   *target      = NULL;
-
-    TEST_TRUE(batch,
-              Atomic_cas_ptr((void**)&target, NULL, foo_pointer),
-              "cas_ptr returns true on success");
-    TEST_TRUE(batch, target == foo_pointer, "cas_ptr sets target");
-
-    target = NULL;
-    TEST_FALSE(batch,
-               Atomic_cas_ptr((void**)&target, bar_pointer, foo_pointer),
-               "cas_ptr returns false when it old_value doesn't match");
-    TEST_TRUE(batch, target == NULL,
-              "cas_ptr doesn't do anything to target when old_value doesn't match");
-
-    target = foo_pointer;
-    TEST_TRUE(batch,
-              Atomic_cas_ptr((void**)&target, foo_pointer, bar_pointer),
-              "cas_ptr from one value to another");
-    TEST_TRUE(batch, target == bar_pointer, "cas_ptr sets target");
-}
-
-void
-TestAtomic_run_tests(TestAtomic *self) {
-    TestBatch *batch = (TestBatch*)self;
-    test_cas_ptr(batch);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Util/TestAtomic.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestAtomic.cfh b/core/Lucy/Test/Util/TestAtomic.cfh
deleted file mode 100644
index fc7060c..0000000
--- a/core/Lucy/Test/Util/TestAtomic.cfh
+++ /dev/null
@@ -1,32 +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 Lucy;
-
-class Lucy::Test::Util::TestAtomic
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestAtomic*
-    new(TestFormatter *formatter);
-
-    inert TestAtomic*
-    init(TestAtomic *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestAtomic *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Util/TestMemory.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestMemory.c b/core/Lucy/Test/Util/TestMemory.c
deleted file mode 100644
index 429c6bc..0000000
--- a/core/Lucy/Test/Util/TestMemory.c
+++ /dev/null
@@ -1,121 +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_LUCY_TESTMEMORYPOOL
-#define C_LUCY_MEMORYPOOL
-#include "Lucy/Util/ToolSet.h"
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/Util/TestMemory.h"
-
-TestMemory*
-TestMemory_new(TestFormatter *formatter) {
-    TestMemory *self = (TestMemory*)VTable_Make_Obj(TESTMEMORY);
-    return TestMemory_init(self, formatter);
-}
-
-TestMemory*
-TestMemory_init(TestMemory *self, TestFormatter *formatter) {
-    return (TestMemory*)TestBatch_init((TestBatch*)self, 30, formatter);
-}
-
-static void
-test_oversize__growth_rate(TestBatch *batch) {
-    bool     success             = true;
-    uint64_t size                = 0;
-    double   growth_count        = 0;
-    double   average_growth_rate = 0.0;
-
-    while (size < SIZE_MAX) {
-        uint64_t next_size = Memory_oversize((size_t)size + 1, sizeof(void*));
-        if (next_size < size) {
-            success = false;
-            FAIL(batch, "Asked for %" PRId64 ", got smaller amount %" PRId64,
-                 size + 1, next_size);
-            break;
-        }
-        if (size > 0) {
-            growth_count += 1;
-            double growth_rate = U64_TO_DOUBLE(next_size) /
-                                 U64_TO_DOUBLE(size);
-            double sum = growth_rate + (growth_count - 1) * average_growth_rate;
-            average_growth_rate = sum / growth_count;
-            if (average_growth_rate < 1.1) {
-                FAIL(batch, "Average growth rate dropped below 1.1x: %f",
-                     average_growth_rate);
-                success = false;
-                break;
-            }
-        }
-        size = next_size;
-    }
-    TEST_TRUE(batch, growth_count > 0, "Grew %f times", growth_count);
-    if (success) {
-        TEST_TRUE(batch, average_growth_rate > 1.1,
-                  "Growth rate of oversize() averages above 1.1: %.3f",
-                  average_growth_rate);
-    }
-
-    for (int minimum = 1; minimum < 8; minimum++) {
-        uint64_t next_size = Memory_oversize(minimum, sizeof(void*));
-        double growth_rate = U64_TO_DOUBLE(next_size) / (double)minimum;
-        TEST_TRUE(batch, growth_rate > 1.2,
-                  "Growth rate is higher for smaller arrays (%d, %.3f)", minimum,
-                  growth_rate);
-    }
-}
-
-static void
-test_oversize__ceiling(TestBatch *batch) {
-    for (int width = 0; width < 10; width++) {
-        size_t size = Memory_oversize(SIZE_MAX, width);
-        TEST_TRUE(batch, size == SIZE_MAX,
-                  "Memory_oversize hits ceiling at SIZE_MAX (width %d)", width);
-        size = Memory_oversize(SIZE_MAX - 1, width);
-        TEST_TRUE(batch, size == SIZE_MAX,
-                  "Memory_oversize hits ceiling at SIZE_MAX (width %d)", width);
-    }
-}
-
-static void
-test_oversize__rounding(TestBatch *batch) {
-    int widths[] = { 1, 2, 4, 0 };
-
-    for (int width_tick = 0; widths[width_tick] != 0; width_tick++) {
-        int width = widths[width_tick];
-        for (int i = 0; i < 25; i++) {
-            size_t size = Memory_oversize(i, width);
-            size_t bytes = size * width;
-            if (bytes % sizeof(void*) != 0) {
-                FAIL(batch, "Rounding failure for %d, width %d",
-                     i, width);
-                return;
-            }
-        }
-    }
-    PASS(batch, "Round allocations up to the size of a pointer");
-}
-
-void
-TestMemory_run_tests(TestMemory *self) {
-    TestBatch *batch = (TestBatch*)self;
-    test_oversize__growth_rate(batch);
-    test_oversize__ceiling(batch);
-    test_oversize__rounding(batch);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Util/TestMemory.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestMemory.cfh b/core/Lucy/Test/Util/TestMemory.cfh
deleted file mode 100644
index 9b95716..0000000
--- a/core/Lucy/Test/Util/TestMemory.cfh
+++ /dev/null
@@ -1,32 +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 Lucy;
-
-class Lucy::Test::Util::TestMemory
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestMemory*
-    new(TestFormatter *formatter);
-
-    inert TestMemory*
-    init(TestMemory *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestMemory *self);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Util/TestNumberUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestNumberUtils.c b/core/Lucy/Test/Util/TestNumberUtils.c
deleted file mode 100644
index fecab9a..0000000
--- a/core/Lucy/Test/Util/TestNumberUtils.c
+++ /dev/null
@@ -1,376 +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_LUCY_TESTNUMBERUTILS
-#include "Lucy/Util/ToolSet.h"
-#include <stdlib.h>
-#include <time.h>
-
-#include "Clownfish/Test/TestFormatter.h"
-#include "Lucy/Test.h"
-#include "Lucy/Test/TestUtils.h"
-#include "Lucy/Test/Util/TestNumberUtils.h"
-#include "Clownfish/Util/NumberUtils.h"
-
-TestNumberUtils*
-TestNumUtil_new(TestFormatter *formatter) {
-    TestNumberUtils *self = (TestNumberUtils*)VTable_Make_Obj(TESTNUMBERUTILS);
-    return TestNumUtil_init(self, formatter);
-}
-
-TestNumberUtils*
-TestNumUtil_init(TestNumberUtils *self, TestFormatter *formatter) {
-    return (TestNumberUtils*)TestBatch_init((TestBatch*)self, 1196, formatter);
-}
-
-static void
-test_u1(TestBatch *batch) {
-    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(batch, 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(batch, NumUtil_u1get(bits, i), !ints[i], "u1 flip");
-    }
-
-    FREEMEM(bits);
-    FREEMEM(ints);
-}
-
-static void
-test_u2(TestBatch *batch) {
-    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(batch, NumUtil_u2get(bits, i), (long)ints[i], "u2");
-    }
-
-    FREEMEM(bits);
-    FREEMEM(ints);
-}
-
-static void
-test_u4(TestBatch *batch) {
-    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(batch, NumUtil_u4get(bits, i), (long)ints[i], "u4");
-    }
-
-    FREEMEM(bits);
-    FREEMEM(ints);
-}
-
-static void
-test_c32(TestBatch *batch) {
-    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(batch, NumUtil_decode_c32(&target), (long)ints[i],
-                        "c32 %lu", (long)ints[i]);
-            NumUtil_skip_cint(&skip);
-            if (target > limit) { THROW(ERR, "overrun"); }
-        }
-        TEST_TRUE(batch, 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(batch, 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(batch, 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(batch, 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(batch, NumUtil_decode_c32(&target), UINT32_MAX, "c32 UINT32_MAX");
-
-    FREEMEM(encoded);
-    FREEMEM(ints);
-}
-
-static void
-test_c64(TestBatch *batch) {
-    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(batch, got == ints[i],
-                      "c64 %" PRIu64 " == %" PRIu64, got, ints[i]);
-            if (target > limit) { THROW(ERR, "overrun"); }
-            NumUtil_skip_cint(&skip);
-        }
-        TEST_TRUE(batch, 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(batch, got == UINT64_MAX, "c64 UINT64_MAX");
-
-    FREEMEM(encoded);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_u16(TestBatch *batch) {
-    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(batch, got, (long)ints[i], "bigend u16");
-        target += sizeof(uint16_t);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_u16(1, &target);
-    TEST_INT_EQ(batch, encoded[0], 0, "Truly big-endian u16");
-    TEST_INT_EQ(batch, encoded[1], 1, "Truly big-endian u16");
-
-    FREEMEM(allocated);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_u32(TestBatch *batch) {
-    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(batch, got, (long)ints[i], "bigend u32");
-        target += sizeof(uint32_t);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_u32(1, &target);
-    TEST_INT_EQ(batch, encoded[0], 0, "Truly big-endian u32");
-    TEST_INT_EQ(batch, encoded[3], 1, "Truly big-endian u32");
-
-    FREEMEM(allocated);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_u64(TestBatch *batch) {
-    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(batch, got == ints[i], "bigend u64");
-        target += sizeof(uint64_t);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_u64(1, &target);
-    TEST_INT_EQ(batch, encoded[0], 0, "Truly big-endian");
-    TEST_INT_EQ(batch, encoded[7], 1, "Truly big-endian");
-
-    FREEMEM(allocated);
-    FREEMEM(ints);
-}
-
-static void
-test_bigend_f32(TestBatch *batch) {
-    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(batch, got == source[i], "bigend f32");
-        target += sizeof(float);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_f32(-2.0f, &target);
-    TEST_INT_EQ(batch, (encoded[0] & 0x80), 0x80,
-                "Truly big-endian (IEEE 754 sign bit set for negative number)");
-    TEST_INT_EQ(batch, encoded[0], 0xC0,
-                "IEEE 754 representation of -2.0f, byte 0");
-    for (size_t i = 1; i < sizeof(float); i++) {
-        TEST_INT_EQ(batch, encoded[i], 0,
-                    "IEEE 754 representation of -2.0f, byte %d", (int)i);
-    }
-
-    FREEMEM(allocated);
-}
-
-static void
-test_bigend_f64(TestBatch *batch) {
-    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(batch, got == source[i], "bigend f64");
-        target += sizeof(double);
-    }
-
-    target = encoded;
-    NumUtil_encode_bigend_f64(-2.0, &target);
-    TEST_INT_EQ(batch, (encoded[0] & 0x80), 0x80,
-                "Truly big-endian (IEEE 754 sign bit set for negative number)");
-    TEST_INT_EQ(batch, encoded[0], 0xC0,
-                "IEEE 754 representation of -2.0, byte 0");
-    for (size_t i = 1; i < sizeof(double); i++) {
-        TEST_INT_EQ(batch, encoded[i], 0,
-                    "IEEE 754 representation of -2.0, byte %d", (int)i);
-    }
-
-    FREEMEM(allocated);
-}
-
-void
-TestNumUtil_run_tests(TestNumberUtils *self) {
-    TestBatch *batch = (TestBatch*)self;
-    srand((unsigned int)time((time_t*)NULL));
-    test_u1(batch);
-    test_u2(batch);
-    test_u4(batch);
-    test_c32(batch);
-    test_c64(batch);
-    test_bigend_u16(batch);
-    test_bigend_u32(batch);
-    test_bigend_u64(batch);
-    test_bigend_f32(batch);
-    test_bigend_f64(batch);
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/9f826b31/core/Lucy/Test/Util/TestNumberUtils.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestNumberUtils.cfh b/core/Lucy/Test/Util/TestNumberUtils.cfh
deleted file mode 100644
index 0c5236d..0000000
--- a/core/Lucy/Test/Util/TestNumberUtils.cfh
+++ /dev/null
@@ -1,32 +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 Lucy;
-
-class Lucy::Test::Util::TestNumberUtils cnick TestNumUtil
-    inherits Clownfish::Test::TestBatch {
-
-    inert incremented TestNumberUtils*
-    new(TestFormatter *formatter);
-
-    inert TestNumberUtils*
-    init(TestNumberUtils *self, TestFormatter *formatter);
-
-    void
-    Run_Tests(TestNumberUtils *self);
-}
-
-