source: python/test/cvec.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: 1.6 KB
Line 
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.