Skip to content

Commit 3a2d46c

Browse files
committed
Fix read offset from current pos
1 parent f7038bc commit 3a2d46c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hdf5/tests/test_dataset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ fn test_byte_read_seek_impl(ds: &hdf5::Dataset, arr: &ArrayD<u8>, ndim: usize) -
220220

221221
// Seek from current position
222222
let orig_pos = reader.seek(SeekFrom::Start(pos)).expect("io::Seek failed") as i64;
223-
let rel_pos = rng.random_range(-(arr.len() as i64)..arr.len() as i64 + 1);
223+
let rel_pos = rng.random_range(-(orig_pos as i64)..(arr.len() as i64 - orig_pos) + 1);
224224
let pos_res = reader.seek(SeekFrom::Current(rel_pos));
225225
if (rel_pos + orig_pos) < 0 {
226226
assert!(pos_res.is_err()) // We cannot seek before start

0 commit comments

Comments
 (0)