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

Function test_multiple_changes

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

Source from the content-addressed store, hash-verified

1118
1119 #[test]
1120 fn test_multiple_changes() {
1121 let store = MemoryChangeStore::new();
1122
1123 let changes: Vec<_> = (0..10)
1124 .map(|i| {
1125 let content = format!("Content {}", i);
1126 let change = create_test_change(&format!("Change {}", i), content.as_bytes());
1127 let hash = change.hash().unwrap();
1128 store.insert(hash, change);
1129 (hash, content)
1130 })
1131 .collect();
1132
1133 // Verify all can be retrieved
1134 for (hash, expected_content) in &changes {
1135 let loaded = store.get_change(hash).unwrap();
1136 assert_eq!(
1137 std::str::from_utf8(&loaded.contents).unwrap(),
1138 expected_content
1139 );
1140 }
1141
1142 assert_eq!(store.len(), 10);
1143 }
1144}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected