source: tests/python/src/cvec.py @ 4e3723d

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 4e3723d 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: 1.6 KB
Line 
1from template import aubio_unit_template
2from localaubio import *
3
4buf_size = 2048
5channels = 3
6
7class cvec_unit(aubio_unit_template):
8
9  def setUp(self):
10    self.vector = new_cvec(buf_size, channels)
11
12  def tearDown(self):
13    del_cvec(self.vector)
14
15  def test_cvec(self):
16    """ create and delete cvec """
17    pass
18
19  def test_cvec_read_norm(self):
20    """ check new cvec norm elements are set to 0. """
21    for index in range(buf_size/2+1):
22      for channel in range(channels):
23        self.assertEqual(cvec_read_norm(self.vector,channel,index),0.)
24
25  def test_cvec_read_phas(self):
26    """ check new cvec phas elements are set to 0. """
27    for index in range(buf_size/2+1):
28      for channel in range(channels):
29        self.assertEqual(cvec_read_phas(self.vector,channel,index),0.)
30
31  def test_cvec_write_norm(self):
32    """ check new cvec norm elements are set with cvec_write_norm """
33    for index in range(buf_size/2+1):
34      for channel in range(channels):
35        cvec_write_norm(self.vector,1.,channel,index)
36    for index in range(buf_size/2+1):
37      for channel in range(channels):
38        self.assertEqual(cvec_read_norm(self.vector,channel,index),1.)
39
40  def test_cvec_write_phas(self):
41    """ check new cvec phas elements are set with cvec_write_phas """
42    for index in range(buf_size/2+1):
43      for channel in range(channels):
44        cvec_write_phas(self.vector,1.,channel,index)
45    for index in range(buf_size/2+1):
46      for channel in range(channels):
47        self.assertEqual(cvec_read_phas(self.vector,channel,index),1.)
48
49if __name__ == '__main__':
50  unittest.main()
Note: See TracBrowser for help on using the repository browser.