| 29 | |
| 30 | template <typename T> |
| 31 | void TestVarInt(T const x) |
| 32 | { |
| 33 | vector<uint8_t> data; |
| 34 | PushBackByteSink<vector<uint8_t>> dst(data); |
| 35 | WriteVarInt(dst, x); |
| 36 | |
| 37 | ArrayByteSource src(&data[0]); |
| 38 | TEST_EQUAL(ReadVarInt<T>(src), x, ()); |
| 39 | |
| 40 | size_t const bytesRead = src.PtrUint8() - data.data(); |
| 41 | TEST_EQUAL(bytesRead, data.size(), (x)); |
| 42 | } |
| 43 | } // namespace |
| 44 | |
| 45 | UNIT_TEST(VarUint0) |
no test coverage detected