source: tests/python/src/fvec.py @ 615ac7d

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

move tests/python/demo to tests/, add localaubio.py module helpers

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