Skip to content

Commit 282f607

Browse files
committed
add a test-case to test for correct handling of missing padding
1 parent b478799 commit 282f607

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bit_vec/fast_rs_vec/tests.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,3 +1370,19 @@ fn test_append_regression_i29() {
13701370
assert_eq!(rs.rank0, 63);
13711371
assert_eq!(rs.rank1, 1);
13721372
}
1373+
1374+
#[test]
1375+
fn test_simd_fallback() {
1376+
// Test case that should fail if run with SIMD enabled if the SIMD implementation attempts
1377+
// to load a non-full block into a full SIMD register.
1378+
// If implemented correctly, the SIMD implementation falls back to the non-SIMD implementation
1379+
// to avoid out of bounds reads. It is likely that other test cases fail as well, but this
1380+
// explicitly exists to test this case.
1381+
let bv = BitVec::from_zeros(SUPER_BLOCK_SIZE + 3 * BLOCK_SIZE + 3);
1382+
let rs = RsVec::from_bit_vec(bv);
1383+
1384+
assert_eq!(
1385+
rs.select0(SUPER_BLOCK_SIZE + 3 * BLOCK_SIZE + 1),
1386+
SUPER_BLOCK_SIZE + 3 * BLOCK_SIZE + 1
1387+
);
1388+
}

0 commit comments

Comments
 (0)