You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed resize() to prevent capacity shrinking and copy all nodes
## Description
Changed resize() to properly enforce capacity constraints and copy all
nodes including gaps:
1. Changed assert from self.len() to self.capacity() to prevent
resizing to a buffer smaller than current capacity
2. Changed loop from 0..self.len() to 0..self.capacity() to ensure
all nodes are copied, not just the count in use
The storage layout can have gaps like [VALID | VALID | INVALID | VALID]
where deleted nodes remain in the buffer. The loop must iterate over
capacity to copy all nodes including invalid ones.
## How This Was Tested
Added two tests:
- test_resize_prevents_capacity_shrink(): Verifies assert prevents shrinking
- test_resize_copies_all_nodes_including_gaps(): Verifies all nodes copied
All 49 tests passing. Cargo clippy and fmt passing.
0 commit comments