Skip to main content

Module testing

Module testing 

Source
Expand description

Test helpers shared by every crate: synthetic signals generated by code (never binary fixtures in git), a ready-made context, and comparison metrics.

Structs§

TempDir
A temp directory unique to the test, removed on drop.

Statics§

NO_PROGRESS
SIMPLE_IO

Functions§

add
Sum two buffers (shorter one zero-padded).
args
Build args for spec from key=value pairs (defaults applied).
chirp
Linear chirp from f0 to f1.
clicks
Click train: single-sample impulses every period seconds.
ctx
A context with no inputs, SimpleIo, and no progress output.
ctx_with
A context with a registry attached (for composite ops).
leak_registry
Leak a registry for tests that need 'static.
noise
Deterministic white noise in [-amp, amp].
read_wav
rms_db
RMS of a slice in dBFS.
rms_diff
RMS of the difference (over the common length).
run
Run a transform spec directly.
run_ctx
Run a transform spec and also return the context (to assert on metrics, notes, warnings).
si_sdr
Scale-invariant SDR of estimate against reference, in dB.
sine
stereo
tone_level
Magnitude (linear) of frequency f in x using a Goertzel filter, normalized so a full-scale sine reads 1.0.
write_wav
Write a float WAV for tests.