MCPcopy Create free account
hub / github.com/base/base / test_append_empty_singular_batch

Function test_append_empty_singular_batch

crates/consensus/protocol/src/batch/span.rs:818–842  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

816
817 #[test]
818 fn test_append_empty_singular_batch() {
819 let mut batch = SpanBatch::default();
820 let singular_batch = SingleBatch {
821 epoch_num: 10,
822 epoch_hash: FixedBytes::from([17u8; 32]),
823 parent_hash: FixedBytes::from([17u8; 32]),
824 timestamp: 10,
825 transactions: vec![],
826 };
827 assert!(batch.append_singular_batch(singular_batch, 0).is_ok());
828 assert_eq!(batch.batches.len(), 1);
829 assert_eq!(batch.origin_bits.get_bit(0), Some(1));
830 assert_eq!(batch.block_tx_counts, vec![0]);
831 assert_eq!(batch.txs.tx_data.len(), 0);
832
833 // Add another empty single batch.
834 let singular_batch = SingleBatch {
835 epoch_num: 11,
836 epoch_hash: FixedBytes::from([17u8; 32]),
837 parent_hash: FixedBytes::from([17u8; 32]),
838 timestamp: 20,
839 transactions: vec![],
840 };
841 assert!(batch.append_singular_batch(singular_batch, 1).is_ok());
842 }
843
844 #[test]
845 fn encode_matches_owned_raw_span_batch() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected