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

Function create_test_entry

atomic-cli/tests/fixtures/helpers_c6.rs:699–711  ·  view source on GitHub ↗

Create a test history entry with a deterministic hash. The hash is created from the hash_str so that when compared with a ChangelistEntry using the same string, they will match.

(sequence: u64, hash_str: &str)

Source from the content-addressed store, hash-verified

697 /// The hash is created from the hash_str so that when compared with
698 /// a ChangelistEntry using the same string, they will match.
699 fn create_test_entry(sequence: u64, hash_str: &str) -> HistoryEntry {
700 // Create a hash that will produce the expected base32 string
701 // For testing, we use a hash derived from the string itself
702 let hash = Hash::of(hash_str.as_bytes());
703 HistoryEntry {
704 sequence,
705 hash,
706 state: Merkle::ZERO,
707 node_id: NodeId::from(sequence),
708 header: None,
709 is_tagged: false,
710 }
711 }
712
713 /// Create a test changelist entry.
714 /// The hash should be the base32 encoding of the same hash used in create_test_entry.

Callers

nothing calls this directly

Calls 1

as_bytesMethod · 0.45

Tested by

no test coverage detected