mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 12:35:50 +00:00
Add test for size_varint
This commit is contained in:
committed by
Nikolaos D. Bougalis
parent
7ff6d34a49
commit
d8bbcf21be
@@ -35,17 +35,12 @@ public:
|
|||||||
testcase("encode, decode");
|
testcase("encode, decode");
|
||||||
for (auto const v : vv)
|
for (auto const v : vv)
|
||||||
{
|
{
|
||||||
std::array<std::uint8_t,
|
std::array<std::uint8_t, varint_traits<std::size_t>::max> vi;
|
||||||
varint_traits<
|
auto const n0 = write_varint(vi.data(), v);
|
||||||
std::size_t>::max> vi;
|
|
||||||
auto const n0 =
|
|
||||||
write_varint(
|
|
||||||
vi.data(), v);
|
|
||||||
expect (n0 > 0, "write error");
|
expect (n0 > 0, "write error");
|
||||||
|
expect(n0 == size_varint(v), "size error");
|
||||||
std::size_t v1;
|
std::size_t v1;
|
||||||
auto const n1 =
|
auto const n1 = read_varint(vi.data(), n0, v1);
|
||||||
read_varint(
|
|
||||||
vi.data(), n0, v1);
|
|
||||||
expect(n1 == n0, "read error");
|
expect(n1 == n0, "read error");
|
||||||
expect(v == v1, "wrong value");
|
expect(v == v1, "wrong value");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user