Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/Lucy/Test/Analysis/TestNormalizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ test_utf8proc_normalization(TestBatchRunner *runner) {
// Normalize again.
size_t normalized_len = strlen((char*)normalized);
uint8_t *dupe;
int32_t dupe_check = utf8proc_map(normalized, normalized_len, &dupe,
int32_t dupe_check = utf8proc_map(normalized, (ssize_t)normalized_len, &dupe,
UTF8PROC_STABLE |
UTF8PROC_COMPOSE |
UTF8PROC_COMPAT |
Expand Down
10 changes: 5 additions & 5 deletions core/Lucy/Test/Index/TestPolyReader.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ TestPolyReader_new() {

static void
test_sub_tick(TestBatchRunner *runner) {
size_t num_segs = 255;
uint32_t num_segs = 255;
int32_t *ints = (int32_t*)MALLOCATE(num_segs * sizeof(int32_t));
size_t i;
uint32_t i;
for (i = 0; i < num_segs; i++) {
ints[i] = i;
ints[i] = (int32_t)i;
}
I32Array *offsets = I32Arr_new(ints, num_segs);
for (i = 1; i < num_segs; i++) {
if (PolyReader_sub_tick(offsets, i) != i - 1) { break; }
if (PolyReader_sub_tick(offsets, (int32_t)i) != i - 1) { break; }
}
TEST_INT_EQ(runner, i, num_segs, "got all sub_tick() calls right");
TEST_UINT_EQ(runner, i, num_segs, "got all sub_tick() calls right");
DECREF(offsets);
FREEMEM(ints);
}
Expand Down
24 changes: 12 additions & 12 deletions core/Lucy/Test/Search/TestQueryParserLogic.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ logical_test_a_AND_b_AND_c_d(uint32_t boolop) {
Query *left = make_poly_query(BOOLOP_AND, a_query, b_query, c_query,
NULL);
Query *tree = make_poly_query(boolop, left, d_query, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 1 : 2;
uint32_t num_hits = boolop == BOOLOP_AND ? 1 : 2;
return TestQP_new("a AND b AND c d", tree, NULL, num_hits);
}

Expand All @@ -490,7 +490,7 @@ logical_test_a_AND_b_OR_c_d(uint32_t boolop) {
Query *inner = make_poly_query(BOOLOP_AND, a_query, b_query, NULL);
Query *left = make_poly_query(BOOLOP_OR, inner, c_query, NULL);
Query *tree = make_poly_query(boolop, left, d_query, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 1 : 3;
uint32_t num_hits = boolop == BOOLOP_AND ? 1 : 3;
return TestQP_new("a AND b OR c d", tree, NULL, num_hits);
}

Expand All @@ -503,7 +503,7 @@ logical_test_a_OR_b_AND_c_d(uint32_t boolop) {
Query *inner = make_poly_query(BOOLOP_AND, b_query, c_query, NULL);
Query *left = make_poly_query(BOOLOP_OR, a_query, inner, NULL);
Query *tree = make_poly_query(boolop, left, d_query, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
return TestQP_new("a OR b AND c d", tree, NULL, num_hits);
}

Expand All @@ -516,7 +516,7 @@ logical_test_a_OR_b_OR_c_d(uint32_t boolop) {
Query *left = make_poly_query(BOOLOP_OR, a_query, b_query, c_query,
NULL);
Query *tree = make_poly_query(boolop, left, d_query, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
return TestQP_new("a OR b OR c d", tree, NULL, num_hits);
}

Expand All @@ -529,7 +529,7 @@ logical_test_a_AND_b_c_AND_d(uint32_t boolop) {
Query *left = make_poly_query(BOOLOP_AND, a_query, b_query, NULL);
Query *right = make_poly_query(BOOLOP_AND, c_query, d_query, NULL);
Query *tree = make_poly_query(boolop, left, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 1 : 3;
uint32_t num_hits = boolop == BOOLOP_AND ? 1 : 3;
return TestQP_new("a AND b c AND d", tree, NULL, num_hits);
}

Expand All @@ -542,7 +542,7 @@ logical_test_a_AND_b_c_OR_d(uint32_t boolop) {
Query *left = make_poly_query(BOOLOP_AND, a_query, b_query, NULL);
Query *right = make_poly_query(BOOLOP_OR, c_query, d_query, NULL);
Query *tree = make_poly_query(boolop, left, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 2 : 3;
uint32_t num_hits = boolop == BOOLOP_AND ? 2 : 3;
return TestQP_new("a AND b c OR d", tree, NULL, num_hits);
}

Expand All @@ -555,7 +555,7 @@ logical_test_a_OR_b_c_AND_d(uint32_t boolop) {
Query *left = make_poly_query(BOOLOP_OR, a_query, b_query, NULL);
Query *right = make_poly_query(BOOLOP_AND, c_query, d_query, NULL);
Query *tree = make_poly_query(boolop, left, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
return TestQP_new("a OR b c AND d", tree, NULL, num_hits);
}

Expand All @@ -568,7 +568,7 @@ logical_test_a_OR_b_c_OR_d(uint32_t boolop) {
Query *left = make_poly_query(BOOLOP_OR, a_query, b_query, NULL);
Query *right = make_poly_query(BOOLOP_OR, c_query, d_query, NULL);
Query *tree = make_poly_query(boolop, left, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 2 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 2 : 4;
return TestQP_new("a OR b c OR d", tree, NULL, num_hits);
}

Expand All @@ -581,7 +581,7 @@ logical_test_a_b_AND_c_AND_d(uint32_t boolop) {
Query *right = make_poly_query(BOOLOP_AND, b_query, c_query, d_query,
NULL);
Query *tree = make_poly_query(boolop, a_query, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 1 : 4;
return TestQP_new("a b AND c AND d", tree, NULL, num_hits);
}

Expand All @@ -594,7 +594,7 @@ logical_test_a_b_AND_c_OR_d(uint32_t boolop) {
Query *inner = make_poly_query(BOOLOP_AND, b_query, c_query, NULL);
Query *right = make_poly_query(BOOLOP_OR, inner, d_query, NULL);
Query *tree = make_poly_query(boolop, a_query, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 2 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 2 : 4;
return TestQP_new("a b AND c OR d", tree, NULL, num_hits);
}

Expand All @@ -607,7 +607,7 @@ logical_test_a_b_OR_c_AND_d(uint32_t boolop) {
Query *inner = make_poly_query(BOOLOP_AND, c_query, d_query, NULL);
Query *right = make_poly_query(BOOLOP_OR, b_query, inner, NULL);
Query *tree = make_poly_query(boolop, a_query, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 3 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 3 : 4;
return TestQP_new("a b OR c AND d", tree, NULL, num_hits);
}

Expand All @@ -620,7 +620,7 @@ logical_test_a_b_OR_c_OR_d(uint32_t boolop) {
Query *right = make_poly_query(BOOLOP_OR, b_query, c_query, d_query,
NULL);
Query *tree = make_poly_query(boolop, a_query, right, NULL);
int32_t num_hits = boolop == BOOLOP_AND ? 3 : 4;
uint32_t num_hits = boolop == BOOLOP_AND ? 3 : 4;
return TestQP_new("a b OR c OR d", tree, NULL, num_hits);
}

Expand Down
2 changes: 1 addition & 1 deletion core/Lucy/Test/Search/TestSeriesMatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ S_make_series_matcher(I32Array *doc_ids, I32Array *offsets, int32_t doc_max) {
static I32Array*
S_generate_match_list(int32_t first, int32_t max, int32_t doc_inc) {
int32_t count = (max - first + doc_inc - 1) / doc_inc;
int32_t *doc_ids = (int32_t*)MALLOCATE(count * sizeof(int32_t));
int32_t *doc_ids = (int32_t*)MALLOCATE((size_t)count * sizeof(int32_t));
int32_t doc_id = first;
int32_t i = 0;

Expand Down
6 changes: 3 additions & 3 deletions core/Lucy/Test/Store/TestIOPrimitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test_i8(TestBatchRunner *runner) {
int i;

for (i = -128; i < 128; i++) {
OutStream_Write_I8(outstream, i);
OutStream_Write_I8(outstream, (int8_t)i);
}
OutStream_Close(outstream);

Expand All @@ -72,7 +72,7 @@ test_u8(TestBatchRunner *runner) {
int i;

for (i = 0; i < 256; i++) {
OutStream_Write_U8(outstream, i);
OutStream_Write_U8(outstream, (uint8_t)i);
}
OutStream_Close(outstream);

Expand Down Expand Up @@ -398,7 +398,7 @@ test_cu64(TestBatchRunner *runner) {
for (i = 0; i < 1000; i++) {
char buffer[10];
const char *buf = buffer;
size_t size = InStream_Read_Raw_C64(raw_instream, buffer);
int size = InStream_Read_Raw_C64(raw_instream, buffer);
uint64_t got = NumUtil_decode_cu64(&buf);
UNUSED_VAR(size);
if (got != ints[i]) {
Expand Down
2 changes: 1 addition & 1 deletion core/Lucy/Test/Store/TestInStream.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ test_Clone_and_Reopen(TestBatchRunner *runner) {
InStream *clone;
InStream *reopened;

for (uint32_t i = 0; i < 26; i++) {
for (uint8_t i = 0; i < 26; i++) {
OutStream_Write_U8(outstream, 'a' + i);
}
OutStream_Close(outstream);
Expand Down
12 changes: 6 additions & 6 deletions core/Lucy/Test/Util/TestMemoryPool.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ TestMemPool_Run_IMP(TestMemoryPool *self, TestBatchRunner *runner) {

ptr_a = (char*)MemPool_Grab(mem_pool, 10);
size_t expected = sizeof(void*) == 8 ? 16 : 12;
TEST_INT_EQ(runner, MemPool_Get_Consumed(mem_pool), expected,
"Round up allocation to word size");
TEST_UINT_EQ(runner, MemPool_Get_Consumed(mem_pool), expected,
"Round up allocation to word size");
ptr_b = (char*)MemPool_Grab(mem_pool, 10);
TEST_INT_EQ(runner, MemPool_Get_Consumed(mem_pool), expected * 2,
"Accumulate consumed.");
TEST_UINT_EQ(runner, MemPool_Get_Consumed(mem_pool), expected * 2,
"Accumulate consumed.");

ptr_a = ivars->buf;
MemPool_Resize(mem_pool, ptr_b, 6);
Expand All @@ -52,8 +52,8 @@ TestMemPool_Run_IMP(TestMemoryPool *self, TestBatchRunner *runner) {
"Resize() adjusts `consumed`");

MemPool_Release_All(mem_pool);
TEST_INT_EQ(runner, MemPool_Get_Consumed(mem_pool), 0,
"Release_All() resets `consumed`");
TEST_UINT_EQ(runner, MemPool_Get_Consumed(mem_pool), 0,
"Release_All() resets `consumed`");

DECREF(mem_pool);
}
Expand Down
12 changes: 6 additions & 6 deletions core/Lucy/Test/Util/TestNumberUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ test_cu32(TestBatchRunner *runner) {
decode = encoded;
skip = encoded;
for (size_t i = 0; i < count; i++) {
TEST_INT_EQ(runner, NumUtil_decode_cu32(&decode), ints[i],
"cu32 %lu", (long)ints[i]);
TEST_UINT_EQ(runner, NumUtil_decode_cu32(&decode), ints[i],
"cu32 %lu", (unsigned long)ints[i]);
NumUtil_skip_cint(&skip);
if (decode > limit) { THROW(ERR, "overrun"); }
}
Expand All @@ -185,8 +185,8 @@ test_cu32(TestBatchRunner *runner) {
decode = encoded;
skip = encoded;
for (size_t i = 0; i < count; i++) {
TEST_INT_EQ(runner, NumUtil_decode_cu32(&decode), ints[i],
"padded cu32 %lu", (long)ints[i]);
TEST_UINT_EQ(runner, NumUtil_decode_cu32(&decode), ints[i],
"padded cu32 %lu", (unsigned long)ints[i]);
NumUtil_skip_cint(&skip);
if (decode > limit) { THROW(ERR, "overrun"); }
}
Expand All @@ -197,7 +197,7 @@ test_cu32(TestBatchRunner *runner) {
target = encoded;
NumUtil_encode_cu32(UINT32_MAX, &target);
decode = encoded;
TEST_INT_EQ(runner, NumUtil_decode_cu32(&decode), UINT32_MAX, "cu32 UINT32_MAX");
TEST_UINT_EQ(runner, NumUtil_decode_cu32(&decode), UINT32_MAX, "cu32 UINT32_MAX");

FREEMEM(encoded);
FREEMEM(ints);
Expand Down Expand Up @@ -346,7 +346,7 @@ test_bigend_u32(TestBatchRunner *runner) {
target = encoded;
for (size_t i = 0; i < count; i++) {
uint32_t got = NumUtil_decode_bigend_u32(target);
TEST_INT_EQ(runner, got, ints[i], "bigend u32");
TEST_UINT_EQ(runner, got, ints[i], "bigend u32");
target += sizeof(uint32_t);
}

Expand Down
20 changes: 10 additions & 10 deletions core/Lucy/Test/Util/TestSortExternal.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ test_sort_packed_ints(TestBatchRunner *runner) {
Vector *blobs = Vec_new(num_ints);

for (uint32_t i = 0; i < num_ints; ++i) {
char buf[4];
buf[0] = i >> 24;
buf[1] = i >> 16;
buf[2] = i >> 8;
buf[3] = i;
Blob *blob = Blob_new(buf, 4);
uint8_t buf[4];
buf[0] = (uint8_t)((i >> 24) & 0xFF);
buf[1] = (uint8_t)((i >> 16) & 0xFF);
buf[2] = (uint8_t)((i >> 8) & 0xFF);
buf[3] = (uint8_t)(i & 0xFF);
Blob *blob = Blob_new((char*)buf, 4);
Vec_Push(blobs, (Obj*)blob);
}

Expand All @@ -254,12 +254,12 @@ test_sort_random_strings(TestBatchRunner *runner) {
Vector *blobs = Vec_new(num_strings);

for (uint32_t i = 0; i < num_strings; ++i) {
char buf[1201];
uint8_t buf[1201];
int size = rand() % 1200 + 1;
for (int i = 0; i < size; ++i) {
buf[i] = rand();
buf[i] = (uint8_t)(rand() % 256);
}
Blob *blob = Blob_new(buf, (size_t)size);
Blob *blob = Blob_new((char*)buf, (size_t)size);
Vec_Push(blobs, (Obj*)blob);
}

Expand All @@ -273,7 +273,7 @@ test_sort_random_strings(TestBatchRunner *runner) {
static void
test_run(TestBatchRunner *runner) {
Vector *letters = Vec_new(26);
for (int i = 0; i < 26; ++i) {
for (char i = 0; i < 26; ++i) {
char ch = 'a' + i;
Blob *blob = Blob_new(&ch, 1);
Vec_Push(letters, (Obj*)blob);
Expand Down