From 68f13e0f1c2b6090ebb2299442ca1945572ce4ee Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Fri, 3 Feb 2023 00:10:12 -0500 Subject: [PATCH] Ensure padding a frozen view buffer won't resize, and have to move the vec --- croaring/tests/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/croaring/tests/lib.rs b/croaring/tests/lib.rs index 2603e28..994961b 100644 --- a/croaring/tests/lib.rs +++ b/croaring/tests/lib.rs @@ -114,6 +114,8 @@ fn test_portable_view() { #[test] fn test_frozen_view() { let mut buffer = fs::read("tests/data/frozen_bitmap.bin").unwrap(); + // Ensure inserting zeros won't move the data + buffer.reserve(32); let offset = 32 - (buffer.as_ptr() as usize) % 32; buffer.splice(..0, iter::repeat(0).take(offset));