tests: loudness range at full segment length (16 kHz), xml streaming limit below one element

This commit is contained in:
aiongg
2026-11-24 21:29:34 +00:00
parent 79c5c887ae
commit 337974b224
2 changed files with 11 additions and 9 deletions
+9 -7
View File
@@ -686,10 +686,10 @@ mod tests {
// The range is level-relative, so a low rate gives the same reading for far fewer samples.
let sr = 16000.0;
let cases: [(&[(f64, f64)], f64); 4] = [
(&[(6.0, -20.0), (6.0, -30.0)], 10.0),
(&[(6.0, -20.0), (6.0, -15.0)], 5.0),
(&[(6.0, -40.0), (6.0, -20.0)], 20.0),
(&[(6.0, -50.0), (6.0, -35.0), (6.0, -20.0), (6.0, -35.0), (6.0, -50.0)], 15.0),
(&[(20.0, -20.0), (20.0, -30.0)], 10.0),
(&[(20.0, -20.0), (20.0, -15.0)], 5.0),
(&[(20.0, -40.0), (20.0, -20.0)], 20.0),
(&[(20.0, -50.0), (20.0, -35.0), (20.0, -20.0), (20.0, -35.0), (20.0, -50.0)], 15.0),
];
for (segs, expect) in cases {
let x = segments(1000.0, sr, segs);
@@ -713,9 +713,11 @@ mod tests {
assert_eq!(before, 0.0);
assert!((m.file_loudness_range() - s.loudness_range_lu).abs() < 1e-12);
assert_eq!(m.loudness_range(), before);
// A steady program keeps a file range near 0.
let y = segments(1000.0, sr, &[(6.0, -20.0)]);
assert!(measure(&[&y, &y], sr).loudness_range_lu < 1.0);
// A steady program keeps a file range near 0. It must be long beside the 1.5 s silence tail, so it runs at a
// low rate (the range is level-relative).
let low = 16000.0;
let y = segments(1000.0, low, &[(30.0, -20.0)]);
assert!(measure(&[&y, &y], low).loudness_range_lu < 1.0);
}
#[test]
+2 -2
View File
@@ -334,8 +334,8 @@ fn attributes_are_bounded_over_the_whole_tree() {
Ok::<(), Error>(())
});
assert_eq!((rows, root.map(|r| r.children.len())), ((ATTRS + 1) * ATTRS, Ok(0)));
let tight = Options::default().with_limits(Limits { max_attrs_total: ATTRS * ATTRS - 1, ..Limits::DEFAULT });
assert_eq!(tight.parse_streaming(doc.as_bytes(), &["c"], |_| Ok::<(), Error>(())), Err(Error::TooManyAttrsTotal(ATTRS * ATTRS - 1)));
let tight = Options::default().with_limits(Limits { max_attrs_total: ATTRS - 1, ..Limits::DEFAULT });
assert_eq!(tight.parse_streaming(doc.as_bytes(), &["c"], |_| Ok::<(), Error>(())), Err(Error::TooManyAttrsTotal(ATTRS - 1)));
}
/// An internal subset is found wherever it hides, and looking for it is linear in the input.