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

Function test_hash_stability

atomic-core/src/change/change.rs:2194–2213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2192
2193 #[test]
2194 fn test_hash_stability() {
2195 // Same change content should always produce same hash
2196 // Use a fixed timestamp to ensure deterministic hashing
2197 let fixed_ts = chrono::DateTime::parse_from_rfc3339("2024-01-15T10:30:00Z")
2198 .unwrap()
2199 .with_timezone(&chrono::Utc);
2200
2201 let make_change = || {
2202 let header = ChangeHeader::builder()
2203 .message("Stable hash test")
2204 .timestamp(fixed_ts)
2205 .build();
2206 Change::new(header, vec![], b"content".to_vec(), vec![])
2207 };
2208
2209 let hash1 = make_change().hash().unwrap();
2210 let hash2 = make_change().hash().unwrap();
2211
2212 assert_eq!(hash1, hash2);
2213 }
2214
2215 #[test]
2216 fn test_v3_magic_bytes() {

Callers

nothing calls this directly

Calls 6

make_changeFunction · 0.50
unwrapMethod · 0.45
buildMethod · 0.45
timestampMethod · 0.45
messageMethod · 0.45
hashMethod · 0.45

Tested by

no test coverage detected