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

Function create_test_entry

atomic-cli/tests/fixtures/helpers_c1.rs:530–542  ·  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

528 /// The hash is created from the hash_str so that when compared with
529 /// a ChangelistEntry using the same string, they will match.
530 fn create_test_entry(sequence: u64, hash_str: &str) -> HistoryEntry {
531 // Create a hash that will produce the expected base32 string
532 // For testing, we use a hash derived from the string itself
533 let hash = Hash::of(hash_str.as_bytes());
534 HistoryEntry {
535 sequence,
536 hash,
537 state: Merkle::ZERO,
538 node_id: NodeId::from(sequence),
539 header: None,
540 is_tagged: false,
541 }
542 }
543
544 /// Create a test changelist entry.
545 /// 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