From: Paul Brossier Date: Sat, 3 Nov 2007 16:38:45 +0000 (+0100) Subject: add test fft back and forth X-Git-Tag: bzr2git~482 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2d8880d5099451bcd23f551f7327df74067567fb;p=aubio.git add test fft back and forth --- diff --git a/tests/python/fft.py b/tests/python/fft.py index 540a6c2a..d377e6fb 100644 --- a/tests/python/fft.py +++ b/tests/python/fft.py @@ -14,8 +14,8 @@ class aubio_mfft_test_case(unittest.TestCase): def tearDown(self): del_aubio_mfft(self.o) - def test_aubio_mfft(self): - """ create and delete mfft """ + def test_create(self): + """ test creation and deletion of fft object """ pass def test_aubio_mfft_do_zeroes(self): @@ -102,4 +102,20 @@ class aubio_mfft_test_case(unittest.TestCase): del fftgrain del output + def test_aubio_mfft_do_back_and_forth(self): + """ test aubio_mfft_rdo on a constant """ + input = new_fvec(buf_size, channels) + output = new_fvec(buf_size, channels) + fftgrain = new_cvec(buf_size, channels) + for index in range(buf_size/2+1): + for channel in range(channels): + fvec_write_sample(input, 0.67, channel, index) + aubio_mfft_do(self.o, input, fftgrain) + aubio_mfft_rdo(self.o, fftgrain, output) + for index in range(buf_size/2+1): + for channel in range(channels): + self.assertAlmostEqual(fvec_read_sample(output, channel, index), 0.67, 7) + del fftgrain + del output + if __name__ == '__main__': unittest.main()