[domistream] Tests: first compile, clippy clean

Temporaries borrowed past their statement (control, media), clippy's
is_multiple_of, needless index loop and type complexity. input.rs: the
MOUSE_MOVE_ABS builder dropped the y field; the PROTOCOL.md cross-check would
have caught it at runtime.
This commit is contained in:
2026-11-25 13:08:24 +01:00
parent 8d0bebfbc3
commit 2740d3dd45
7 changed files with 19 additions and 12 deletions
+3 -3
View File
@@ -204,7 +204,7 @@ fn random_losses_over_many_blocks() {
fn sequence_wraps() {
// Blocks from 0xFFF0 through 0x000F: data sequence 0xFFFF -> 0, base sequence wrap, rikeyid + seq wrap.
let h = host(true, audio_test_matrix());
let (expect, want, dg) = scenario(&h, 20, 0xFFF0, 8, true, |b, i| (b + i) % 5 == 0);
let (expect, want, dg) = scenario(&h, 20, 0xFFF0, 8, true, |b, i| (b + i).is_multiple_of(5));
assert!(expect.iter().any(|e| e.sequence == 0xFFFF) && expect.iter().any(|e| e.sequence == 0));
check(&expect, &want, &run(config(true, AudioFec::ParityMatrix(h.matrix)), &dg));
}
@@ -212,7 +212,7 @@ fn sequence_wraps() {
#[test]
fn duplicates_are_dropped() {
let h = host(true, audio_test_matrix());
let (expect, want, dg) = scenario(&h, 21, 0, 10, true, |b, i| (b * 7 + i) % 6 == 0);
let (expect, want, dg) = scenario(&h, 21, 0, 10, true, |b, i| (b * 7 + i).is_multiple_of(6));
let doubled: Vec<Vec<u8>> = dg.iter().flat_map(|g| [g.clone(), g.clone()]).collect();
let r = run(config(true, AudioFec::ParityMatrix(h.matrix)), &doubled);
check(&expect, &want, &r);
@@ -223,7 +223,7 @@ fn duplicates_are_dropped() {
fn reordered_within_and_across_blocks() {
let h = host(true, audio_test_matrix());
for seed in 30..36u64 {
let (expect, want, mut dg) = scenario(&h, seed, 0, 12, true, |b, i| (b + i + seed as usize) % 7 == 0);
let (expect, want, mut dg) = scenario(&h, seed, 0, 12, true, |b, i| (b + i + seed as usize).is_multiple_of(7));
let mut rng = SeqRng::new(seed);
let mut i = 6; // the first block stays first, so the stream has a known start
while i < dg.len() {