Skip to content

Commit

Permalink
Add test for size_varint
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardHinnant authored and nbougalis committed Jan 10, 2018
1 parent 7ff6d34 commit d8bbcf2
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/test/nodestore/varint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ class varint_test : public beast::unit_test::suite
testcase("encode, decode");
for (auto const v : vv)
{
std::array<std::uint8_t,
varint_traits<
std::size_t>::max> vi;
auto const n0 =
write_varint(
vi.data(), v);
std::array<std::uint8_t, varint_traits<std::size_t>::max> vi;
auto const n0 = write_varint(vi.data(), v);
expect (n0 > 0, "write error");
expect(n0 == size_varint(v), "size error");
std::size_t v1;
auto const n1 =
read_varint(
vi.data(), n0, v1);
auto const n1 = read_varint(vi.data(), n0, v1);
expect(n1 == n0, "read error");
expect(v == v1, "wrong value");
}
Expand Down

0 comments on commit d8bbcf2

Please sign in to comment.