Expand description
Assertion helpers built on top of crate::DriverResult.
Run a crate::PluginDriver (typically via the crate::driver!
macro), then pass the captured result into these helpers for
standard claims:
- Whole-run audio shape: nonzero / silence / no-NaNs / peak below threshold.
- Time-windowed audio shape: silence-after, nonzero-after, silence-between, nonzero-between (for tail-decay / gate-between-notes assertions).
- Meter readings at end-of-run.
- Output events emitted by the plugin.
ⓘ
use std::time::Duration;
use truce_test::{assertions, driver, InputSource};
#[test]
fn long_tail_goes_silent() {
let result = driver!(MyReverb)
.duration(Duration::from_secs(3))
.input(InputSource::Constant(0.5))
.run();
assertions::assert_nonzero(&result);
assertions::assert_silence_after(&result, Duration::from_millis(2_500));
}Functions§
- assert_
meter_ above - Assert the meter identified by
idread abovethresholdat the end of the run. - assert_
meter_ below - Assert the meter identified by
idread belowthresholdat the end of the run. - assert_
no_ nans - Assert no sample is NaN or infinite. If this fails, the DSP went divergent.
- assert_
nonzero - Assert that at least one sample anywhere in the output is above the audible threshold.
- assert_
nonzero_ after - Assert at least one sample after
tis above the audible threshold. - assert_
nonzero_ between - Assert non-zero audio somewhere in
[start, end). - assert_
output_ event_ count - Assert exactly
noutput events were emitted by the plugin across the run. Requires.capture_output_events(true)on the driver. - assert_
peak_ below - Assert no sample exceeds
thresholdin absolute value. Typical use:assert_peak_below(&result, 1.0)to catch clipping. - assert_
silence - Assert every sample in the output is below the audible threshold.
- assert_
silence_ after - Assert every sample after
tis below the audible threshold. Use for reverb / delay tail decay tests. - assert_
silence_ between - Assert silence across
[start, end). More precise thanassert_silence_afterwhen both endpoints matter.