You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/05/02 01:50:38 UTC
[lucy-commits] svn commit: r1098445 [18/23] - in /incubator/lucy/trunk: charmonizer/
charmonizer/src/Charmonizer/ charmonizer/src/Charmonizer/Core/
charmonizer/src/Charmonizer/Probe/ charmonizer/src/Charmonizer/Test/
clownfish/lib/ clownfish/lib/Clownfish/Binding/ cl...
Modified: incubator/lucy/trunk/core/Lucy/Test/Object/TestNum.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Object/TestNum.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Object/TestNum.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Object/TestNum.c Sun May 1 23:50:24 2011
@@ -22,8 +22,7 @@
#include "Lucy/Test/Object/TestNum.h"
static void
-test_To_String(TestBatch *batch)
-{
+test_To_String(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
Integer32 *i32 = Int32_new(I32_MAX);
@@ -34,13 +33,13 @@ test_To_String(TestBatch *batch)
CharBuf *i64_string = Int64_To_String(i64);
TEST_TRUE(batch, CB_Starts_With_Str(f32_string, "1.3", 3),
- "Float32_To_String");
+ "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");
+ "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");
+ "Int64_To_String");
DECREF(i64_string);
DECREF(i32_string);
@@ -53,8 +52,7 @@ test_To_String(TestBatch *batch)
}
static void
-test_accessors(TestBatch *batch)
-{
+test_accessors(TestBatch *batch) {
Float32 *f32 = Float32_new(1.0);
Float64 *f64 = Float64_new(1.0);
Integer32 *i32 = Int32_new(1);
@@ -65,32 +63,32 @@ test_accessors(TestBatch *batch)
double got64;
Float32_Set_Value(f32, 1.33f);
- TEST_FLOAT_EQ(batch, Float32_Get_Value(f32), 1.33f,
- "F32 Set_Value Get_Value");
+ 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");
+ "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");
+ 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");
+ TEST_TRUE(batch, *(int64_t*)&got64 == *(int64_t*)&wanted64,
+ "Float64_To_F64");
Int32_Set_Value(i32, I32_MIN);
- TEST_INT_EQ(batch, Int32_Get_Value(i32), I32_MIN,
- "I32 Set_Value Get_Value");
+ TEST_INT_EQ(batch, Int32_Get_Value(i32), I32_MIN,
+ "I32 Set_Value Get_Value");
Int64_Set_Value(i64, I64_MIN);
- TEST_TRUE(batch, Int64_Get_Value(i64) == I64_MIN,
- "I64 Set_Value Get_Value");
+ TEST_TRUE(batch, Int64_Get_Value(i64) == I64_MIN,
+ "I64 Set_Value Get_Value");
Int32_Set_Value(i32, -1);
Int64_Set_Value(i64, -1);
@@ -104,60 +102,59 @@ test_accessors(TestBatch *batch)
}
static void
-test_Equals_and_Compare_To(TestBatch *batch)
-{
+test_Equals_and_Compare_To(TestBatch *batch) {
Float32 *f32 = Float32_new(1.0);
Float64 *f64 = Float64_new(1.0);
Integer32 *i32 = Int32_new(I32_MAX);
Integer64 *i64 = Int64_new(I64_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");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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, I64_MAX * 2.0);
TEST_TRUE(batch, Float64_Compare_To(f64, (Obj*)i64) > 0,
- "Float64 comparison to Integer64");
+ "Float64 comparison to Integer64");
TEST_TRUE(batch, Int64_Compare_To(i64, (Obj*)f64) < 0,
- "Integer64 comparison to Float64");
+ "Integer64 comparison to Float64");
Float32_Set_Value(f32, I32_MAX * 2.0f);
TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)i32) > 0,
- "Float32 comparison to Integer32");
+ "Float32 comparison to Integer32");
TEST_TRUE(batch, Int32_Compare_To(i32, (Obj*)f32) < 0,
- "Integer32 comparison to Float32");
+ "Integer32 comparison to Float32");
DECREF(i64);
DECREF(i32);
@@ -166,8 +163,7 @@ test_Equals_and_Compare_To(TestBatch *ba
}
static void
-test_Clone(TestBatch *batch)
-{
+test_Clone(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
Integer32 *i32 = Int32_new(I32_MAX);
@@ -176,14 +172,14 @@ test_Clone(TestBatch *batch)
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, 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");
+ "Float64 Clone");
+ TEST_TRUE(batch, Int32_Equals(i32, (Obj*)i32_dupe),
+ "Integer32 Clone");
TEST_TRUE(batch, Int64_Equals(i64, (Obj*)i64_dupe),
- "Integer64 Clone");
+ "Integer64 Clone");
DECREF(i64_dupe);
DECREF(i32_dupe);
DECREF(f64_dupe);
@@ -195,8 +191,7 @@ test_Clone(TestBatch *batch)
}
static void
-test_Mimic(TestBatch *batch)
-{
+test_Mimic(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
Integer32 *i32 = Int32_new(I32_MAX);
@@ -209,14 +204,14 @@ test_Mimic(TestBatch *batch)
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, 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");
+ "Float64 Mimic");
+ TEST_TRUE(batch, Int32_Equals(i32, (Obj*)i32_dupe),
+ "Integer32 Mimic");
TEST_TRUE(batch, Int64_Equals(i64, (Obj*)i64_dupe),
- "Integer64 Mimic");
+ "Integer64 Mimic");
DECREF(i64_dupe);
DECREF(i32_dupe);
DECREF(f64_dupe);
@@ -228,8 +223,7 @@ test_Mimic(TestBatch *batch)
}
static void
-test_serialization(TestBatch *batch)
-{
+test_serialization(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
Integer32 *i32 = Int32_new(-1);
@@ -239,14 +233,14 @@ test_serialization(TestBatch *batch)
Integer32 *i32_thaw = (Integer32*)TestUtils_freeze_thaw((Obj*)i32);
Integer64 *i64_thaw = (Integer64*)TestUtils_freeze_thaw((Obj*)i64);
- TEST_TRUE(batch, Float32_Equals(f32, (Obj*)f32_thaw),
- "Float32 freeze/thaw");
+ 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");
+ "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");
+ "Integer64 freeze/thaw");
DECREF(i64_thaw);
DECREF(i32_thaw);
@@ -259,8 +253,7 @@ test_serialization(TestBatch *batch)
}
void
-TestNum_run_tests()
-{
+TestNum_run_tests() {
TestBatch *batch = TestBatch_new(42);
TestBatch_Plan(batch);
@@ -270,7 +263,7 @@ TestNum_run_tests()
test_Clone(batch);
test_Mimic(batch);
test_serialization(batch);
-
+
DECREF(batch);
}
Modified: incubator/lucy/trunk/core/Lucy/Test/Object/TestObj.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Object/TestObj.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Object/TestObj.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Object/TestObj.c Sun May 1 23:50:24 2011
@@ -21,8 +21,7 @@
#include "Lucy/Test/Object/TestObj.h"
static Obj*
-S_new_testobj()
-{
+S_new_testobj() {
ZombieCharBuf *klass = ZCB_WRAP_STR("TestObj", 7);
Obj *obj;
VTable *vtable = VTable_fetch_vtable((CharBuf*)klass);
@@ -34,29 +33,27 @@ S_new_testobj()
}
static void
-test_refcounts(TestBatch *batch)
-{
- Obj *obj = S_new_testobj();
+test_refcounts(TestBatch *batch) {
+ Obj *obj = S_new_testobj();
- TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 1,
- "Correct starting refcount");
+ 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" );
+ 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" );
+ TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 1, "Dec_RefCount");
DECREF(obj);
}
static void
-test_To_String(TestBatch *batch)
-{
+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)) {
+ while (ZCB_Get_Size(temp)) {
if (ZCB_Starts_With_Str(temp, "TestObj", 7)) { break; }
ZCB_Nip_One(temp);
}
@@ -66,47 +63,43 @@ test_To_String(TestBatch *batch)
}
static void
-test_Dump(TestBatch *batch)
-{
+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");
+ 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)
-{
+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");
+ 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)
-{
+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");
+ TEST_TRUE(batch, (Obj_Hash_Sum(testobj) == address32),
+ "Hash_Sum uses memory address");
DECREF(testobj);
}
static void
-test_Is_A(TestBatch *batch)
-{
+test_Is_A(TestBatch *batch) {
CharBuf *charbuf = CB_new(0);
VTable *bb_vtable = CB_Get_VTable(charbuf);
CharBuf *klass = CB_Get_Class_Name(charbuf);
@@ -115,15 +108,14 @@ test_Is_A(TestBatch *batch)
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");
+ "Get_Class_Name");
DECREF(charbuf);
}
void
-TestObj_run_tests()
-{
+TestObj_run_tests() {
TestBatch *batch = TestBatch_new(12);
TestBatch_Plan(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Object/TestVArray.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Object/TestVArray.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Object/TestVArray.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Object/TestVArray.c Sun May 1 23:50:24 2011
@@ -22,54 +22,51 @@
#include "Lucy/Test/Object/TestVArray.h"
static CharBuf*
-S_new_cb(const char *text)
-{
+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);
+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");
+ TEST_TRUE(batch, VA_Equals(array, (Obj*)other),
+ "Empty arrays are equal");
VA_Push(array, INCREF(&EMPTY));
- TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
- "Add one elem and Equals returns false");
+ TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
+ "Add one elem and Equals returns false");
VA_Push(other, INCREF(&EMPTY));
- TEST_TRUE(batch, VA_Equals(array, (Obj*)other),
- "Add a matching elem and Equals returns true");
+ TEST_TRUE(batch, VA_Equals(array, (Obj*)other),
+ "Add a matching elem and Equals returns true");
VA_Store(array, 2, INCREF(&EMPTY));
- TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
- "Add elem after a NULL and Equals returns false");
+ TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
+ "Add elem after a NULL and Equals returns false");
VA_Store(other, 2, INCREF(&EMPTY));
- TEST_TRUE(batch, VA_Equals(array, (Obj*)other),
- "Empty elems don't spoil Equals");
+ 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");
+ 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");
+ TEST_FALSE(batch, VA_Equals(array, (Obj*)other),
+ "Empty trailing elements spoil Equals");
DECREF(array);
DECREF(other);
}
static void
-test_Store_Fetch(TestBatch *batch)
-{
+test_Store_Fetch(TestBatch *batch) {
VArray *array = VA_new(0);
CharBuf *elem;
@@ -81,11 +78,11 @@ test_Store_Fetch(TestBatch *batch)
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");
+ 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");
+ 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");
@@ -94,8 +91,7 @@ test_Store_Fetch(TestBatch *batch)
}
static void
-test_Push_Pop_Shift_Unshift(TestBatch *batch)
-{
+test_Push_Pop_Shift_Unshift(TestBatch *batch) {
VArray *array = VA_new(0);
CharBuf *elem;
@@ -126,8 +122,7 @@ test_Push_Pop_Shift_Unshift(TestBatch *b
}
static void
-test_Delete(TestBatch *batch)
-{
+test_Delete(TestBatch *batch) {
VArray *wanted = VA_new(5);
VArray *got = VA_new(5);
uint32_t i;
@@ -145,8 +140,7 @@ test_Delete(TestBatch *batch)
}
static void
-test_Resize(TestBatch *batch)
-{
+test_Resize(TestBatch *batch) {
VArray *array = VA_new(3);
uint32_t i;
@@ -155,8 +149,8 @@ test_Resize(TestBatch *batch)
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");
+ 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");
@@ -166,46 +160,44 @@ test_Resize(TestBatch *batch)
}
static void
-test_Excise(TestBatch *batch)
-{
+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_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" );
+ 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_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" );
+ 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" );
+ TEST_TRUE(batch, VA_Equals(wanted, (Obj*)got),
+ "Excise first elem");
DECREF(got);
DECREF(wanted);
}
static void
-test_Push_VArray(TestBatch *batch)
-{
+test_Push_VArray(TestBatch *batch) {
VArray *wanted = VA_new(0);
VArray *got = VA_new(0);
VArray *scratch = VA_new(0);
@@ -224,9 +216,8 @@ test_Push_VArray(TestBatch *batch)
}
static void
-test_Clone_and_Shallow_Copy(TestBatch *batch)
-{
- VArray *array = VA_new(0);
+test_Clone_and_Shallow_Copy(TestBatch *batch) {
+ VArray *array = VA_new(0);
VArray *twin;
uint32_t i;
@@ -235,31 +226,30 @@ test_Clone_and_Shallow_Copy(TestBatch *b
}
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");
+ 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");
+ 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);
+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");
+ TEST_TRUE(batch, VA_Equals(array, (Obj*)loaded),
+ "Dump => Load round trip");
DECREF(array);
DECREF(dump);
@@ -267,22 +257,20 @@ test_Dump_and_Load(TestBatch *batch)
}
static void
-test_serialization(TestBatch *batch)
-{
- VArray *array = VA_new(0);
+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");
+ TEST_TRUE(batch, dupe && VA_Equals(array, (Obj*)dupe),
+ "Round trip through FREEZE/THAW");
DECREF(dupe);
DECREF(array);
}
void
-TestVArray_run_tests()
-{
+TestVArray_run_tests() {
TestBatch *batch = TestBatch_new(39);
TestBatch_Plan(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.c Sun May 1 23:50:24 2011
@@ -22,30 +22,26 @@
#include "Lucy/Plan/Architecture.h"
TestArchitecture*
-TestArch_new()
-{
- TestArchitecture *self
+TestArch_new() {
+ TestArchitecture *self
= (TestArchitecture*)VTable_Make_Obj(TESTARCHITECTURE);
return TestArch_init(self);
}
TestArchitecture*
-TestArch_init(TestArchitecture *self)
-{
+TestArch_init(TestArchitecture *self) {
Arch_init((Architecture*)self);
return self;
}
int32_t
-TestArch_index_interval(TestArchitecture *self)
-{
+TestArch_index_interval(TestArchitecture *self) {
UNUSED_VAR(self);
return 5;
}
int32_t
-TestArch_skip_interval(TestArchitecture *self)
-{
+TestArch_skip_interval(TestArchitecture *self) {
UNUSED_VAR(self);
return 3;
}
Modified: incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Plan/TestArchitecture.cfh Sun May 1 23:50:24 2011
@@ -23,7 +23,7 @@ parcel Lucy;
class Lucy::Test::Plan::TestArchitecture cnick TestArch
inherits Lucy::Plan::Architecture {
- inert incremented TestArchitecture*
+ inert incremented TestArchitecture*
new();
inert TestArchitecture*
@@ -32,7 +32,7 @@ class Lucy::Test::Plan::TestArchitecture
public int32_t
Index_Interval(TestArchitecture *self);
- public int32_t
+ public int32_t
Skip_Interval(TestArchitecture *self);
}
Modified: incubator/lucy/trunk/core/Lucy/Test/Plan/TestBlobType.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Plan/TestBlobType.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Plan/TestBlobType.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Plan/TestBlobType.c Sun May 1 23:50:24 2011
@@ -24,18 +24,17 @@
#include "Lucy/Analysis/RegexTokenizer.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
BlobType *type = BlobType_new(true);
Obj *dump = (Obj*)BlobType_Dump(type);
Obj *clone = Obj_Load(dump, dump);
Obj *another_dump = (Obj*)BlobType_Dump_For_Schema(type);
BlobType *another_clone = BlobType_load(NULL, another_dump);
- TEST_TRUE(batch, BlobType_Equals(type, (Obj*)clone),
- "Dump => Load round trip");
- TEST_TRUE(batch, BlobType_Equals(type, (Obj*)another_clone),
- "Dump_For_Schema => Load round trip");
+ TEST_TRUE(batch, BlobType_Equals(type, (Obj*)clone),
+ "Dump => Load round trip");
+ TEST_TRUE(batch, BlobType_Equals(type, (Obj*)another_clone),
+ "Dump_For_Schema => Load round trip");
DECREF(type);
DECREF(dump);
@@ -45,8 +44,7 @@ test_Dump_Load_and_Equals(TestBatch *bat
}
void
-TestBlobType_run_tests()
-{
+TestBlobType_run_tests() {
TestBatch *batch = TestBatch_new(2);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Plan/TestFieldType.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Plan/TestFieldType.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Plan/TestFieldType.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Plan/TestFieldType.c Sun May 1 23:50:24 2011
@@ -23,15 +23,13 @@
#include "Lucy/Test/TestUtils.h"
DummyFieldType*
-DummyFieldType_new()
-{
+DummyFieldType_new() {
DummyFieldType *self = (DummyFieldType*)VTable_Make_Obj(DUMMYFIELDTYPE);
return (DummyFieldType*)FType_init((FieldType*)self);
}
static FieldType*
-S_alt_field_type()
-{
+S_alt_field_type() {
ZombieCharBuf *name = ZCB_WRAP_STR("DummyFieldType2", 15);
VTable *vtable = VTable_singleton((CharBuf*)name, DUMMYFIELDTYPE);
FieldType *self = (FieldType*)VTable_Make_Obj(vtable);
@@ -39,8 +37,7 @@ S_alt_field_type()
}
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
FieldType *type = (FieldType*)DummyFieldType_new();
FieldType *other = (FieldType*)DummyFieldType_new();
FieldType *class_differs = S_alt_field_type();
@@ -57,17 +54,17 @@ test_Dump_Load_and_Equals(TestBatch *bat
FType_Set_Stored(stored, true);
TEST_TRUE(batch, FType_Equals(type, (Obj*)other),
- "Equals() true with identical stats");
+ "Equals() true with identical stats");
TEST_FALSE(batch, FType_Equals(type, (Obj*)class_differs),
- "Equals() false with subclass");
+ "Equals() false with subclass");
TEST_FALSE(batch, FType_Equals(type, (Obj*)class_differs),
- "Equals() false with super class");
+ "Equals() false with super class");
TEST_FALSE(batch, FType_Equals(type, (Obj*)boost_differs),
- "Equals() false with different boost");
+ "Equals() false with different boost");
TEST_FALSE(batch, FType_Equals(type, (Obj*)indexed),
- "Equals() false with indexed => true");
+ "Equals() false with indexed => true");
TEST_FALSE(batch, FType_Equals(type, (Obj*)stored),
- "Equals() false with stored => true");
+ "Equals() false with stored => true");
DECREF(stored);
DECREF(indexed);
@@ -77,28 +74,26 @@ test_Dump_Load_and_Equals(TestBatch *bat
}
static void
-test_Compare_Values(TestBatch *batch)
-{
+test_Compare_Values(TestBatch *batch) {
FieldType *type = (FieldType*)DummyFieldType_new();
ZombieCharBuf *a = ZCB_WRAP_STR("a", 1);
ZombieCharBuf *b = ZCB_WRAP_STR("b", 1);
- TEST_TRUE(batch,
- FType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
- "a less than b");
- TEST_TRUE(batch,
- FType_Compare_Values(type, (Obj*)b, (Obj*)a) > 0,
- "b greater than a");
- TEST_TRUE(batch,
- FType_Compare_Values(type, (Obj*)b, (Obj*)b) == 0,
- "b equals b");
+ TEST_TRUE(batch,
+ FType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
+ "a less than b");
+ TEST_TRUE(batch,
+ FType_Compare_Values(type, (Obj*)b, (Obj*)a) > 0,
+ "b greater than a");
+ TEST_TRUE(batch,
+ FType_Compare_Values(type, (Obj*)b, (Obj*)b) == 0,
+ "b equals b");
DECREF(type);
}
void
-TestFType_run_tests()
-{
+TestFType_run_tests() {
TestBatch *batch = TestBatch_new(9);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Plan/TestFullTextType.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Plan/TestFullTextType.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Plan/TestFullTextType.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Plan/TestFullTextType.c Sun May 1 23:50:24 2011
@@ -25,8 +25,7 @@
#include "Lucy/Analysis/RegexTokenizer.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
RegexTokenizer *tokenizer = RegexTokenizer_new(NULL);
CaseFolder *case_folder = CaseFolder_new();
FullTextType *type = FullTextType_new((Analyzer*)tokenizer);
@@ -49,19 +48,19 @@ test_Dump_Load_and_Equals(TestBatch *bat
FullTextType *another_clone = FullTextType_load(NULL, another_dump);
TEST_FALSE(batch, FullTextType_Equals(type, (Obj*)boost_differs),
- "Equals() false with different boost");
+ "Equals() false with different boost");
TEST_FALSE(batch, FullTextType_Equals(type, (Obj*)other),
- "Equals() false with different Analyzer");
+ "Equals() false with different Analyzer");
TEST_FALSE(batch, FullTextType_Equals(type, (Obj*)not_indexed),
- "Equals() false with indexed => false");
+ "Equals() false with indexed => false");
TEST_FALSE(batch, FullTextType_Equals(type, (Obj*)not_stored),
- "Equals() false with stored => false");
+ "Equals() false with stored => false");
TEST_FALSE(batch, FullTextType_Equals(type, (Obj*)highlightable),
- "Equals() false with highlightable => true");
- TEST_TRUE(batch, FullTextType_Equals(type, (Obj*)clone),
- "Dump => Load round trip");
- TEST_TRUE(batch, FullTextType_Equals(type, (Obj*)another_clone),
- "Dump_For_Schema => Load round trip");
+ "Equals() false with highlightable => true");
+ TEST_TRUE(batch, FullTextType_Equals(type, (Obj*)clone),
+ "Dump => Load round trip");
+ TEST_TRUE(batch, FullTextType_Equals(type, (Obj*)another_clone),
+ "Dump_For_Schema => Load round trip");
DECREF(another_clone);
DECREF(dump);
@@ -78,30 +77,28 @@ test_Dump_Load_and_Equals(TestBatch *bat
}
static void
-test_Compare_Values(TestBatch *batch)
-{
+test_Compare_Values(TestBatch *batch) {
RegexTokenizer *tokenizer = RegexTokenizer_new(NULL);
FullTextType *type = FullTextType_new((Analyzer*)tokenizer);
ZombieCharBuf *a = ZCB_WRAP_STR("a", 1);
ZombieCharBuf *b = ZCB_WRAP_STR("b", 1);
- TEST_TRUE(batch,
- FullTextType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
- "a less than b");
- TEST_TRUE(batch,
- FullTextType_Compare_Values(type, (Obj*)b, (Obj*)a) > 0,
- "b greater than a");
- TEST_TRUE(batch,
- FullTextType_Compare_Values(type, (Obj*)b, (Obj*)b) == 0,
- "b equals b");
+ TEST_TRUE(batch,
+ FullTextType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
+ "a less than b");
+ TEST_TRUE(batch,
+ FullTextType_Compare_Values(type, (Obj*)b, (Obj*)a) > 0,
+ "b greater than a");
+ TEST_TRUE(batch,
+ FullTextType_Compare_Values(type, (Obj*)b, (Obj*)b) == 0,
+ "b equals b");
DECREF(type);
DECREF(tokenizer);
}
void
-TestFullTextType_run_tests()
-{
+TestFullTextType_run_tests() {
TestBatch *batch = TestBatch_new(10);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Plan/TestNumericType.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Plan/TestNumericType.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Plan/TestNumericType.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Plan/TestNumericType.c Sun May 1 23:50:24 2011
@@ -24,38 +24,37 @@
#include "Lucy/Plan/NumericType.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
Int32Type *i32 = Int32Type_new();
Int64Type *i64 = Int64Type_new();
Float32Type *f32 = Float32Type_new();
Float64Type *f64 = Float64Type_new();
- TEST_FALSE(batch, Int32Type_Equals(i32, (Obj*)i64),
- "Int32Type_Equals() false for different type");
- TEST_FALSE(batch, Int32Type_Equals(i32, NULL),
- "Int32Type_Equals() false for NULL");
-
- TEST_FALSE(batch, Int64Type_Equals(i64, (Obj*)i32),
- "Int64Type_Equals() false for different type");
- TEST_FALSE(batch, Int64Type_Equals(i64, NULL),
- "Int64Type_Equals() false for NULL");
-
- TEST_FALSE(batch, Float32Type_Equals(f32, (Obj*)f64),
- "Float32Type_Equals() false for different type");
- TEST_FALSE(batch, Float32Type_Equals(f32, NULL),
- "Float32Type_Equals() false for NULL");
-
- TEST_FALSE(batch, Float64Type_Equals(f64, (Obj*)f32),
- "Float64Type_Equals() false for different type");
- TEST_FALSE(batch, Float64Type_Equals(f64, NULL),
- "Float64Type_Equals() false for NULL");
+ TEST_FALSE(batch, Int32Type_Equals(i32, (Obj*)i64),
+ "Int32Type_Equals() false for different type");
+ TEST_FALSE(batch, Int32Type_Equals(i32, NULL),
+ "Int32Type_Equals() false for NULL");
+
+ TEST_FALSE(batch, Int64Type_Equals(i64, (Obj*)i32),
+ "Int64Type_Equals() false for different type");
+ TEST_FALSE(batch, Int64Type_Equals(i64, NULL),
+ "Int64Type_Equals() false for NULL");
+
+ TEST_FALSE(batch, Float32Type_Equals(f32, (Obj*)f64),
+ "Float32Type_Equals() false for different type");
+ TEST_FALSE(batch, Float32Type_Equals(f32, NULL),
+ "Float32Type_Equals() false for NULL");
+
+ TEST_FALSE(batch, Float64Type_Equals(f64, (Obj*)f32),
+ "Float64Type_Equals() false for different type");
+ TEST_FALSE(batch, Float64Type_Equals(f64, NULL),
+ "Float64Type_Equals() false for NULL");
{
Obj *dump = (Obj*)Int32Type_Dump(i32);
Obj *other = Obj_Load(dump, dump);
- TEST_TRUE(batch, Int32Type_Equals(i32, other),
- "Dump => Load round trip for Int32Type");
+ TEST_TRUE(batch, Int32Type_Equals(i32, other),
+ "Dump => Load round trip for Int32Type");
DECREF(dump);
DECREF(other);
}
@@ -63,8 +62,8 @@ test_Dump_Load_and_Equals(TestBatch *bat
{
Obj *dump = (Obj*)Int64Type_Dump(i64);
Obj *other = Obj_Load(dump, dump);
- TEST_TRUE(batch, Int64Type_Equals(i64, other),
- "Dump => Load round trip for Int64Type");
+ TEST_TRUE(batch, Int64Type_Equals(i64, other),
+ "Dump => Load round trip for Int64Type");
DECREF(dump);
DECREF(other);
}
@@ -72,8 +71,8 @@ test_Dump_Load_and_Equals(TestBatch *bat
{
Obj *dump = (Obj*)Float32Type_Dump(f32);
Obj *other = Obj_Load(dump, dump);
- TEST_TRUE(batch, Float32Type_Equals(f32, other),
- "Dump => Load round trip for Float32Type");
+ TEST_TRUE(batch, Float32Type_Equals(f32, other),
+ "Dump => Load round trip for Float32Type");
DECREF(dump);
DECREF(other);
}
@@ -81,8 +80,8 @@ test_Dump_Load_and_Equals(TestBatch *bat
{
Obj *dump = (Obj*)Float64Type_Dump(f64);
Obj *other = Obj_Load(dump, dump);
- TEST_TRUE(batch, Float64Type_Equals(f64, other),
- "Dump => Load round trip for Float64Type");
+ TEST_TRUE(batch, Float64Type_Equals(f64, other),
+ "Dump => Load round trip for Float64Type");
DECREF(dump);
DECREF(other);
}
@@ -94,8 +93,7 @@ test_Dump_Load_and_Equals(TestBatch *bat
}
void
-TestNumericType_run_tests()
-{
+TestNumericType_run_tests() {
TestBatch *batch = TestBatch_new(12);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestLeafQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestLeafQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestLeafQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestLeafQuery.c Sun May 1 23:50:24 2011
@@ -24,8 +24,7 @@
#include "Lucy/Search/LeafQuery.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
LeafQuery *query = TestUtils_make_leaf_query("content", "foo");
LeafQuery *field_differs = TestUtils_make_leaf_query("stuff", "foo");
LeafQuery *null_field = TestUtils_make_leaf_query(NULL, "foo");
@@ -35,16 +34,16 @@ test_Dump_Load_and_Equals(TestBatch *bat
LeafQuery *clone = (LeafQuery*)LeafQuery_Load(term_differs, dump);
TEST_FALSE(batch, LeafQuery_Equals(query, (Obj*)field_differs),
- "Equals() false with different field");
+ "Equals() false with different field");
TEST_FALSE(batch, LeafQuery_Equals(query, (Obj*)null_field),
- "Equals() false with null field");
+ "Equals() false with null field");
TEST_FALSE(batch, LeafQuery_Equals(query, (Obj*)term_differs),
- "Equals() false with different term");
+ "Equals() false with different term");
LeafQuery_Set_Boost(boost_differs, 0.5);
TEST_FALSE(batch, LeafQuery_Equals(query, (Obj*)boost_differs),
- "Equals() false with different boost");
- TEST_TRUE(batch, LeafQuery_Equals(query, (Obj*)clone),
- "Dump => Load round trip");
+ "Equals() false with different boost");
+ TEST_TRUE(batch, LeafQuery_Equals(query, (Obj*)clone),
+ "Dump => Load round trip");
DECREF(query);
DECREF(term_differs);
@@ -56,8 +55,7 @@ test_Dump_Load_and_Equals(TestBatch *bat
}
void
-TestLeafQuery_run_tests()
-{
+TestLeafQuery_run_tests() {
TestBatch *batch = TestBatch_new(5);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestMatchAllQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestMatchAllQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestMatchAllQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestMatchAllQuery.c Sun May 1 23:50:24 2011
@@ -24,14 +24,13 @@
#include "Lucy/Search/MatchAllQuery.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
MatchAllQuery *query = MatchAllQuery_new();
Obj *dump = (Obj*)MatchAllQuery_Dump(query);
MatchAllQuery *clone = (MatchAllQuery*)MatchAllQuery_Load(query, dump);
- TEST_TRUE(batch, MatchAllQuery_Equals(query, (Obj*)clone),
- "Dump => Load round trip");
+ TEST_TRUE(batch, MatchAllQuery_Equals(query, (Obj*)clone),
+ "Dump => Load round trip");
TEST_FALSE(batch, MatchAllQuery_Equals(query, (Obj*)&EMPTY), "Equals");
DECREF(query);
@@ -41,8 +40,7 @@ test_Dump_Load_and_Equals(TestBatch *bat
void
-TestMatchAllQuery_run_tests()
-{
+TestMatchAllQuery_run_tests() {
TestBatch *batch = TestBatch_new(2);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestNOTQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestNOTQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestNOTQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestNOTQuery.c Sun May 1 23:50:24 2011
@@ -25,8 +25,7 @@
#include "Lucy/Search/LeafQuery.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
Query *a_leaf = (Query*)TestUtils_make_leaf_query(NULL, "a");
Query *b_leaf = (Query*)TestUtils_make_leaf_query(NULL, "b");
NOTQuery *query = NOTQuery_new(a_leaf);
@@ -35,15 +34,15 @@ test_Dump_Load_and_Equals(TestBatch *bat
Obj *dump = (Obj*)NOTQuery_Dump(query);
NOTQuery *clone = (NOTQuery*)Obj_Load(dump, dump);
- TEST_FALSE(batch, NOTQuery_Equals(query, (Obj*)kids_differ),
- "Different kids spoil Equals");
- TEST_TRUE(batch, NOTQuery_Equals(query, (Obj*)boost_differs),
- "Equals with identical boosts");
+ TEST_FALSE(batch, NOTQuery_Equals(query, (Obj*)kids_differ),
+ "Different kids spoil Equals");
+ TEST_TRUE(batch, NOTQuery_Equals(query, (Obj*)boost_differs),
+ "Equals with identical boosts");
NOTQuery_Set_Boost(boost_differs, 1.5);
- TEST_FALSE(batch, NOTQuery_Equals(query, (Obj*)boost_differs),
- "Different boost spoils Equals");
- TEST_TRUE(batch, NOTQuery_Equals(query, (Obj*)clone),
- "Dump => Load round trip");
+ TEST_FALSE(batch, NOTQuery_Equals(query, (Obj*)boost_differs),
+ "Different boost spoils Equals");
+ TEST_TRUE(batch, NOTQuery_Equals(query, (Obj*)clone),
+ "Dump => Load round trip");
DECREF(a_leaf);
DECREF(b_leaf);
@@ -55,8 +54,7 @@ test_Dump_Load_and_Equals(TestBatch *bat
}
void
-TestNOTQuery_run_tests()
-{
+TestNOTQuery_run_tests() {
TestBatch *batch = TestBatch_new(4);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestNoMatchQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestNoMatchQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestNoMatchQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestNoMatchQuery.c Sun May 1 23:50:24 2011
@@ -24,14 +24,13 @@
#include "Lucy/Search/NoMatchQuery.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch)
-{
+test_Dump_Load_and_Equals(TestBatch *batch) {
NoMatchQuery *query = NoMatchQuery_new();
Obj *dump = (Obj*)NoMatchQuery_Dump(query);
NoMatchQuery *clone = (NoMatchQuery*)NoMatchQuery_Load(query, dump);
- TEST_TRUE(batch, NoMatchQuery_Equals(query, (Obj*)clone),
- "Dump => Load round trip");
+ TEST_TRUE(batch, NoMatchQuery_Equals(query, (Obj*)clone),
+ "Dump => Load round trip");
TEST_FALSE(batch, NoMatchQuery_Equals(query, (Obj*)&EMPTY), "Equals");
DECREF(query);
@@ -41,8 +40,7 @@ test_Dump_Load_and_Equals(TestBatch *bat
void
-TestNoMatchQuery_run_tests()
-{
+TestNoMatchQuery_run_tests() {
TestBatch *batch = TestBatch_new(2);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestPhraseQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestPhraseQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestPhraseQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestPhraseQuery.c Sun May 1 23:50:24 2011
@@ -24,22 +24,20 @@
#include "Lucy/Search/PhraseQuery.h"
static void
-test_Dump_And_Load(TestBatch *batch)
-{
- PhraseQuery *query
+test_Dump_And_Load(TestBatch *batch) {
+ PhraseQuery *query
= TestUtils_make_phrase_query("content", "a", "b", "c", NULL);
Obj *dump = (Obj*)PhraseQuery_Dump(query);
PhraseQuery *twin = (PhraseQuery*)Obj_Load(dump, dump);
- TEST_TRUE(batch, PhraseQuery_Equals(query, (Obj*)twin),
- "Dump => Load round trip");
+ TEST_TRUE(batch, PhraseQuery_Equals(query, (Obj*)twin),
+ "Dump => Load round trip");
DECREF(query);
DECREF(dump);
DECREF(twin);
}
void
-TestPhraseQuery_run_tests()
-{
+TestPhraseQuery_run_tests() {
TestBatch *batch = TestBatch_new(1);
TestBatch_Plan(batch);
test_Dump_And_Load(batch);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestPolyQuery.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestPolyQuery.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestPolyQuery.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestPolyQuery.c Sun May 1 23:50:24 2011
@@ -27,29 +27,33 @@
#include "Lucy/Search/LeafQuery.h"
static void
-test_Dump_Load_and_Equals(TestBatch *batch, uint32_t boolop)
-{
+test_Dump_Load_and_Equals(TestBatch *batch, uint32_t boolop) {
LeafQuery *a_leaf = TestUtils_make_leaf_query(NULL, "a");
LeafQuery *b_leaf = TestUtils_make_leaf_query(NULL, "b");
LeafQuery *c_leaf = TestUtils_make_leaf_query(NULL, "c");
- PolyQuery *query = (PolyQuery*)TestUtils_make_poly_query(boolop,
- INCREF(a_leaf), INCREF(b_leaf), NULL);
- PolyQuery *kids_differ = (PolyQuery*)TestUtils_make_poly_query(boolop,
- INCREF(a_leaf), INCREF(b_leaf), INCREF(c_leaf), NULL);
- PolyQuery *boost_differs = (PolyQuery*)TestUtils_make_poly_query(boolop,
- INCREF(a_leaf), INCREF(b_leaf), NULL);
- Obj *dump = (Obj*)PolyQuery_Dump(query);
+ PolyQuery *query
+ = (PolyQuery*)TestUtils_make_poly_query(boolop, INCREF(a_leaf),
+ INCREF(b_leaf), NULL);
+ PolyQuery *kids_differ
+ = (PolyQuery*)TestUtils_make_poly_query(boolop, INCREF(a_leaf),
+ INCREF(b_leaf),
+ INCREF(c_leaf),
+ NULL);
+ PolyQuery *boost_differs
+ = (PolyQuery*)TestUtils_make_poly_query(boolop, INCREF(a_leaf),
+ INCREF(b_leaf), NULL);
+ Obj *dump = (Obj*)PolyQuery_Dump(query);
PolyQuery *clone = (PolyQuery*)Obj_Load(dump, dump);
- TEST_FALSE(batch, PolyQuery_Equals(query, (Obj*)kids_differ),
- "Different kids spoil Equals");
- TEST_TRUE(batch, PolyQuery_Equals(query, (Obj*)boost_differs),
- "Equals with identical boosts");
+ TEST_FALSE(batch, PolyQuery_Equals(query, (Obj*)kids_differ),
+ "Different kids spoil Equals");
+ TEST_TRUE(batch, PolyQuery_Equals(query, (Obj*)boost_differs),
+ "Equals with identical boosts");
PolyQuery_Set_Boost(boost_differs, 1.5);
- TEST_FALSE(batch, PolyQuery_Equals(query, (Obj*)boost_differs),
- "Different boost spoils Equals");
- TEST_TRUE(batch, PolyQuery_Equals(query, (Obj*)clone),
- "Dump => Load round trip");
+ TEST_FALSE(batch, PolyQuery_Equals(query, (Obj*)boost_differs),
+ "Different boost spoils Equals");
+ TEST_TRUE(batch, PolyQuery_Equals(query, (Obj*)clone),
+ "Dump => Load round trip");
DECREF(a_leaf);
DECREF(b_leaf);
@@ -62,8 +66,7 @@ test_Dump_Load_and_Equals(TestBatch *bat
}
void
-TestANDQuery_run_tests()
-{
+TestANDQuery_run_tests() {
TestBatch *batch = TestBatch_new(4);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch, BOOLOP_AND);
@@ -71,8 +74,7 @@ TestANDQuery_run_tests()
}
void
-TestORQuery_run_tests()
-{
+TestORQuery_run_tests() {
TestBatch *batch = TestBatch_new(4);
TestBatch_Plan(batch);
test_Dump_Load_and_Equals(batch, BOOLOP_OR);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.c Sun May 1 23:50:24 2011
@@ -29,18 +29,16 @@
#include "Lucy/Search/ORQuery.h"
TestQueryParser*
-TestQP_new(const char *query_string, Query *tree, Query *expanded,
- uint32_t num_hits)
-{
- TestQueryParser *self
+TestQP_new(const char *query_string, Query *tree, Query *expanded,
+ uint32_t num_hits) {
+ TestQueryParser *self
= (TestQueryParser*)VTable_Make_Obj(TESTQUERYPARSER);
return TestQP_init(self, query_string, tree, expanded, num_hits);
}
TestQueryParser*
-TestQP_init(TestQueryParser *self, const char *query_string, Query *tree,
- Query *expanded, uint32_t num_hits)
-{
+TestQP_init(TestQueryParser *self, const char *query_string, Query *tree,
+ Query *expanded, uint32_t num_hits) {
self->query_string = query_string ? TestUtils_get_cb(query_string) : NULL;
self->tree = tree ? tree : NULL;
self->expanded = expanded ? expanded : NULL;
@@ -49,8 +47,7 @@ TestQP_init(TestQueryParser *self, const
}
void
-TestQP_destroy(TestQueryParser *self)
-{
+TestQP_destroy(TestQueryParser *self) {
DECREF(self->query_string);
DECREF(self->tree);
DECREF(self->expanded);
@@ -58,13 +55,24 @@ TestQP_destroy(TestQueryParser *self)
}
CharBuf*
-TestQP_get_query_string(TestQueryParser *self) { return self->query_string; }
+TestQP_get_query_string(TestQueryParser *self) {
+ return self->query_string;
+}
+
Query*
-TestQP_get_tree(TestQueryParser *self) { return self->tree; }
+TestQP_get_tree(TestQueryParser *self) {
+ return self->tree;
+}
+
Query*
-TestQP_get_expanded(TestQueryParser *self) { return self->expanded; }
+TestQP_get_expanded(TestQueryParser *self) {
+ return self->expanded;
+}
+
uint32_t
-TestQP_get_num_hits(TestQueryParser *self) { return self->num_hits; }
+TestQP_get_num_hits(TestQueryParser *self) {
+ return self->num_hits;
+}
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParser.cfh Sun May 1 23:50:24 2011
@@ -31,11 +31,11 @@ class Lucy::Test::Search::TestQueryParse
* reference count each for <code>tree</code>, and <code>expanded</code>.
*/
inert incremented TestQueryParser*
- new(const char *query_string = NULL, Query *tree = NULL,
+ new(const char *query_string = NULL, Query *tree = NULL,
Query *expanded = NULL, uint32_t num_hits);
inert TestQueryParser*
- init(TestQueryParser *self, const char *query_string = NULL,
+ init(TestQueryParser *self, const char *query_string = NULL,
Query *tree = NULL, Query *expanded = NULL, uint32_t num_hits);
nullable CharBuf*
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserLogic.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserLogic.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserLogic.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserLogic.c Sun May 1 23:50:24 2011
@@ -48,93 +48,82 @@
#define make_poly_query (Query*)lucy_TestUtils_make_poly_query
static TestQueryParser*
-logical_test_empty_phrase(uint32_t boolop)
-{
+logical_test_empty_phrase(uint32_t boolop) {
Query *tree = make_leaf_query(NULL, "\"\"");
UNUSED_VAR(boolop);
return TestQP_new("\"\"", tree, NULL, 0);
}
static TestQueryParser*
-logical_test_empty_parens(uint32_t boolop)
-{
+logical_test_empty_parens(uint32_t boolop) {
Query *tree = make_poly_query(boolop, NULL);
return TestQP_new("()", tree, NULL, 0);
}
static TestQueryParser*
-logical_test_nested_empty_parens(uint32_t boolop)
-{
+logical_test_nested_empty_parens(uint32_t boolop) {
Query *inner = make_poly_query(boolop, NULL);
Query *tree = make_poly_query(boolop, inner, NULL);
return TestQP_new("(())", tree, NULL, 0);
}
static TestQueryParser*
-logical_test_nested_empty_phrase(uint32_t boolop)
-{
+logical_test_nested_empty_phrase(uint32_t boolop) {
Query *leaf = make_leaf_query(NULL, "\"\"");
Query *tree = make_poly_query(boolop, leaf, NULL);
return TestQP_new("(\"\")", tree, NULL, 0);
}
static TestQueryParser*
-logical_test_simple_term(uint32_t boolop)
-{
+logical_test_simple_term(uint32_t boolop) {
Query *tree = make_leaf_query(NULL, "b");
UNUSED_VAR(boolop);
return TestQP_new("b", tree, NULL, 3);
}
static TestQueryParser*
-logical_test_one_nested_term(uint32_t boolop)
-{
+logical_test_one_nested_term(uint32_t boolop) {
Query *leaf = make_leaf_query(NULL, "a");
Query *tree = make_poly_query(boolop, leaf, NULL);
return TestQP_new("(a)", tree, NULL, 4);
}
static TestQueryParser*
-logical_test_one_term_phrase(uint32_t boolop)
-{
+logical_test_one_term_phrase(uint32_t boolop) {
Query *tree = make_leaf_query(NULL, "\"a\"");
UNUSED_VAR(boolop);
return TestQP_new("\"a\"", tree, NULL, 4);
}
static TestQueryParser*
-logical_test_two_terms(uint32_t boolop)
-{
+logical_test_two_terms(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
- Query *tree = make_poly_query(boolop, a_leaf, b_leaf, NULL);
+ Query *tree = make_poly_query(boolop, a_leaf, b_leaf, NULL);
uint32_t num_hits = boolop == BOOLOP_OR ? 4 : 3;
return TestQP_new("a b", tree, NULL, num_hits);
}
static TestQueryParser*
-logical_test_two_terms_nested(uint32_t boolop)
-{
+logical_test_two_terms_nested(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
- Query *tree = make_poly_query(boolop, a_leaf, b_leaf, NULL);
+ Query *tree = make_poly_query(boolop, a_leaf, b_leaf, NULL);
uint32_t num_hits = boolop == BOOLOP_OR ? 4 : 3;
return TestQP_new("(a b)", tree, NULL, num_hits);
}
static TestQueryParser*
-logical_test_one_term_one_single_term_phrase(uint32_t boolop)
-{
+logical_test_one_term_one_single_term_phrase(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "\"b\"");
- Query *tree = make_poly_query(boolop, a_leaf, b_leaf, NULL);
+ Query *tree = make_poly_query(boolop, a_leaf, b_leaf, NULL);
uint32_t num_hits = boolop == BOOLOP_OR ? 4 : 3;
return TestQP_new("a \"b\"", tree, NULL, num_hits);
}
static TestQueryParser*
-logical_test_two_terms_one_nested(uint32_t boolop)
-{
+logical_test_two_terms_one_nested(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
Query *b_tree = make_poly_query(boolop, b_leaf, NULL);
@@ -144,8 +133,7 @@ logical_test_two_terms_one_nested(uint32
}
static TestQueryParser*
-logical_test_one_term_one_nested_single_term_phrase(uint32_t boolop)
-{
+logical_test_one_term_one_nested_single_term_phrase(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "\"b\"");
Query *b_tree = make_poly_query(boolop, b_leaf, NULL);
@@ -155,36 +143,32 @@ logical_test_one_term_one_nested_single_
}
static TestQueryParser*
-logical_test_phrase(uint32_t boolop)
-{
+logical_test_phrase(uint32_t boolop) {
Query *tree = make_leaf_query(NULL, "\"a b\"");
UNUSED_VAR(boolop);
return TestQP_new("\"a b\"", tree, NULL, 3);
}
static TestQueryParser*
-logical_test_nested_phrase(uint32_t boolop)
-{
+logical_test_nested_phrase(uint32_t boolop) {
Query *leaf = make_leaf_query(NULL, "\"a b\"");
Query *tree = make_poly_query(boolop, leaf, NULL);
return TestQP_new("(\"a b\")", tree, NULL, 3);
}
static TestQueryParser*
-logical_test_three_terms(uint32_t boolop)
-{
+logical_test_three_terms(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
Query *c_leaf = make_leaf_query(NULL, "c");
- Query *tree = make_poly_query(boolop, a_leaf, b_leaf,
- c_leaf, NULL);
+ Query *tree = make_poly_query(boolop, a_leaf, b_leaf,
+ c_leaf, NULL);
uint32_t num_hits = boolop == BOOLOP_OR ? 4 : 2;
return TestQP_new("a b c", tree, NULL, num_hits);
}
static TestQueryParser*
-logical_test_three_terms_two_nested(uint32_t boolop)
-{
+logical_test_three_terms_two_nested(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
Query *c_leaf = make_leaf_query(NULL, "c");
@@ -195,8 +179,7 @@ logical_test_three_terms_two_nested(uint
}
static TestQueryParser*
-logical_test_one_term_one_phrase(uint32_t boolop)
-{
+logical_test_one_term_one_phrase(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *bc_leaf = make_leaf_query(NULL, "\"b c\"");
Query *tree = make_poly_query(boolop, a_leaf, bc_leaf, NULL);
@@ -205,8 +188,7 @@ logical_test_one_term_one_phrase(uint32_
}
static TestQueryParser*
-logical_test_one_term_one_nested_phrase(uint32_t boolop)
-{
+logical_test_one_term_one_nested_phrase(uint32_t boolop) {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *bc_leaf = make_leaf_query(NULL, "\"b c\"");
Query *inner_tree = make_poly_query(boolop, bc_leaf, NULL);
@@ -216,16 +198,14 @@ logical_test_one_term_one_nested_phrase(
}
static TestQueryParser*
-logical_test_long_phrase(uint32_t boolop)
-{
+logical_test_long_phrase(uint32_t boolop) {
Query *tree = make_leaf_query(NULL, "\"a b c\"");
UNUSED_VAR(boolop);
return TestQP_new("\"a b c\"", tree, NULL, 2);
}
static TestQueryParser*
-logical_test_pure_negation(uint32_t boolop)
-{
+logical_test_pure_negation(uint32_t boolop) {
Query *leaf = make_leaf_query(NULL, "x");
Query *tree = make_not_query(leaf);
UNUSED_VAR(boolop);
@@ -233,16 +213,14 @@ logical_test_pure_negation(uint32_t bool
}
static TestQueryParser*
-logical_test_double_negative(uint32_t boolop)
-{
+logical_test_double_negative(uint32_t boolop) {
Query *tree = make_leaf_query(NULL, "a");
UNUSED_VAR(boolop);
return TestQP_new("--a", tree, NULL, 4);
}
static TestQueryParser*
-logical_test_triple_negative(uint32_t boolop)
-{
+logical_test_triple_negative(uint32_t boolop) {
Query *leaf = make_leaf_query(NULL, "a");
Query *tree = make_not_query(leaf);
UNUSED_VAR(boolop);
@@ -253,8 +231,7 @@ logical_test_triple_negative(uint32_t bo
// too difficult to prune -- so QParser_Prune just lops it because it's a
// top-level NOTQuery.
static TestQueryParser*
-logical_test_nested_negations(uint32_t boolop)
-{
+logical_test_nested_negations(uint32_t boolop) {
Query *query = make_leaf_query(NULL, "a");
query = make_poly_query(boolop, query, NULL);
query = make_not_query(query);
@@ -264,8 +241,7 @@ logical_test_nested_negations(uint32_t b
}
static TestQueryParser*
-logical_test_two_terms_one_required(uint32_t boolop)
-{
+logical_test_two_terms_one_required(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *tree;
@@ -281,8 +257,7 @@ logical_test_two_terms_one_required(uint
}
static TestQueryParser*
-logical_test_intersection(uint32_t boolop)
-{
+logical_test_intersection(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *tree = make_poly_query(BOOLOP_AND, a_query, b_query, NULL);
@@ -291,20 +266,18 @@ logical_test_intersection(uint32_t boolo
}
static TestQueryParser*
-logical_test_three_way_intersection(uint32_t boolop)
-{
+logical_test_three_way_intersection(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
- Query *tree = make_poly_query(BOOLOP_AND, a_query, b_query,
+ Query *tree = make_poly_query(BOOLOP_AND, a_query, b_query,
c_query, NULL);
UNUSED_VAR(boolop);
return TestQP_new("a AND b AND c", tree, NULL, 2);
}
static TestQueryParser*
-logical_test_union(uint32_t boolop)
-{
+logical_test_union(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *tree = make_poly_query(BOOLOP_OR, a_query, b_query, NULL);
@@ -313,8 +286,7 @@ logical_test_union(uint32_t boolop)
}
static TestQueryParser*
-logical_test_three_way_union(uint32_t boolop)
-{
+logical_test_three_way_union(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
@@ -324,8 +296,7 @@ logical_test_three_way_union(uint32_t bo
}
static TestQueryParser*
-logical_test_a_or_plus_b(uint32_t boolop)
-{
+logical_test_a_or_plus_b(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *tree = make_poly_query(BOOLOP_OR, a_query, b_query, NULL);
@@ -334,8 +305,7 @@ logical_test_a_or_plus_b(uint32_t boolop
}
static TestQueryParser*
-logical_test_and_not(uint32_t boolop)
-{
+logical_test_and_not(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *not_b = make_not_query(b_query);
@@ -345,8 +315,7 @@ logical_test_and_not(uint32_t boolop)
}
static TestQueryParser*
-logical_test_nested_or(uint32_t boolop)
-{
+logical_test_nested_or(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
@@ -356,8 +325,7 @@ logical_test_nested_or(uint32_t boolop)
}
static TestQueryParser*
-logical_test_and_nested_or(uint32_t boolop)
-{
+logical_test_and_nested_or(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
@@ -368,8 +336,7 @@ logical_test_and_nested_or(uint32_t bool
}
static TestQueryParser*
-logical_test_or_nested_or(uint32_t boolop)
-{
+logical_test_or_nested_or(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
@@ -380,22 +347,20 @@ logical_test_or_nested_or(uint32_t boolo
}
static TestQueryParser*
-logical_test_and_not_nested_or(uint32_t boolop)
-{
+logical_test_and_not_nested_or(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
Query *nested = make_poly_query(BOOLOP_OR, b_query, c_query, NULL);
Query *not_nested = make_not_query(nested);
- Query *tree = make_poly_query(BOOLOP_AND, a_query,
+ Query *tree = make_poly_query(BOOLOP_AND, a_query,
not_nested, NULL);
UNUSED_VAR(boolop);
return TestQP_new("a AND NOT (b OR c)", tree, NULL, 1);
}
static TestQueryParser*
-logical_test_required_phrase_negated_term(uint32_t boolop)
-{
+logical_test_required_phrase_negated_term(uint32_t boolop) {
Query *bc_query = make_leaf_query(NULL, "\"b c\"");
Query *d_query = make_leaf_query(NULL, "d");
Query *not_d = make_not_query(d_query);
@@ -405,8 +370,7 @@ logical_test_required_phrase_negated_ter
}
static TestQueryParser*
-logical_test_required_term_optional_phrase(uint32_t boolop)
-{
+logical_test_required_term_optional_phrase(uint32_t boolop) {
Query *ab_query = make_leaf_query(NULL, "\"a b\"");
Query *d_query = make_leaf_query(NULL, "d");
Query *tree;
@@ -423,8 +387,7 @@ logical_test_required_term_optional_phra
}
static TestQueryParser*
-logical_test_nested_nest(uint32_t boolop)
-{
+logical_test_nested_nest(uint32_t boolop) {
Query *a_query = make_leaf_query(NULL, "a");
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
@@ -438,18 +401,16 @@ logical_test_nested_nest(uint32_t boolop
}
static TestQueryParser*
-logical_test_field_bool_group(uint32_t boolop)
-{
+logical_test_field_bool_group(uint32_t boolop) {
Query *b_query = make_leaf_query("content", "b");
Query *c_query = make_leaf_query("content", "c");
Query *tree = make_poly_query(boolop, b_query, c_query, NULL);
- return TestQP_new("content:(b c)", tree, NULL,
- boolop == BOOLOP_OR ? 3 : 2);
+ return TestQP_new("content:(b c)", tree, NULL,
+ boolop == BOOLOP_OR ? 3 : 2);
}
static TestQueryParser*
-logical_test_field_multi_OR(uint32_t boolop)
-{
+logical_test_field_multi_OR(uint32_t boolop) {
Query *a_query = make_leaf_query("content", "a");
Query *b_query = make_leaf_query("content", "b");
Query *c_query = make_leaf_query("content", "c");
@@ -459,55 +420,49 @@ logical_test_field_multi_OR(uint32_t boo
}
static TestQueryParser*
-logical_test_field_multi_AND(uint32_t boolop)
-{
+logical_test_field_multi_AND(uint32_t boolop) {
Query *a_query = make_leaf_query("content", "a");
Query *b_query = make_leaf_query("content", "b");
Query *c_query = make_leaf_query("content", "c");
- Query *tree = make_poly_query(BOOLOP_AND, a_query, b_query,
+ Query *tree = make_poly_query(BOOLOP_AND, a_query, b_query,
c_query, NULL);
UNUSED_VAR(boolop);
return TestQP_new("content:(a AND b AND c)", tree, NULL, 2);
}
static TestQueryParser*
-logical_test_field_phrase(uint32_t boolop)
-{
+logical_test_field_phrase(uint32_t boolop) {
Query *tree = make_leaf_query("content", "\"b c\"");
UNUSED_VAR(boolop);
return TestQP_new("content:\"b c\"", tree, NULL, 2);
}
static TestQueryParser*
-prune_test_null_querystring()
-{
+prune_test_null_querystring() {
Query *pruned = (Query*)NoMatchQuery_new();
return TestQP_new(NULL, NULL, pruned, 0);
}
static TestQueryParser*
-prune_test_matchall()
-{
+prune_test_matchall() {
Query *tree = (Query*)MatchAllQuery_new();
Query *pruned = (Query*)NoMatchQuery_new();
return TestQP_new(NULL, tree, pruned, 0);
}
static TestQueryParser*
-prune_test_nomatch()
-{
+prune_test_nomatch() {
Query *tree = (Query*)NoMatchQuery_new();
Query *pruned = (Query*)NoMatchQuery_new();
return TestQP_new(NULL, tree, pruned, 0);
}
static TestQueryParser*
-prune_test_optional_not()
-{
+prune_test_optional_not() {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
Query *not_b = make_not_query(b_leaf);
- Query *tree = make_poly_query(BOOLOP_OR, (Query*)INCREF(a_leaf),
+ Query *tree = make_poly_query(BOOLOP_OR, (Query*)INCREF(a_leaf),
not_b, NULL);
Query *nomatch = (Query*)NoMatchQuery_new();
Query *pruned = make_poly_query(BOOLOP_OR, a_leaf, nomatch, NULL);
@@ -515,8 +470,7 @@ prune_test_optional_not()
}
static TestQueryParser*
-prune_test_reqopt_optional_not()
-{
+prune_test_reqopt_optional_not() {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
Query *not_b = make_not_query(b_leaf);
@@ -530,8 +484,7 @@ prune_test_reqopt_optional_not()
}
static TestQueryParser*
-prune_test_reqopt_required_not()
-{
+prune_test_reqopt_required_not() {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
Query *not_a = make_not_query(a_leaf);
@@ -545,8 +498,7 @@ prune_test_reqopt_required_not()
}
static TestQueryParser*
-prune_test_not_and_not()
-{
+prune_test_not_and_not() {
Query *a_leaf = make_leaf_query(NULL, "a");
Query *b_leaf = make_leaf_query(NULL, "b");
Query *not_a = make_not_query(a_leaf);
@@ -621,8 +573,7 @@ static lucy_TestQPLogic_prune_test_t pru
};
static Folder*
-S_create_index()
-{
+S_create_index() {
Schema *schema = (Schema*)TestSchema_new();
RAMFolder *folder = RAMFolder_new(NULL);
VArray *doc_set = TestUtils_doc_set();
@@ -642,22 +593,21 @@ S_create_index()
DECREF(doc_set);
DECREF(indexer);
DECREF(schema);
-
+
return (Folder*)folder;
}
void
-TestQPLogic_run_tests()
-{
+TestQPLogic_run_tests() {
uint32_t i;
TestBatch *batch = TestBatch_new(178);
Folder *folder = S_create_index();
IndexSearcher *searcher = IxSearcher_new((Obj*)folder);
- QueryParser *or_parser = QParser_new(IxSearcher_Get_Schema(searcher),
- NULL, NULL, NULL);
+ QueryParser *or_parser = QParser_new(IxSearcher_Get_Schema(searcher),
+ NULL, NULL, NULL);
ZombieCharBuf *AND = ZCB_WRAP_STR("AND", 3);
- QueryParser *and_parser = QParser_new(IxSearcher_Get_Schema(searcher),
- NULL, (CharBuf*)AND, NULL);
+ QueryParser *and_parser = QParser_new(IxSearcher_Get_Schema(searcher),
+ NULL, (CharBuf*)AND, NULL);
QParser_Set_Heed_Colons(or_parser, true);
QParser_Set_Heed_Colons(and_parser, true);
@@ -672,9 +622,9 @@ TestQPLogic_run_tests()
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(batch, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() OR %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "tree() OR %s", (char*)CB_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(batch, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: OR %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "hits: OR %s", (char*)CB_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
@@ -690,9 +640,9 @@ TestQPLogic_run_tests()
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(batch, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() AND %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "tree() AND %s", (char*)CB_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(batch, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: AND %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "hits: AND %s", (char*)CB_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
@@ -703,9 +653,9 @@ TestQPLogic_run_tests()
for (i = 0; prune_test_funcs[i] != NULL; i++) {
lucy_TestQPLogic_prune_test_t test_func = prune_test_funcs[i];
TestQueryParser *test_case = test_func();
- CharBuf *qstring = test_case->tree
- ? Query_To_String(test_case->tree)
- : CB_new_from_trusted_utf8("(NULL)", 6);
+ CharBuf *qstring = test_case->tree
+ ? Query_To_String(test_case->tree)
+ : CB_new_from_trusted_utf8("(NULL)", 6);
Query *tree = test_case->tree;
Query *wanted = test_case->expanded;
Query *pruned = QParser_Prune(or_parser, tree);
@@ -713,11 +663,11 @@ TestQPLogic_run_tests()
Hits *hits;
TEST_TRUE(batch, Query_Equals(pruned, (Obj*)wanted),
- "prune() %s", (char*)CB_Get_Ptr8(qstring));
+ "prune() %s", (char*)CB_Get_Ptr8(qstring));
expanded = QParser_Expand(or_parser, pruned);
hits = IxSearcher_Hits(searcher, (Obj*)expanded, 0, 10, NULL);
TEST_INT_EQ(batch, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: %s", (char*)CB_Get_Ptr8(qstring));
+ "hits: %s", (char*)CB_Get_Ptr8(qstring));
DECREF(hits);
DECREF(expanded);
Modified: incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserSyntax.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserSyntax.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserSyntax.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Search/TestQueryParserSyntax.c Sun May 1 23:50:24 2011
@@ -42,8 +42,7 @@
#define make_poly_query (Query*)lucy_TestUtils_make_poly_query
static TestQueryParser*
-leaf_test_simple_term()
-{
+leaf_test_simple_term() {
Query *tree = make_leaf_query(NULL, "a");
Query *plain_q = make_term_query("plain", "a");
Query *fancy_q = make_term_query("fancy", "a");
@@ -52,8 +51,7 @@ leaf_test_simple_term()
}
static TestQueryParser*
-leaf_test_simple_phrase()
-{
+leaf_test_simple_phrase() {
Query *tree = make_leaf_query(NULL, "\"a b\"");
Query *plain_q = make_phrase_query("plain", "a", "b", NULL);
Query *fancy_q = make_phrase_query("fancy", "a", "b", NULL);
@@ -62,8 +60,7 @@ leaf_test_simple_phrase()
}
static TestQueryParser*
-leaf_test_unclosed_quote()
-{
+leaf_test_unclosed_quote() {
Query *tree = make_leaf_query(NULL, "\"a b");
Query *plain_q = make_phrase_query("plain", "a", "b", NULL);
Query *fancy_q = make_phrase_query("fancy", "a", "b", NULL);
@@ -72,8 +69,7 @@ leaf_test_unclosed_quote()
}
static TestQueryParser*
-leaf_test_escaped_quotes_inside()
-{
+leaf_test_escaped_quotes_inside() {
Query *tree = make_leaf_query(NULL, "\"\\\"a b\\\"\"");
Query *plain_q = make_phrase_query("plain", "\"a", "b\"", NULL);
Query *fancy_q = make_phrase_query("fancy", "a", "b", NULL);
@@ -82,8 +78,7 @@ leaf_test_escaped_quotes_inside()
}
static TestQueryParser*
-leaf_test_escaped_quotes_outside()
-{
+leaf_test_escaped_quotes_outside() {
Query *tree = make_leaf_query(NULL, "\\\"a");
Query *plain_q = make_term_query("plain", "\"a");
Query *fancy_q = make_term_query("fancy", "a");
@@ -92,8 +87,7 @@ leaf_test_escaped_quotes_outside()
}
static TestQueryParser*
-leaf_test_single_term_phrase()
-{
+leaf_test_single_term_phrase() {
Query *tree = make_leaf_query(NULL, "\"a\"");
Query *plain_q = make_phrase_query("plain", "a", NULL);
Query *fancy_q = make_phrase_query("fancy", "a", NULL);
@@ -102,8 +96,7 @@ leaf_test_single_term_phrase()
}
static TestQueryParser*
-leaf_test_longer_phrase()
-{
+leaf_test_longer_phrase() {
Query *tree = make_leaf_query(NULL, "\"a b c\"");
Query *plain_q = make_phrase_query("plain", "a", "b", "c", NULL);
Query *fancy_q = make_phrase_query("fancy", "a", "b", "c", NULL);
@@ -112,8 +105,7 @@ leaf_test_longer_phrase()
}
static TestQueryParser*
-leaf_test_empty_phrase()
-{
+leaf_test_empty_phrase() {
Query *tree = make_leaf_query(NULL, "\"\"");
Query *plain_q = make_phrase_query("plain", NULL);
Query *fancy_q = make_phrase_query("fancy", NULL);
@@ -122,8 +114,7 @@ leaf_test_empty_phrase()
}
static TestQueryParser*
-leaf_test_phrase_with_stopwords()
-{
+leaf_test_phrase_with_stopwords() {
Query *tree = make_leaf_query(NULL, "\"x a\"");
Query *plain_q = make_phrase_query("plain", "x", "a", NULL);
Query *fancy_q = make_phrase_query("fancy", "a", NULL);
@@ -132,8 +123,7 @@ leaf_test_phrase_with_stopwords()
}
static TestQueryParser*
-leaf_test_different_tokenization()
-{
+leaf_test_different_tokenization() {
Query *tree = make_leaf_query(NULL, "a.b");
Query *plain_q = make_term_query("plain", "a.b");
Query *fancy_q = make_phrase_query("fancy", "a", "b", NULL);
@@ -142,52 +132,46 @@ leaf_test_different_tokenization()
}
static TestQueryParser*
-leaf_test_http()
-{
+leaf_test_http() {
char address[] = "http://www.foo.com/bar.html";
Query *tree = make_leaf_query(NULL, address);
Query *plain_q = make_term_query("plain", address);
Query *fancy_q = make_phrase_query("fancy", "http", "www", "foo",
- "com", "bar", "html", NULL);
+ "com", "bar", "html", NULL);
Query *expanded = make_poly_query(BOOLOP_OR, fancy_q, plain_q, NULL);
return TestQP_new(address, tree, expanded, 0);
}
static TestQueryParser*
-leaf_test_field()
-{
+leaf_test_field() {
Query *tree = make_leaf_query("plain", "b");
Query *expanded = make_term_query("plain", "b");
return TestQP_new("plain:b", tree, expanded, 3);
}
static TestQueryParser*
-leaf_test_unrecognized_field()
-{
+leaf_test_unrecognized_field() {
Query *tree = make_leaf_query("bogusfield", "b");
Query *expanded = make_term_query("bogusfield", "b");
return TestQP_new("bogusfield:b", tree, expanded, 0);
}
static TestQueryParser*
-leaf_test_unescape_colons()
-{
+leaf_test_unescape_colons() {
Query *tree = make_leaf_query("plain", "a\\:b");
Query *expanded = make_term_query("plain", "a:b");
return TestQP_new("plain:a\\:b", tree, expanded, 0);
}
static TestQueryParser*
-syntax_test_minus_plus()
-{
+syntax_test_minus_plus() {
Query *leaf = make_leaf_query(NULL, "a");
Query *tree = make_not_query(leaf);
return TestQP_new("-+a", tree, NULL, 0);
}
static TestQueryParser*
-syntax_test_plus_minus()
-{
+syntax_test_plus_minus() {
// Not a perfect result, but then it's not a good query string.
Query *leaf = make_leaf_query(NULL, "a");
Query *tree = make_not_query(leaf);
@@ -195,23 +179,20 @@ syntax_test_plus_minus()
}
static TestQueryParser*
-syntax_test_minus_minus()
-{
+syntax_test_minus_minus() {
// Not a perfect result, but then it's not a good query string.
Query *tree = make_leaf_query(NULL, "a");
return TestQP_new("--a", tree, NULL, 4);
}
static TestQueryParser*
-syntax_test_not_minus()
-{
+syntax_test_not_minus() {
Query *tree = make_leaf_query(NULL, "a");
return TestQP_new("NOT -a", tree, NULL, 4);
}
static TestQueryParser*
-syntax_test_not_plus()
-{
+syntax_test_not_plus() {
// Not a perfect result, but then it's not a good query string.
Query *leaf = make_leaf_query(NULL, "a");
Query *tree = make_not_query(leaf);
@@ -219,8 +200,7 @@ syntax_test_not_plus()
}
static TestQueryParser*
-syntax_test_padded_plus()
-{
+syntax_test_padded_plus() {
Query *plus = make_leaf_query(NULL, "+");
Query *a = make_leaf_query(NULL, "a");
Query *tree = make_poly_query(BOOLOP_OR, plus, a, NULL);
@@ -228,8 +208,7 @@ syntax_test_padded_plus()
}
static TestQueryParser*
-syntax_test_padded_minus()
-{
+syntax_test_padded_minus() {
Query *minus = make_leaf_query(NULL, "-");
Query *a = make_leaf_query(NULL, "a");
Query *tree = make_poly_query(BOOLOP_OR, minus, a, NULL);
@@ -237,8 +216,7 @@ syntax_test_padded_minus()
}
static TestQueryParser*
-syntax_test_unclosed_parens()
-{
+syntax_test_unclosed_parens() {
// Not a perfect result, but then it's not a good query string.
Query *inner = make_poly_query(BOOLOP_OR, NULL);
Query *tree = make_poly_query(BOOLOP_OR, inner, NULL);
@@ -246,30 +224,26 @@ syntax_test_unclosed_parens()
}
static TestQueryParser*
-syntax_test_escaped_quotes_outside()
-{
+syntax_test_escaped_quotes_outside() {
Query *tree = make_leaf_query(NULL, "\\\"a\\\"");
return TestQP_new("\\\"a\\\"", tree, NULL, 4);
}
static TestQueryParser*
-syntax_test_escaped_quotes_inside()
-{
+syntax_test_escaped_quotes_inside() {
Query *tree = make_leaf_query(NULL, "\"\\\"a\\\"\"");
return TestQP_new("\"\\\"a\\\"\"", tree, NULL, 4);
}
static TestQueryParser*
-syntax_test_identifier_field_name()
-{
+syntax_test_identifier_field_name() {
// Field names must be identifiers, i.e. they cannot start with a number.
Query *tree = make_leaf_query(NULL, "10:30");
return TestQP_new("10:30", tree, NULL, 0);
}
static TestQueryParser*
-syntax_test_double_colon()
-{
+syntax_test_double_colon() {
Query *tree = make_leaf_query(NULL, "PHP::Interpreter");
return TestQP_new("PHP::Interpreter", tree, NULL, 0);
}
@@ -314,13 +288,12 @@ static lucy_TestQPSyntax_test_t syntax_t
};
void
-TestQPSyntax_run_tests(Folder *index)
-{
+TestQPSyntax_run_tests(Folder *index) {
uint32_t i;
TestBatch *batch = TestBatch_new(66);
IndexSearcher *searcher = IxSearcher_new((Obj*)index);
- QueryParser *qparser = QParser_new(IxSearcher_Get_Schema(searcher),
- NULL, NULL, NULL);
+ QueryParser *qparser = QParser_new(IxSearcher_Get_Schema(searcher),
+ NULL, NULL, NULL);
QParser_Set_Heed_Colons(qparser, true);
TestBatch_Plan(batch);
@@ -334,11 +307,11 @@ TestQPSyntax_run_tests(Folder *index)
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(batch, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "tree() %s", (char*)CB_Get_Ptr8(test_case->query_string));
TEST_TRUE(batch, Query_Equals(expanded, (Obj*)test_case->expanded),
- "expand_leaf() %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "expand_leaf() %s", (char*)CB_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(batch, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "hits: %s", (char*)CB_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(expanded);
@@ -354,9 +327,9 @@ TestQPSyntax_run_tests(Folder *index)
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(batch, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "tree() %s", (char*)CB_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(batch, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: %s", (char*)CB_Get_Ptr8(test_case->query_string));
+ "hits: %s", (char*)CB_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);