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

Function long_run_uses_rle

nodedb-array/src/codec/coord_rle.rs:235–246  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

233
234 #[test]
235 fn long_run_uses_rle() {
236 // 1000 cells all pointing at index 0 — should trigger RLE.
237 let d = make_dict(vec![0u32; 1000], vec![CoordValue::Int64(42)]);
238 let mut buf = Vec::new();
239 encode_coord_axis_rle(&d, &mut buf).unwrap();
240 // RLE mode: first 4 bytes are the RLE_MARKER sentinel.
241 let first = u32::from_le_bytes(buf[0..4].try_into().unwrap());
242 assert_eq!(first, u32::MAX, "expected RLE mode marker");
243
244 let out = roundtrip(&d);
245 assert_eq!(out.indices, d.indices);
246 }
247
248 #[test]
249 fn no_runs_falls_back_to_delta() {

Callers

nothing calls this directly

Calls 3

encode_coord_axis_rleFunction · 0.85
make_dictFunction · 0.70
roundtripFunction · 0.70

Tested by

no test coverage detected