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

Function test_multiple_changes

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

Source from the content-addressed store, hash-verified

1094
1095 #[test]
1096 fn test_multiple_changes() {
1097 let store = MemoryChangeStore::new();
1098
1099 let changes: Vec<_> = (0..10)
1100 .map(|i| {
1101 let content = format!("Content {}", i);
1102 let change = create_test_change(&format!("Change {}", i), content.as_bytes());
1103 let hash = change.hash().unwrap();
1104 store.insert(hash, change);
1105 (hash, content)
1106 })
1107 .collect();
1108
1109 // Verify all can be retrieved
1110 for (hash, expected_content) in &changes {
1111 let loaded = store.get_change(hash).unwrap();
1112 assert_eq!(
1113 std::str::from_utf8(&loaded.contents).unwrap(),
1114 expected_content
1115 );
1116 }
1117
1118 assert_eq!(store.len(), 10);
1119 }
1120}

Callers

nothing calls this directly

Calls 6

create_test_changeFunction · 0.70
as_bytesMethod · 0.45
unwrapMethod · 0.45
hashMethod · 0.45
insertMethod · 0.45
get_changeMethod · 0.45

Tested by

no test coverage detected