From 416aff6975dc35192209b13e0673943450896eda Mon Sep 17 00:00:00 2001 From: vng Date: Sat, 9 Jun 2012 10:26:06 -0700 Subject: [PATCH] Increase bounds for varint tests. --- coding/coding_tests/varint_test.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/coding/coding_tests/varint_test.cpp b/coding/coding_tests/varint_test.cpp index b7386e02a4..1dc3b7bd29 100644 --- a/coding/coding_tests/varint_test.cpp +++ b/coding/coding_tests/varint_test.cpp @@ -12,8 +12,10 @@ namespace vector data; PushBackByteSink > dst(data); WriteVarUint(dst, x); + ArrayByteSource src(&data[0]); TEST_EQUAL(ReadVarUint(src), x, ()); + size_t const bytesRead = src.PtrUC() - &data[0]; TEST_EQUAL(bytesRead, data.size(), (x)); } @@ -23,8 +25,10 @@ namespace vector data; PushBackByteSink > dst(data); WriteVarInt(dst, x); + ArrayByteSource src(&data[0]); TEST_EQUAL(ReadVarInt(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(-i)); } } - for (int i = -300; i <= 300; ++i) - { + + int const bound = 10000; + for (int i = -bound; i <= bound; ++i) TestVarInt(static_cast(i)); - TestVarInt(static_cast(-i)); - } + + for (int i = 0; i <= bound; ++i) + TestVarUint(static_cast(i)); } UNIT_TEST(VarIntSize)