Skip to content

Commit 0c61038

Browse files
committed
unit test
Signed-off-by: Alexander Droste <[email protected]>
1 parent 57d66a0 commit 0c61038

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

vortex-buffer/src/buffer.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,4 +741,16 @@ mod test {
741741
assert!(buff.is_aligned(Alignment::of::<i32>()));
742742
assert_eq!(vec, buff);
743743
}
744+
745+
#[test]
746+
fn test_slice_unaligned_end_pos() {
747+
let data = vec![0u8; 2];
748+
// Overalign the u8 vector.
749+
let aligned_buffer = Buffer::copy_from_aligned(&data, Alignment::new(8));
750+
// Previously, `Buffer::slice` incorrectly asserted that the end position
751+
// must be aligned. That assertion has been removed such that the end
752+
// position can be arbitrary and only the beginning of the slice needs
753+
// to be aligned.
754+
aligned_buffer.slice(0..1);
755+
}
744756
}

0 commit comments

Comments
 (0)