Select a random position of a byte within a segment. The position shall not fall on any headers (segment or commit), so as to reliably provoke checksum errors (and not any other errors).
(segment_len: usize)
| 100 | /// The position shall not fall on any headers (segment or commit), so as to |
| 101 | /// reliably provoke checksum errors (and not any other errors). |
| 102 | fn byte_position(segment_len: usize) -> impl Strategy<Value = usize> { |
| 103 | (segment::Header::LEN + commit::Header::LEN + 1..segment_len).prop_map(|mut byte_pos| { |
| 104 | for x in commit_boundaries() { |
| 105 | if byte_pos >= x && byte_pos < x + COMMIT_SIZE { |
| 106 | byte_pos = byte_pos.max(x + commit::Header::LEN + 1); |
| 107 | } |
| 108 | } |
| 109 | byte_pos |
| 110 | }) |
| 111 | } |
| 112 | |
| 113 | proptest! { |
| 114 | #[test] |
no test coverage detected
searching dependent graphs…