fixed broken test case for blocklang

This commit is contained in:
Weird Constructor 2022-08-01 05:31:07 +02:00
parent c0dad77577
commit 648c94cf79
2 changed files with 27 additions and 39 deletions

View file

@ -92,11 +92,17 @@ impl DspNode for Code {
outputs: &mut [ProcBuf],
ctx_vals: LedPhaseVals,
) {
use crate::dsp::{at, denorm, inp, out};
use crate::dsp::{at, denorm, inp, out, out_idx};
// let clock = inp::TSeq::clock(inputs);
// let trig = inp::TSeq::trig(inputs);
// let cmode = at::TSeq::cmode(atoms);
let out = out::Code::sig(outputs);
let out_i = out_idx::Code::sig1();
let (sig, sig1) = outputs.split_at_mut(out_i);
let (sig1, sig2) = sig1.split_at_mut(1);
let sig = &mut sig[0];
let sig1 = &mut sig1[0];
let sig2 = &mut sig2[0];
#[cfg(feature = "synfx-dsp-jit")]
{
@ -110,8 +116,9 @@ impl DspNode for Code {
for frame in 0..ctx.nframes() {
let (s1, s2, ret) = backend.process(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
println!("OUT: {}", ret);
out.write(frame, ret);
sig.write(frame, ret);
sig1.write(frame, s1);
sig2.write(frame, s2);
}
ctx_vals[0].set(0.0);

View file

@ -30,31 +30,28 @@ fn check_blocklang_1() {
{
let mut block_fun = block_fun.lock().expect("matrix lock");
block_fun.instanciate_at(0, 0, 1, "value", Some("0.3".to_string()));
// block_fun.instanciate_at(0, 1, 1, "set", Some("&sig1".to_string()));
block_fun.instanciate_at(0, 1, 1, "set", Some("&sig1".to_string()));
}
matrix.check_block_function(0).expect("no compile error");
let res = run_for_ms(&mut node_exec, 25.0);
println!("RES: {:?}", res.1);
assert_decimated_feq!(
res.0,
50,
vec![
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
]
);
assert_decimated_feq!(res.0, 50, vec![0.3; 10]);
}
// XXX: Test case with 3 outputs, where the first output writes a value used
// by the computation after the first but before the third output.
/*
0.3 ->3 set a
=> -> + set b
get a
=> -> - set a
get b
get a +
get b
*/
#[test]
fn check_blocklang_2() {
let (mut matrix, mut node_exec) = setup();
@ -95,21 +92,5 @@ fn check_blocklang_2() {
matrix.check_block_function(0).expect("no compile error");
let res = run_for_ms(&mut node_exec, 25.0);
assert_decimated_feq!(
res.0,
50,
vec![
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
]
);
assert_decimated_feq!(res.0, 50, vec![0.2; 100]);
}