cosca 0.8.0

Unified cross-platform subprocess management: spawning, stdio, process trees, stable identity, and elevation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! The byte stream tests send through a pipe, so that a wrong offset, a reordered or repeated
//! chunk, or a stale buffer tail shows in an exact comparison, which a run of one repeated byte
//! cannot.
//!
//! Also mounted by `#[path]` into `tests/common`, so it names nothing of its crate.

/// Byte `i` of the stream every test sends: a period coprime to every power of two, so a chunk that
/// lost or repeated bytes cannot sum to the right total by accident.
pub fn pattern(i: usize) -> u8 {
    (i % 251) as u8
}

/// The first `len` bytes of the stream.
pub fn pattern_bytes(len: usize) -> Vec<u8> {
    (0..len).map(pattern).collect()
}