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

Function test_get_contents_ext_basic

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

Source from the content-addressed store, hash-verified

929
930 #[test]
931 fn test_get_contents_ext_basic() {
932 let store = MemoryChangeStore::new();
933 let content = b"External hash content";
934 let change = create_test_change("Ext test", content);
935 let hash = change.hash().unwrap();
936 store.insert(hash, change);
937
938 let node = GraphNode::new(
939 Some(hash),
940 ChangePosition::new(0),
941 ChangePosition::new(content.len() as u64),
942 );
943 let mut buf = vec![0u8; content.len()];
944
945 let n = store.get_contents_ext(node, &mut buf).unwrap();
946
947 assert_eq!(n, content.len());
948 assert_eq!(&buf, content);
949 }
950
951 #[test]
952 fn test_get_contents_ext_none_hash() {

Callers

nothing calls this directly

Calls 6

create_test_changeFunction · 0.70
unwrapMethod · 0.45
hashMethod · 0.45
insertMethod · 0.45
lenMethod · 0.45
get_contents_extMethod · 0.45

Tested by

no test coverage detected