()
| 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() { |