more details about testing

This commit is contained in:
Weird Constructor 2022-07-19 06:04:30 +02:00
parent f8a0ebb447
commit ad4ea837b9
2 changed files with 28 additions and 1 deletions

View file

@ -376,9 +376,36 @@ When doing this, keep the following grid layout in mind:
\_____/
```
Defining the outputs of a cell is done like this:
```ignore
Cell::empty(ad).out(None, None, ad.out("sig"))
```
[crate::Cell::empty] takes a [NodeId] as first argument. The [crate::Cell]
structure then allows you to specify the output ports using the [crate::Cell::out]
function. The 3 arguments of that function are for the 3 edges of that hex tile:
```ignore
// TopRight BottomRight Bottom
Cell::empty(ad).out(None, None, ad.out("sig"))
```
[crate::Cell::input] works the same way, but the 3 arguments refer to the 3 input
edges of a hex tile:
```ignore
// Top TopLeft BottomLeft
Cell::empty(out).input(out.inp("ch1"), None, None)
```
The [NodeId] interface offers you functions to get the input parameter index from
a name like `out.inp("ch1")` or the output port index from a name: `ad.out("sig")`.
After you have setup everything for the test, you usually want to modify a paramter
and look at the values the graph returns.
```ignore
#[test]
fn check_node_ad_1() {

View file

@ -388,7 +388,7 @@ pub trait MatrixObserver {
/// Not called, when [MatrixObserver::update_all] tells you that
/// everything has changed.
fn update_prop(&self, key: &str);
/// Called when a new cell is monitored via [MatrixObserver::monitor_cell].
/// Called when a new cell is monitored via [Matrix::monitor_cell].
/// Not called, when [MatrixObserver::update_all] tells you that
/// everything has changed.
fn update_monitor(&self, cell: &Cell);