Test util function to create a temp file of size calculated from `num_regions` and `extra` bytes after that. E.g. `create_tmp_file(5, 20)` will create a temp file with 5 regions of BUFFER_SIZE and 20 more bytes in addition to it.
(num_regions: u8, extra: u16)
| 858 | /// E.g. `create_tmp_file(5, 20)` will create a temp file with 5 |
| 859 | /// regions of BUFFER_SIZE and 20 more bytes in addition to it. |
| 860 | fn create_tmp_file(num_regions: u8, extra: u16) -> io::Result<File> { |
| 861 | let mut file = tempfile()?; |
| 862 | file.write_all(&vec![ |
| 863 | 0_u8; |
| 864 | (BUFFER_SIZE * num_regions as usize) + extra as usize |
| 865 | ])?; |
| 866 | Ok(file) |
| 867 | } |
| 868 | |
| 869 | /// Test util function to create a temp file of a specific size |
| 870 | fn create_tmp_file_of_size(size: u16) -> io::Result<File> { |
no outgoing calls