source: python/test/fvec.py @ 14aebce

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 14aebce was 203c551, checked in by Paul Brossier <piem@piem.org>, 17 years ago

added simple tests for fvec and cvec

  • Property mode set to 100644
File size: 960 bytes
Line 
1import unittest
2
3from aubio.aubiowrapper import *
4
5buf_size = 2048
6channels = 3
7
8class fvec_test_case(unittest.TestCase):
9
10  def setUp(self):
11    self.vector = new_fvec(buf_size, channels)
12
13  def tearDown(self):
14    del_fvec(self.vector)
15
16  def test_fvec(self):
17    """ create and delete fvec """
18    pass
19
20  def test_fvec_read_sample(self):
21    """ check new fvec elements are set to 0. """
22    for index in range(buf_size):
23      for channel in range(channels):
24        self.assertEqual(fvec_read_sample(self.vector,channel,index),0.)
25
26  def test_fvec_write_sample(self):
27    """ check new fvec elements are set with fvec_write_sample """
28    for index in range(buf_size):
29      for channel in range(channels):
30        fvec_write_sample(self.vector,1.,channel,index)
31    for index in range(buf_size):
32      for channel in range(channels):
33        self.assertEqual(fvec_read_sample(self.vector,channel,index),1.)
34
35if __name__ == '__main__':
36  unittest.main()
Note: See TracBrowser for help on using the repository browser.