simplified the tests a bit

This commit is contained in:
Weird Constructor 2021-07-11 11:13:42 +02:00
parent 367d446dc1
commit 0bd97bf904

View file

@ -63,23 +63,15 @@ fn check_node_sfilter_lowpass() {
// Low Pass @ 22050Hz // Low Pass @ 22050Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 0, 22050.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 0, 22050.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 8000, 12000, 16000, (0, 16), (100, 16), (1000, 16), (4000, 16), (12000, 16),
22050,
], &fft[..]), vec![
(0, 16), (100, 20), (250, 12), (500, 16), (750, 16), (1000, 16),
(1500, 16), (2000, 16), (3000, 20), (4000, 16), (8000, 16), (12000, 16),
(16000, 16),
]); ]);
// Low Pass @ 0Hz // Low Pass @ 0Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 0, 0.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 0, 0.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
500, 1000, 1500, 2000, 8000, 12000, 16000, 20000 (0, 0), (100, 0), (1000, 0), (4000, 0), (12000, 0),
], &fft[..]), vec![
(0, 0), (500, 0), (1000, 0),
(1500, 0), (2000, 0), (8000, 0), (12000, 0), (16000, 0),
]); ]);
} }
@ -110,23 +102,15 @@ fn check_node_sfilter_lowpass_tpt() {
// Low Pass TPT @ 22050Hz // Low Pass TPT @ 22050Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 1, 22050.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 1, 22050.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 8000, 12000, 16000, (0, 16), (100, 16), (1000, 16), (4000, 16), (12000, 16),
22050,
], &fft[..]), vec![
(0, 16), (100, 20), (250, 12), (500, 16), (750, 16), (1000, 16),
(1500, 16), (2000, 16), (3000, 20), (4000, 16), (8000, 16), (12000, 16),
(16000, 16),
]); ]);
// Low Pass TPT @ 0Hz // Low Pass TPT @ 0Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 1, 0.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 1, 0.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
500, 1000, 1500, 2000, 8000, 12000, 16000, 20000 (0, 0), (100, 0), (1000, 0), (4000, 0), (12000, 0),
], &fft[..]), vec![
(0, 0), (500, 0), (1000, 0),
(1500, 0), (2000, 0), (8000, 0), (12000, 0), (16000, 0),
]); ]);
} }
@ -157,22 +141,15 @@ fn check_node_sfilter_highpass() {
// High Pass @ 22050Hz // High Pass @ 22050Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 2, 22050.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 2, 22050.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
500, 1000, 1500, 2000, 8000, 12000, 16000, 20000 (0, 0), (100, 0), (1000, 0), (4000, 8), (12000, 16),
], &fft[..]), vec![
(0, 0), (500, 0), (1000, 0),
(1500, 0), (2000, 4), (8000, 12), (12000, 12), (16000, 16),
]); ]);
// High Pass @ 0Hz // High Pass @ 0Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 2, 0.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 2, 0.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 8000, 12000 (0, 24), (100, 16), (1000, 16), (4000, 16), (12000, 16),
], &fft[..]), vec![
(0, 12), (10, 24), (50, 24), (100, 20), (250, 12),
(500, 16), (750, 20), (1000, 16), (1500, 16), (2000, 16),
(3000, 20), (8000, 16),
]); ]);
} }
@ -203,21 +180,14 @@ fn check_node_sfilter_highpass_tpt() {
// High Pass TPT @ 22050Hz // High Pass TPT @ 22050Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 3, 22050.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 3, 22050.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
500, 1000, 1500, 2000, 8000, 12000, 16000, 20000 (0, 0), (100, 0), (1000, 0), (4000, 0), (12000, 0),
], &fft[..]), vec![
(0, 0), (500, 0), (1000, 0),
(1500, 0), (2000, 0), (8000, 0), (12000, 0), (16000, 0),
]); ]);
// High Pass TPT @ 0Hz // High Pass TPT @ 0Hz
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 3, 0.0, 0.0); let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 3, 0.0, 0.0);
assert_eq!( assert_eq!(
avg_fft_freqs(4.0, &[ avg_fft_freqs(4.0, &[100, 1000, 4000, 12000, 22050], &fft[..]), vec![
10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 8000, 12000 (0, 24), (100, 16), (1000, 16), (4000, 16), (12000, 16),
], &fft[..]), vec![
(0, 12), (10, 24), (50, 24), (100, 20), (250, 12),
(500, 16), (750, 20), (1000, 16), (1500, 16), (2000, 16),
(3000, 20), (8000, 16),
]); ]);
} }