MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_get_contents_empty_vertex

Function test_get_contents_empty_vertex

atomic-core/src/change/store.rs:870–891  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

868
869 #[test]
870 fn test_get_contents_empty_vertex() {
871 let store = MemoryChangeStore::new();
872 let change = create_test_change("Empty node", b"data");
873 let hash = change.hash().unwrap();
874 store.insert(hash, change);
875
876 let node_id = NodeId::new(1);
877 let hash_fn = move |id: NodeId| {
878 if id == node_id {
879 Some(hash)
880 } else {
881 None
882 }
883 };
884
885 // Empty range (start == end)
886 let node = GraphNode::new(node_id, ChangePosition::new(5), ChangePosition::new(5));
887 let mut buf = vec![0u8; 0];
888
889 let n = store.get_contents(hash_fn, node, &mut buf).unwrap();
890 assert_eq!(n, 0);
891 }
892
893 #[test]
894 fn test_get_contents_root_vertex() {

Callers

nothing calls this directly

Calls 5

create_test_changeFunction · 0.70
unwrapMethod · 0.45
hashMethod · 0.45
insertMethod · 0.45
get_contentsMethod · 0.45

Tested by

no test coverage detected