()
| 317 | |
| 318 | #[test] |
| 319 | fn random_access_block() { |
| 320 | let data: Vec<u8> = (0..20000).map(|i| (i % 256) as u8).collect(); |
| 321 | let block_size = 4096; |
| 322 | let encoded = encode_with_block_size(&data, block_size); |
| 323 | |
| 324 | let block_count = Lz4Decoder::block_count(&encoded).unwrap(); |
| 325 | assert_eq!(block_count, data.len().div_ceil(block_size)); |
| 326 | |
| 327 | // Decompress each block individually and verify. |
| 328 | let mut reassembled = Vec::new(); |
| 329 | for i in 0..block_count { |
| 330 | let block = decode_block(&encoded, i).unwrap(); |
| 331 | reassembled.extend_from_slice(&block); |
| 332 | } |
| 333 | assert_eq!(reassembled, data); |
| 334 | } |
| 335 | |
| 336 | #[test] |
| 337 | fn out_of_range_block_index() { |
nothing calls this directly
no test coverage detected