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

Function checkpoint_preserves_ids

nodedb-spatial/src/persist.rs:338–349  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

336
337 #[test]
338 fn checkpoint_preserves_ids() {
339 let mut tree = RTree::new();
340 tree.insert(make_entry(42, 10.0, 20.0));
341 tree.insert(make_entry(99, 30.0, 40.0));
342
343 let bytes = tree.checkpoint_to_bytes(None).unwrap();
344 let restored = RTree::from_checkpoint(&bytes, None).unwrap();
345
346 let results = restored.search(&BoundingBox::new(5.0, 15.0, 15.0, 25.0));
347 assert_eq!(results.len(), 1);
348 assert_eq!(results[0].id, 42);
349 }
350
351 #[test]
352 fn corrupted_bytes_returns_error() {

Callers

nothing calls this directly

Calls 4

make_entryFunction · 0.70
insertMethod · 0.45
checkpoint_to_bytesMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected