MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / varint_roundtrip

Function varint_roundtrip

nodedb-codec/src/delta.rs:244–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

242
243 #[test]
244 fn varint_roundtrip() {
245 for v in [0u64, 1, 127, 128, 255, 16383, 16384, u64::MAX / 2, u64::MAX] {
246 let mut buf = Vec::new();
247 write_varint(&mut buf, v);
248 let (decoded, consumed) = read_varint(&buf).unwrap();
249 assert_eq!(decoded, v, "varint failed for {v}");
250 assert_eq!(consumed, buf.len());
251 }
252 }
253
254 #[test]
255 fn empty_roundtrip() {

Callers

nothing calls this directly

Calls 2

write_varintFunction · 0.70
read_varintFunction · 0.70

Tested by

no test coverage detected