fn test_par_3() {
let mut output = Vec::new();
const chunk_size: usize = 100;
parallel_compress::<&mut Vec<u8>, [u8; chunk_size]>(data, &mut output, 10, 4, chunk_size)
.unwrap();
let b_size = 100;
let mut decomp = vec![0; b_size];
let mut s = { Seekable::init_buf(output.as_mut_slice()).unwrap() };
let mut start_offset = 0;
let end_offset = data.len();
let mut i = 0;
let mut string_stream = String::new(); // just to check the final value
while start_offset < end_offset {
let dst_size = std::cmp::min(end_offset - start_offset, b_size);
let r = s
.decompress(&mut decomp[..], dst_size as u64, start_offset as u64)
.unwrap();
string_stream.push_str(std::str::from_utf8(&decomp[..r]).unwrap());
assert_eq!(&data[i * b_size..i * b_size + dst_size], &decomp[..r]);
if r == 0 {
break;
}
i += 1;
start_offset += r;
}
print!("{:?}", string_stream);
}
#[test]