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

Function header_round_trip

nodedb-array/src/segment/format/header.rs:106–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104
105 #[test]
106 fn header_round_trip() {
107 let h = SegmentHeader::new(0xDEAD_BEEF_CAFE_BABE);
108 let mut buf = Vec::new();
109 let n = h.encode_to(&mut buf);
110 assert_eq!(n, HEADER_SIZE);
111 assert_eq!(buf.len(), HEADER_SIZE);
112 let d = SegmentHeader::decode(&buf).unwrap();
113 assert_eq!(d, h);
114 }
115
116 #[test]
117 fn header_rejects_bad_magic() {

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.50
encode_toMethod · 0.45

Tested by

no test coverage detected