added more information to the automated test section in dsp/mod.rs

This commit is contained in:
Weird Constructor 2022-07-24 13:03:02 +02:00
parent 51453bae16
commit f1e3dc8aae
2 changed files with 19 additions and 1 deletions

View file

@ -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

View file

@ -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(