+ #[test]
+ fn stream_round_trip() {
+ let stream = StreamFrame {
+ lich_idx: 5,
+ lich_part: [1, 2, 3, 4, 5],
+ frame_number: 50,
+ end_of_stream: false,
+ stream_data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
+ };
+ let encoded = encode_stream(&stream);
+ let decoded = crate::decode::parse_stream(&encoded);
+ assert_eq!(decoded, Some(stream));
+ }
+
+ #[test]
+ fn packet_round_trip() {
+ let packet = PacketFrame {
+ payload: [41u8; 25],
+ counter: PacketFrameCounter::Frame { index: 3 },
+ };
+ let encoded = encode_packet(&packet);
+ let decoded = crate::decode::parse_packet(&encoded);
+ assert_eq!(decoded, Some(packet));
+
+ let packet = PacketFrame {
+ payload: [0u8; 25],
+ counter: PacketFrameCounter::FinalFrame { payload_len: 10 },
+ };
+ let encoded = encode_packet(&packet);
+ let decoded = crate::decode::parse_packet(&encoded);
+ assert_eq!(decoded, Some(packet));
+ }
+