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

Source from the content-addressed store, hash-verified

953
954 #[test]
955 fn test_get_contents_ext_basic() {
956 let store = MemoryChangeStore::new();
957 let content = b"External hash content";
958 let change = create_test_change("Ext test", content);
959 let hash = change.hash().unwrap();
960 store.insert(hash, change);
961
962 let node = GraphNode::new(
963 Some(hash),
964 ChangePosition::new(0),
965 ChangePosition::new(content.len() as u64),
966 );
967 let mut buf = vec![0u8; content.len()];
968
969 let n = store.get_contents_ext(node, &mut buf).unwrap();
970
971 assert_eq!(n, content.len());
972 assert_eq!(&buf, content);
973 }
974
975 #[test]
976 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