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

Function serialization_roundtrip

nodedb-columnar/src/pk_index.rs:308–320  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

306
307 #[test]
308 fn serialization_roundtrip() {
309 let mut idx = PkIndex::new();
310 let pks: Vec<Vec<u8>> = (0..100).map(|i| encode_pk(&Value::Integer(i))).collect();
311 idx.bulk_insert(0, &pks).expect("bulk insert");
312
313 let bytes = idx.to_bytes().expect("serialize");
314 let restored = PkIndex::from_bytes(&bytes).expect("deserialize");
315
316 assert_eq!(restored.len(), 100);
317 let loc = restored.get(&pks[50]).expect("lookup");
318 assert_eq!(loc.segment_id, 0);
319 assert_eq!(loc.row_index, 50);
320 }
321
322 #[test]
323 fn int_sort_order() {

Callers

nothing calls this directly

Calls 6

encode_pkFunction · 0.85
collectMethod · 0.80
bulk_insertMethod · 0.80
expectMethod · 0.45
to_bytesMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected