Increase bounds for varint tests.

This commit is contained in:
vng 2012-06-09 10:26:06 -07:00 committed by Alex Zolotarev
parent 3af0e02f4c
commit 416aff6975

View file

@ -12,8 +12,10 @@ namespace
vector<unsigned char> data;
PushBackByteSink<vector<unsigned char> > dst(data);
WriteVarUint(dst, x);
ArrayByteSource src(&data[0]);
TEST_EQUAL(ReadVarUint<T>(src), x, ());
size_t const bytesRead = src.PtrUC() - &data[0];
TEST_EQUAL(bytesRead, data.size(), (x));
}
@ -23,8 +25,10 @@ namespace
vector<unsigned char> data;
PushBackByteSink<vector<unsigned char> > dst(data);
WriteVarInt(dst, x);
ArrayByteSource src(&data[0]);
TEST_EQUAL(ReadVarInt<T>(src), x, ());
size_t const bytesRead = src.PtrUC() - &data[0];
TEST_EQUAL(bytesRead, data.size(), (x));
}
@ -63,11 +67,13 @@ UNIT_TEST(VarInt32)
TestVarInt(static_cast<int32_t>(-i));
}
}
for (int i = -300; i <= 300; ++i)
{
int const bound = 10000;
for (int i = -bound; i <= bound; ++i)
TestVarInt(static_cast<int32_t>(i));
TestVarInt(static_cast<int32_t>(-i));
}
for (int i = 0; i <= bound; ++i)
TestVarUint(static_cast<uint32_t>(i));
}
UNIT_TEST(VarIntSize)