Skip to content

Commit

Permalink
Fix read offset from current pos
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusuMET committed Jan 28, 2025
1 parent 950de92 commit e72c6d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hdf5/tests/test_dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn test_byte_read_seek_impl(ds: &hdf5::Dataset, arr: &ArrayD<u8>, ndim: usize) -

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

0 comments on commit e72c6d7

Please sign in to comment.