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 2016/03/20 06:54:04 UTC
[10/14] lucy-clownfish git commit: Address int warnings in core tests.
Address int warnings in core tests.
Fix warnings from `-Wconversion`.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/0f6fdb45
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/0f6fdb45
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/0f6fdb45
Branch: refs/heads/master
Commit: 0f6fdb45b9ad0f60391dcb81e0e7d05f83aeada7
Parents: e37b154
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 01:58:57 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700
----------------------------------------------------------------------
runtime/core/Clownfish/Test/TestBlob.c | 4 +-
runtime/core/Clownfish/Test/TestByteBuf.c | 8 ++--
runtime/core/Clownfish/Test/TestHash.c | 22 ++++-----
.../core/Clownfish/Test/TestLockFreeRegistry.c | 2 +-
runtime/core/Clownfish/Test/TestNum.c | 2 +-
runtime/core/Clownfish/Test/TestString.c | 50 ++++++++++----------
runtime/core/Clownfish/Test/TestVector.c | 34 ++++++-------
runtime/core/Clownfish/Test/Util/TestMemory.c | 20 ++++----
.../core/Clownfish/Test/Util/TestStringHelper.c | 12 ++---
9 files changed, 77 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestBlob.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestBlob.c b/runtime/core/Clownfish/Test/TestBlob.c
index 9307f5f..c8c70c3 100644
--- a/runtime/core/Clownfish/Test/TestBlob.c
+++ b/runtime/core/Clownfish/Test/TestBlob.c
@@ -49,8 +49,8 @@ test_Equals(TestBatchRunner *runner) {
{
Blob *other = Blob_new("bar", 4);
- TEST_INT_EQ(runner, Blob_Get_Size(blob), Blob_Get_Size(other),
- "same length");
+ TEST_UINT_EQ(runner, Blob_Get_Size(blob), Blob_Get_Size(other),
+ "same length");
TEST_FALSE(runner, Blob_Equals(blob, (Obj*)other),
"Different content spoils Equals");
DECREF(other);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestByteBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestByteBuf.c b/runtime/core/Clownfish/Test/TestByteBuf.c
index 6e8063c..bc29bb1 100644
--- a/runtime/core/Clownfish/Test/TestByteBuf.c
+++ b/runtime/core/Clownfish/Test/TestByteBuf.c
@@ -59,8 +59,8 @@ test_Equals(TestBatchRunner *runner) {
{
ByteBuf *other = BB_new_bytes("bar", 4);
- TEST_INT_EQ(runner, BB_Get_Size(bb), BB_Get_Size(other),
- "same length");
+ TEST_UINT_EQ(runner, BB_Get_Size(bb), BB_Get_Size(other),
+ "same length");
TEST_FALSE(runner, BB_Equals(bb, (Obj*)other),
"Different content spoils Equals");
DECREF(other);
@@ -72,10 +72,10 @@ test_Equals(TestBatchRunner *runner) {
static void
test_Grow(TestBatchRunner *runner) {
ByteBuf *bb = BB_new(1);
- TEST_INT_EQ(runner, BB_Get_Capacity(bb), 8,
+ TEST_UINT_EQ(runner, BB_Get_Capacity(bb), 8,
"Allocate in 8-byte increments");
BB_Grow(bb, 9);
- TEST_INT_EQ(runner, BB_Get_Capacity(bb), 16,
+ TEST_UINT_EQ(runner, BB_Get_Capacity(bb), 16,
"Grow in 8-byte increments");
DECREF(bb);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestHash.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestHash.c b/runtime/core/Clownfish/Test/TestHash.c
index c5c9c1f..e77c816 100644
--- a/runtime/core/Clownfish/Test/TestHash.c
+++ b/runtime/core/Clownfish/Test/TestHash.c
@@ -80,8 +80,8 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
}
TEST_TRUE(runner, Hash_Equals(hash, (Obj*)dupe), "Equals");
- TEST_INT_EQ(runner, Hash_Get_Capacity(hash), starting_cap,
- "Initial capacity sufficient (no rebuilds)");
+ TEST_UINT_EQ(runner, Hash_Get_Capacity(hash), starting_cap,
+ "Initial capacity sufficient (no rebuilds)");
for (size_t i = 0; i < 100; i++) {
String *key = (String*)Vec_Fetch(expected, i);
@@ -91,8 +91,8 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
TEST_TRUE(runner, Vec_Equals(got, (Obj*)expected),
"basic Store and Fetch");
- TEST_INT_EQ(runner, Hash_Get_Size(hash), 100,
- "size incremented properly by Hash_Store");
+ TEST_UINT_EQ(runner, Hash_Get_Size(hash), 100,
+ "size incremented properly by Hash_Store");
TEST_TRUE(runner, Hash_Fetch(hash, foo) == NULL,
"Fetch against non-existent key returns NULL");
@@ -103,18 +103,18 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
"Hash_Store replaces existing value");
TEST_FALSE(runner, Hash_Equals(hash, (Obj*)dupe),
"replacement value spoils equals");
- TEST_INT_EQ(runner, Hash_Get_Size(hash), 100,
- "size unaffected after value replaced");
+ TEST_UINT_EQ(runner, Hash_Get_Size(hash), 100,
+ "size unaffected after value replaced");
TEST_TRUE(runner, Hash_Delete(hash, forty) == stored_foo,
"Delete returns value");
DECREF(stored_foo);
- TEST_INT_EQ(runner, Hash_Get_Size(hash), 99,
- "size decremented by successful Delete");
+ TEST_UINT_EQ(runner, Hash_Get_Size(hash), 99,
+ "size decremented by successful Delete");
TEST_TRUE(runner, Hash_Delete(hash, forty) == NULL,
"Delete returns NULL when key not found");
- TEST_INT_EQ(runner, Hash_Get_Size(hash), 99,
- "size not decremented by unsuccessful Delete");
+ TEST_UINT_EQ(runner, Hash_Get_Size(hash), 99,
+ "size not decremented by unsuccessful Delete");
DECREF(Hash_Delete(dupe, forty));
TEST_TRUE(runner, Vec_Equals(got, (Obj*)expected), "Equals after Delete");
@@ -236,7 +236,7 @@ test_store_skips_tombstone(TestBatchRunner *runner) {
Hash_Delete(hash, one);
Hash_Store(hash, two, (Obj*)CFISH_TRUE);
- TEST_INT_EQ(runner, Hash_Get_Size(hash), 1, "Store skips tombstone");
+ TEST_UINT_EQ(runner, Hash_Get_Size(hash), 1, "Store skips tombstone");
DECREF(one);
DECREF(two);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestLockFreeRegistry.c b/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
index 4b0fe1b..b70ff1f 100644
--- a/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
+++ b/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
@@ -123,7 +123,7 @@ test_threads(TestBatchRunner *runner) {
// Fisher-Yates shuffle.
for (uint32_t j = num_objs - 1; j > 0; j--) {
- uint32_t r = TestUtils_random_u64() % (j + 1);
+ uint32_t r = (uint32_t)TestUtils_random_u64() % (j + 1);
uint32_t tmp = nums[j];
nums[j] = nums[r];
nums[r] = tmp;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestNum.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestNum.c b/runtime/core/Clownfish/Test/TestNum.c
index 0e88455..0864cd7 100644
--- a/runtime/core/Clownfish/Test/TestNum.c
+++ b/runtime/core/Clownfish/Test/TestNum.c
@@ -178,7 +178,7 @@ test_Equals_and_Compare_To(TestBatchRunner *runner) {
// NOTICE: When running these tests on x86/x64, it's best to compile
// with -ffloat-store to avoid excess FPU precision which can hide
// implementation bugs.
- S_test_compare_float_int(runner, INT64_MAX * 2.0, INT64_MAX, 1);
+ S_test_compare_float_int(runner, (double)INT64_MAX * 2.0, INT64_MAX, 1);
S_test_compare_float_int(runner, pow(2.0, 60.0), INT64_C(1) << 60, 0);
S_test_compare_float_int(runner, pow(2.0, 60.0), (INT64_C(1) << 60) - 1,
1);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestString.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestString.c b/runtime/core/Clownfish/Test/TestString.c
index 64d686c..46b50c8 100644
--- a/runtime/core/Clownfish/Test/TestString.c
+++ b/runtime/core/Clownfish/Test/TestString.c
@@ -35,7 +35,7 @@
#define SMILEY "\xE2\x98\xBA"
static char smiley[] = { (char)0xE2, (char)0x98, (char)0xBA, 0 };
static uint32_t smiley_len = 3;
-static uint32_t smiley_cp = 0x263A;
+static int32_t smiley_cp = 0x263A;
TestString*
TestStr_new() {
@@ -49,19 +49,19 @@ S_get_str(const char *string) {
// Surround a smiley with lots of whitespace.
static String*
-S_smiley_with_whitespace(int *num_spaces_ptr) {
+S_smiley_with_whitespace(size_t *num_spaces_ptr) {
int32_t spaces[] = {
' ', '\t', '\r', '\n', 0x000B, 0x000C, 0x000D, 0x0085,
0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,
0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F,
0x205F, 0x3000
};
- int num_spaces = sizeof(spaces) / sizeof(uint32_t);
+ size_t num_spaces = sizeof(spaces) / sizeof(uint32_t);
CharBuf *buf = CB_new(0);
- for (int i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
+ for (size_t i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
CB_Cat_Char(buf, smiley_cp);
- for (int i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
+ for (size_t i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
String *retval = CB_To_String(buf);
if (num_spaces_ptr) { *num_spaces_ptr = num_spaces; }
@@ -386,7 +386,7 @@ test_To_ByteBuf(TestBatchRunner *runner) {
static void
test_Length(TestBatchRunner *runner) {
String *string = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
- TEST_INT_EQ(runner, Str_Length(string), 6, "Length");
+ TEST_UINT_EQ(runner, Str_Length(string), 6, "Length");
DECREF(string);
}
@@ -465,7 +465,7 @@ test_Get_Ptr8(TestBatchRunner *runner) {
TEST_TRUE(runner, strcmp(ptr8, "Banana") == 0, "Get_Ptr8");
size_t size = Str_Get_Size(string);
- TEST_INT_EQ(runner, size, 6, "Get_Size");
+ TEST_UINT_EQ(runner, size, 6, "Get_Size");
DECREF(string);
}
@@ -580,21 +580,21 @@ test_iterator(TestBatchRunner *runner) {
StringIterator *iter = Str_Top(string);
StrIter_Next(iter);
- TEST_INT_EQ(runner, StrIter_Advance(iter, 2), 2,
- "Advance returns number of code points");
+ TEST_UINT_EQ(runner, StrIter_Advance(iter, 2), 2,
+ "Advance returns number of code points");
TEST_INT_EQ(runner, StrIter_Next(iter), code_points[3],
"Advance works");
- TEST_INT_EQ(runner,
- StrIter_Advance(iter, 1000000), num_code_points - 4,
- "Advance past end of string");
+ TEST_UINT_EQ(runner,
+ StrIter_Advance(iter, 1000000), num_code_points - 4,
+ "Advance past end of string");
StrIter_Prev(iter);
- TEST_INT_EQ(runner, StrIter_Recede(iter, 2), 2,
- "Recede returns number of code points");
+ TEST_UINT_EQ(runner, StrIter_Recede(iter, 2), 2,
+ "Recede returns number of code points");
TEST_INT_EQ(runner, StrIter_Prev(iter), code_points[num_code_points-4],
"Recede works");
- TEST_INT_EQ(runner, StrIter_Recede(iter, 1000000), num_code_points - 4,
- "Recede past start of string");
+ TEST_UINT_EQ(runner, StrIter_Recede(iter, 1000000), num_code_points - 4,
+ "Recede past start of string");
DECREF(iter);
}
@@ -605,24 +605,24 @@ test_iterator(TestBatchRunner *runner) {
static void
test_iterator_whitespace(TestBatchRunner *runner) {
- int num_spaces;
+ size_t num_spaces;
String *ws_smiley = S_smiley_with_whitespace(&num_spaces);
{
StringIterator *iter = Str_Top(ws_smiley);
- TEST_INT_EQ(runner, StrIter_Skip_Whitespace(iter), num_spaces,
- "Skip_Whitespace");
- TEST_INT_EQ(runner, StrIter_Skip_Whitespace(iter), 0,
- "Skip_Whitespace without whitespace");
+ TEST_UINT_EQ(runner, StrIter_Skip_Whitespace(iter), num_spaces,
+ "Skip_Whitespace");
+ TEST_UINT_EQ(runner, StrIter_Skip_Whitespace(iter), 0,
+ "Skip_Whitespace without whitespace");
DECREF(iter);
}
{
StringIterator *iter = Str_Tail(ws_smiley);
- TEST_INT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), num_spaces,
- "Skip_Whitespace_Back");
- TEST_INT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), 0,
- "Skip_Whitespace_Back without whitespace");
+ TEST_UINT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), num_spaces,
+ "Skip_Whitespace_Back");
+ TEST_UINT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), 0,
+ "Skip_Whitespace_Back without whitespace");
DECREF(iter);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestVector.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestVector.c b/runtime/core/Clownfish/Test/TestVector.c
index a2a0a1e..d032360 100644
--- a/runtime/core/Clownfish/Test/TestVector.c
+++ b/runtime/core/Clownfish/Test/TestVector.c
@@ -117,7 +117,7 @@ test_Store_Fetch(TestBatchRunner *runner) {
Vec_Store(array, 2, (Obj*)Str_newf("foo"));
elem = (String*)CERTIFY(Vec_Fetch(array, 2), STRING);
- TEST_INT_EQ(runner, 3, Vec_Get_Size(array), "Store updates size");
+ TEST_UINT_EQ(runner, 3, Vec_Get_Size(array), "Store updates size");
TEST_TRUE(runner, Str_Equals_Utf8(elem, "foo", 3), "Store");
elem = (String*)INCREF(elem);
@@ -135,7 +135,7 @@ test_Store_Fetch(TestBatchRunner *runner) {
array = S_array_with_garbage();
Vec_Store(array, 40, (Obj*)CFISH_TRUE);
bool all_null = true;
- for (int i = 10; i < 40; i++) {
+ for (size_t i = 10; i < 40; i++) {
if (Vec_Fetch(array, i) != NULL) { all_null = false; }
}
TEST_TRUE(runner, all_null, "Out-of-bounds Store clears excised elements");
@@ -147,7 +147,7 @@ test_Push_Pop_Insert(TestBatchRunner *runner) {
Vector *array = Vec_new(0);
String *elem;
- TEST_INT_EQ(runner, Vec_Get_Size(array), 0, "size starts at 0");
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 0, "size starts at 0");
TEST_TRUE(runner, Vec_Pop(array) == NULL,
"Pop from empty array returns NULL");
@@ -155,34 +155,34 @@ test_Push_Pop_Insert(TestBatchRunner *runner) {
Vec_Push(array, (Obj*)Str_newf("b"));
Vec_Push(array, (Obj*)Str_newf("c"));
- TEST_INT_EQ(runner, Vec_Get_Size(array), 3, "size after Push");
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 3, "size after Push");
TEST_TRUE(runner, NULL != CERTIFY(Vec_Fetch(array, 2), STRING), "Push");
elem = (String*)CERTIFY(Vec_Pop(array), STRING);
TEST_TRUE(runner, Str_Equals_Utf8(elem, "c", 1), "Pop");
- TEST_INT_EQ(runner, Vec_Get_Size(array), 2, "size after Pop");
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 2, "size after Pop");
DECREF(elem);
Vec_Insert(array, 0, (Obj*)Str_newf("foo"));
elem = (String*)CERTIFY(Vec_Fetch(array, 0), STRING);
TEST_TRUE(runner, Str_Equals_Utf8(elem, "foo", 3), "Insert");
- TEST_INT_EQ(runner, Vec_Get_Size(array), 3, "size after Insert");
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 3, "size after Insert");
for (int i = 0; i < 256; ++i) {
Vec_Push(array, (Obj*)Str_newf("flotsam"));
}
- for (int i = 0; i < 512; ++i) {
+ for (size_t i = 0; i < 512; ++i) {
Vec_Insert(array, i, (Obj*)Str_newf("jetsam"));
}
- TEST_INT_EQ(runner, Vec_Get_Size(array), 3 + 256 + 512,
- "size after exercising Push and Insert");
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 3 + 256 + 512,
+ "size after exercising Push and Insert");
DECREF(array);
}
static void
test_Insert_All(TestBatchRunner *runner) {
- size_t i;
+ int64_t i;
{
Vector *dst = Vec_new(20);
@@ -211,7 +211,7 @@ test_Insert_All(TestBatchRunner *runner) {
for (i = 0; i < 10; i++) { Vec_Push(src, (Obj*)Int_new(i + 20)); }
for (i = 0; i < 10; i++) { Vec_Push(wanted, (Obj*)Int_new(i)); }
for (i = 0; i < 10; i++) {
- Vec_Store(wanted, i + 20, (Obj*)Int_new(i + 20));
+ Vec_Store(wanted, (size_t)i + 20, (Obj*)Int_new(i + 20));
}
Vec_Insert_All(dst, 20, src);
@@ -250,26 +250,26 @@ test_Resize(TestBatchRunner *runner) {
uint32_t i;
for (i = 0; i < 2; i++) { Vec_Push(array, (Obj*)Str_newf("%u32", i)); }
- TEST_INT_EQ(runner, Vec_Get_Capacity(array), 3, "Start with capacity 3");
+ TEST_UINT_EQ(runner, Vec_Get_Capacity(array), 3, "Start with capacity 3");
Vec_Resize(array, 4);
- TEST_INT_EQ(runner, Vec_Get_Size(array), 4, "Resize up");
- TEST_INT_EQ(runner, Vec_Get_Capacity(array), 4,
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 4, "Resize up");
+ TEST_UINT_EQ(runner, Vec_Get_Capacity(array), 4,
"Resize changes capacity");
Vec_Resize(array, 2);
- TEST_INT_EQ(runner, Vec_Get_Size(array), 2, "Resize down");
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 2, "Resize down");
TEST_TRUE(runner, Vec_Fetch(array, 2) == NULL, "Resize down zaps elem");
Vec_Resize(array, 2);
- TEST_INT_EQ(runner, Vec_Get_Size(array), 2, "Resize to same size");
+ TEST_UINT_EQ(runner, Vec_Get_Size(array), 2, "Resize to same size");
DECREF(array);
array = S_array_with_garbage();
Vec_Resize(array, 40);
bool all_null = true;
- for (int i = 10; i < 40; i++) {
+ for (size_t i = 10; i < 40; i++) {
if (Vec_Fetch(array, i) != NULL) { all_null = false; }
}
TEST_TRUE(runner, all_null, "Resize clears excised elements");
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/Util/TestMemory.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/Util/TestMemory.c b/runtime/core/Clownfish/Test/Util/TestMemory.c
index 9bab8d4..2800708 100644
--- a/runtime/core/Clownfish/Test/Util/TestMemory.c
+++ b/runtime/core/Clownfish/Test/Util/TestMemory.c
@@ -68,38 +68,38 @@ test_oversize__growth_rate(TestBatchRunner *runner) {
average_growth_rate);
}
- for (int minimum = 1; minimum < 8; minimum++) {
+ for (size_t minimum = 1; minimum < 8; minimum++) {
uint64_t next_size = Memory_oversize(minimum, sizeof(void*));
double growth_rate = CHY_U64_TO_DOUBLE(next_size) / (double)minimum;
TEST_TRUE(runner, growth_rate > 1.2,
- "Growth rate is higher for smaller arrays (%d, %.3f)", minimum,
- growth_rate);
+ "Growth rate is higher for smaller arrays (%u, %.3f)",
+ (unsigned)minimum, growth_rate);
}
}
static void
test_oversize__ceiling(TestBatchRunner *runner) {
- for (int width = 0; width < 10; width++) {
+ for (unsigned width = 0; width < 10; width++) {
size_t size = Memory_oversize(SIZE_MAX, width);
TEST_TRUE(runner, size == SIZE_MAX,
- "Memory_oversize hits ceiling at SIZE_MAX (width %d)", width);
+ "Memory_oversize hits ceiling at SIZE_MAX (width %u)", width);
size = Memory_oversize(SIZE_MAX - 1, width);
TEST_TRUE(runner, size == SIZE_MAX,
- "Memory_oversize hits ceiling at SIZE_MAX (width %d)", width);
+ "Memory_oversize hits ceiling at SIZE_MAX (width %u)", width);
}
}
static void
test_oversize__rounding(TestBatchRunner *runner) {
- int widths[] = { 1, 2, 4, 0 };
+ unsigned 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++) {
+ unsigned width = widths[width_tick];
+ for (unsigned i = 0; i < 25; i++) {
size_t size = Memory_oversize(i, width);
size_t bytes = size * width;
if (bytes % sizeof(void*) != 0) {
- FAIL(runner, "Rounding failure for %d, width %d",
+ FAIL(runner, "Rounding failure for %u, width %u",
i, width);
return;
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/runtime/core/Clownfish/Test/Util/TestStringHelper.c
index b26dc24..64529d4 100644
--- a/runtime/core/Clownfish/Test/Util/TestStringHelper.c
+++ b/runtime/core/Clownfish/Test/Util/TestStringHelper.c
@@ -130,17 +130,17 @@ static void
test_overlap(TestBatchRunner *runner) {
size_t result;
result = StrHelp_overlap("", "", 0, 0);
- TEST_INT_EQ(runner, result, 0, "two empty strings");
+ TEST_UINT_EQ(runner, result, 0, "two empty strings");
result = StrHelp_overlap("", "foo", 0, 3);
- TEST_INT_EQ(runner, result, 0, "first string is empty");
+ TEST_UINT_EQ(runner, result, 0, "first string is empty");
result = StrHelp_overlap("foo", "", 3, 0);
- TEST_INT_EQ(runner, result, 0, "second string is empty");
+ TEST_UINT_EQ(runner, result, 0, "second string is empty");
result = StrHelp_overlap("foo", "foo", 3, 3);
- TEST_INT_EQ(runner, result, 3, "equal strings");
+ TEST_UINT_EQ(runner, result, 3, "equal strings");
result = StrHelp_overlap("foo bar", "foo", 7, 3);
- TEST_INT_EQ(runner, result, 3, "first string is longer");
+ TEST_UINT_EQ(runner, result, 3, "first string is longer");
result = StrHelp_overlap("foo", "foo bar", 3, 7);
- TEST_INT_EQ(runner, result, 3, "second string is longer");
+ TEST_UINT_EQ(runner, result, 3, "second string is longer");
}