Skip to main content

build_mock_data

Function build_mock_data 

Source
pub fn build_mock_data(size: usize) -> Vec<u8> 
Expand description

Build a deterministic byte array for mock testing.

The payload is a xorshift64 keystream, which has no short period: distinct equal-length windows of the result differ. This matters because the usual end-to-end check is assert_eq!(downloaded, build_mock_data(size)), and a periodic payload makes that assertion blind to whole blocks written at the wrong offset or swapped between workers.

The result is prefix-stable: build_mock_data(n) is the first n bytes of build_mock_data(m) for every m >= n, so a range of the full array can be used as the expected value for a partial download.