From a2c1815bc2bbd9ff6da3edf50f2e914d28eeff54 Mon Sep 17 00:00:00 2001 From: edef Date: Sun, 1 May 2022 17:30:21 +0000 Subject: ripple/fossil/chunker: test early cutoff for <= MIN_CHUNK_SIZE Full test coverage for Chunker::next! Change-Id: I4f3dbad7e0a56f46d5714e0dd8e07f00ce255928 --- ripple/fossil/src/chunker/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ripple/fossil/src/chunker') diff --git a/ripple/fossil/src/chunker/mod.rs b/ripple/fossil/src/chunker/mod.rs index 108d5de..07b3e8d 100644 --- a/ripple/fossil/src/chunker/mod.rs +++ b/ripple/fossil/src/chunker/mod.rs @@ -196,4 +196,15 @@ mod test { super::MIN_CHUNK_SIZE ); } + + #[test] + fn short_chunk() { + assert_eq!( + super::Chunker::from(&[0u8; super::MIN_CHUNK_SIZE / 2]) + .next() + .unwrap() + .len(), + super::MIN_CHUNK_SIZE / 2 + ); + } } -- cgit 1.4.1