From f1e3dc8aaec69196a54bedb777b0a567fdcfb7e8 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sun, 24 Jul 2022 13:03:02 +0200 Subject: [PATCH] added more information to the automated test section in dsp/mod.rs --- src/dsp/mod.rs | 18 ++++++++++++++++++ src/matrix.rs | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index f079960..c5b0975 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -355,6 +355,24 @@ value now instead of the next sample. ### Automated Testing of Your Node +First lets discuss shortly why automated tests are necessary. HexoDSP has an automated test +suite to check if any changes on the internal DSP helpers break something. Or if some +changes on some DSP node accidentally broke something. Or if a platform behaves weirdly. +Or even if upstream crates that are included broke or changed something essential. + +A few things you can test your DSP code for: + +- Is non 0.0 signal emitted? +- Is the signal inside the -1..1 or 0..1 range? +- Does the signal level change in expected ways if the input parameters are changed? +- Does the frequency spectrum peak at expected points in the FFT output? +- Does the frequency spectrum change to expected points in the FFT output when an input parameter +changed? + +Try to nail down the characteristics of your DSP node with a few tests as well as possible. + +For the FFT and other tests there are helper functions in `tests/common/mod.rs` + The start of your `tests/node_*.rs` file usually should look like this: ```ignore diff --git a/src/matrix.rs b/src/matrix.rs index 2e5925f..5519680 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -314,7 +314,7 @@ impl Cell { } /// Finds the first free input or output (one without an adjacent cell). If any free input/output - /// has an assigned input, that edge is returned. + /// has an assigned input, that edge is returned before any else. /// With `dir` you can specify input with `CellDir::T`, output with `CellDir::B` /// and any with `CellDir::C`. pub fn find_first_adjacent_free(