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:846–867  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

844
845 #[test]
846 fn test_get_contents_empty_vertex() {
847 let store = MemoryChangeStore::new();
848 let change = create_test_change("Empty node", b"data");
849 let hash = change.hash().unwrap();
850 store.insert(hash, change);
851
852 let node_id = NodeId::new(1);
853 let hash_fn = move |id: NodeId| {
854 if id == node_id {
855 Some(hash)
856 } else {
857 None
858 }
859 };
860
861 // Empty range (start == end)
862 let node = GraphNode::new(node_id, ChangePosition::new(5), ChangePosition::new(5));
863 let mut buf = vec![0u8; 0];
864
865 let n = store.get_contents(hash_fn, node, &mut buf).unwrap();
866 assert_eq!(n, 0);
867 }
868
869 #[test]
870 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