Feed `encoder` the two blocks and take the two submissions, checking that the first tail is held back until the second channel fills the blob, and that the blob carries frames of both channels.
(encoder: &mut BatchEncoder)
| 83 | /// is held back until the second channel fills the blob, and that the blob carries frames of |
| 84 | /// both channels. |
| 85 | pub fn encode(encoder: &mut BatchEncoder) -> Self { |
| 86 | let blocks = BlockFixture::chain(2, MULTI_BLOB_PAYLOAD); |
| 87 | for block in &blocks { |
| 88 | encoder.add_block(block.clone()).unwrap(); |
| 89 | } |
| 90 | assert_eq!(encoder.step().unwrap(), StepResult::ChannelClosed); |
| 91 | let first = encoder.next_submission().expect("the first channel fills a blob"); |
| 92 | assert!(encoder.next_submission().is_none(), "its tail waits for more data"); |
| 93 | assert_eq!(encoder.step().unwrap(), StepResult::ChannelClosed); |
| 94 | let packed = encoder.next_submission().expect("the tail and the next channel fill a blob"); |
| 95 | let SubmissionPayload::Blobs(blobs) = packed.payload() else { |
| 96 | panic!("expected a blob submission"); |
| 97 | }; |
| 98 | let channels: HashSet<_> = blobs[0].frames().iter().map(|frame| frame.id).collect(); |
| 99 | assert_eq!(channels.len(), 2, "the blob carries frames of both channels"); |
| 100 | Self { blocks, first, packed } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | /// An open channel that has handed out its first submission, fed blocks of |
no test coverage detected