From: Paul Brossier Date: Thu, 8 Oct 2009 00:13:38 +0000 (+0200) Subject: tests/python/src/temporal/: update a_weighting tests X-Git-Tag: bzr2git~176 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2672d67e4243a791b84fd6825d965ad38a9f651c;p=aubio.git tests/python/src/temporal/: update a_weighting tests --- diff --git a/tests/python/src/temporal/a_weighting.py b/tests/python/src/temporal/a_weighting.py index 9a7f78ba..1787e782 100644 --- a/tests/python/src/temporal/a_weighting.py +++ b/tests/python/src/temporal/a_weighting.py @@ -2,9 +2,9 @@ from localaubio import * samplerate = 44100 buf_size = 1024 -channels = 2 +channels = 1 -class adsgn_filter_unit(aubio_unit_template): +class a_weighting_unit (aubio_unit_template): def setUp(self): self.o = new_aubio_filter_a_weighting (samplerate, channels) @@ -46,6 +46,22 @@ class adsgn_filter_unit(aubio_unit_template): self.assertEqual(0., fvec_read_sample(vec,channel,index)) del_fvec(vec) + def test_simple(self): + buf_size = 32 + input = new_fvec (buf_size, 1) + output = new_fvec (buf_size, 1) + expected = array_from_text_file('src/temporal/a_weighting_test_simple.expected') + fvec_write_sample (input, 0.5, 0, 12) + for i in range(buf_size): + for c in range(channels): + self.assertEqual(expected[0][i], fvec_read_sample(input, c, i)) + f = new_aubio_filter_a_weighting (samplerate, channels) + aubio_filter_do_outplace (f, input, output) + del_aubio_filter (f) + for i in range(buf_size): + for c in range(channels): + self.assertCloseEnough(expected[1][i], fvec_read_sample(output, c, i)) + if __name__ == '__main__': import unittest unittest.main() diff --git a/tests/python/src/temporal/a_weighting_test_simple.expected b/tests/python/src/temporal/a_weighting_test_simple.expected new file mode 100644 index 00000000..6cd3ff3d --- /dev/null +++ b/tests/python/src/temporal/a_weighting_test_simple.expected @@ -0,0 +1,2 @@ + 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 5.00000000e-01 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.27870563e-01 2.58244342e-01 1.18719361e-01 -4.02623805e-02 -5.61812129e-02 -5.24739734e-02 -4.72329276e-02 -4.23394349e-02 -3.79219586e-02 -3.39473148e-02 -3.03724479e-02 -2.71574847e-02 -2.42664433e-02 -2.16669285e-02 -1.93297810e-02 -1.72287543e-02 -1.53402241e-02 -1.36429261e-02 -1.21177207e-02 -1.07473802e-02