source: tests/python/cvec.py @ 79287252

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

move python/tests to tests/python, examples/tests to tests/src, add .bzrignore

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[203c551]1import unittest
2
3from aubio.aubiowrapper import *
4
5buf_size = 2048
6channels = 3
7
8class cvec_test_case(unittest.TestCase):
9
10  def setUp(self):
11    self.vector = new_cvec(buf_size, channels)
12
13  def tearDown(self):
14    del_cvec(self.vector)
15
16  def test_cvec(self):
17    """ create and delete cvec """
18    pass
19
20  def test_cvec_read_norm(self):
21    """ check new cvec norm elements are set to 0. """
22    for index in range(buf_size/2+1):
23      for channel in range(channels):
24        self.assertEqual(cvec_read_norm(self.vector,channel,index),0.)
25
26  def test_cvec_read_phas(self):
27    """ check new cvec phas elements are set to 0. """
28    for index in range(buf_size/2+1):
29      for channel in range(channels):
30        self.assertEqual(cvec_read_phas(self.vector,channel,index),0.)
31
32  def test_cvec_write_norm(self):
33    """ check new cvec norm elements are set with cvec_write_norm """
34    for index in range(buf_size/2+1):
35      for channel in range(channels):
36        cvec_write_norm(self.vector,1.,channel,index)
37    for index in range(buf_size/2+1):
38      for channel in range(channels):
39        self.assertEqual(cvec_read_norm(self.vector,channel,index),1.)
40
41  def test_cvec_write_phas(self):
42    """ check new cvec phas elements are set with cvec_write_phas """
43    for index in range(buf_size/2+1):
44      for channel in range(channels):
45        cvec_write_phas(self.vector,1.,channel,index)
46    for index in range(buf_size/2+1):
47      for channel in range(channels):
48        self.assertEqual(cvec_read_phas(self.vector,channel,index),1.)
49
50if __name__ == '__main__':
51  unittest.main()
Note: See TracBrowser for help on using the repository browser.