MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / kid_and_cipher_alg_roundtrip

Function kid_and_cipher_alg_roundtrip

nodedb-wal/src/preamble.rs:192–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190
191 #[test]
192 fn kid_and_cipher_alg_roundtrip() {
193 // Construct manually with non-zero kid.
194 let p = SegmentPreamble {
195 magic: WAL_PREAMBLE_MAGIC,
196 version: PREAMBLE_VERSION,
197 cipher_alg: CIPHER_AES_256_GCM,
198 kid: 3,
199 epoch: [1, 2, 3, 4],
200 };
201 let bytes = p.to_bytes();
202 let parsed = SegmentPreamble::from_bytes(&bytes, &WAL_PREAMBLE_MAGIC).unwrap();
203 assert_eq!(parsed.kid, 3);
204 assert_eq!(parsed.epoch, [1, 2, 3, 4]);
205 }
206
207 #[test]
208 fn reserved_bytes_are_zero() {

Callers

nothing calls this directly

Calls 1

to_bytesMethod · 0.45

Tested by

no test coverage detected