From 96b29d848eae315e5540aa0325ad91937b65d620 Mon Sep 17 00:00:00 2001 From: Marshall Pierce <575695+marshallpierce@users.noreply.github.com> Date: Sat, 26 Aug 2023 06:19:06 -0600 Subject: [PATCH] Improve comments and increase test paranoia. --- src/chunked_encoder.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chunked_encoder.rs b/src/chunked_encoder.rs index 6be02b5..69bc745 100644 --- a/src/chunked_encoder.rs +++ b/src/chunked_encoder.rs @@ -34,6 +34,8 @@ impl<'e, E: Engine + ?Sized> ChunkedEncoder<'e, E> { let mut len = self.engine.internal_encode(chunk, &mut buf); if chunk.len() != CHUNK_SIZE && self.engine.config().encode_padding() { // Final, potentially partial, chunk. + // Only need to consider if padding is needed on a partial chunk since full chunk + // is a multiple of 3, which therefore won't be padded. // Pad output to multiple of four bytes if required by config. len += add_padding(len, &mut buf[len..]); } @@ -121,7 +123,7 @@ pub mod tests { let mut rng = rand::rngs::SmallRng::from_entropy(); let input_len_range = Uniform::new(1, 10_000); - for _ in 0..5_000 { + for _ in 0..20_000 { input_buf.clear(); output_buf.clear();