summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_audioop.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-20 09:49:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-20 09:49:04 (GMT)
commitd5fd8df22f4c94714e9fd93db80c3cc3995c44e3 (patch)
tree0616737d00a0276729021094b200ee744e8b50b1 /Lib/test/test_audioop.py
parentce82eb2e13d909bb399b40822bc1aae777acb814 (diff)
downloadcpython-d5fd8df22f4c94714e9fd93db80c3cc3995c44e3.zip
cpython-d5fd8df22f4c94714e9fd93db80c3cc3995c44e3.tar.gz
cpython-d5fd8df22f4c94714e9fd93db80c3cc3995c44e3.tar.bz2
Add yet some 24-bit tests.
Diffstat (limited to 'Lib/test/test_audioop.py')
-rw-r--r--Lib/test/test_audioop.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/Lib/test/test_audioop.py b/Lib/test/test_audioop.py
index b6b53ba..f222811 100644
--- a/Lib/test/test_audioop.py
+++ b/Lib/test/test_audioop.py
@@ -87,6 +87,7 @@ class TestAudioop(unittest.TestCase):
self.assertEqual(audioop.avgpp(packs[w](9, 10, 5, 5, 0, 1), w), 10)
self.assertEqual(audioop.avgpp(datas[1], 1), 196)
self.assertEqual(audioop.avgpp(datas[2], 2), 50534)
+ self.assertEqual(audioop.avgpp(datas[3], 3), 12937096)
self.assertEqual(audioop.avgpp(datas[4], 4), 3311897002)
def test_rms(self):
@@ -100,6 +101,7 @@ class TestAudioop(unittest.TestCase):
-minvalues[w], delta=1)
self.assertEqual(audioop.rms(datas[1], 1), 77)
self.assertEqual(audioop.rms(datas[2], 2), 20001)
+ self.assertEqual(audioop.rms(datas[3], 3), 5120523)
self.assertEqual(audioop.rms(datas[4], 4), 1310854152)
def test_cross(self):
@@ -227,10 +229,9 @@ class TestAudioop(unittest.TestCase):
def test_lin2adpcm(self):
self.assertEqual(audioop.lin2adpcm(datas[1], 1, None),
(b'\x07\x7f\x7f', (-221, 39)))
- self.assertEqual(audioop.lin2adpcm(datas[2], 2, None),
- (b'\x07\x7f\x7f', (31, 39)))
- self.assertEqual(audioop.lin2adpcm(datas[4], 4, None),
- (b'\x07\x7f\x7f', (31, 39)))
+ for w in 2, 3, 4:
+ self.assertEqual(audioop.lin2adpcm(datas[w], w, None),
+ (b'\x07\x7f\x7f', (31, 39)))
# Very cursory test
for w in 1, 2, 3, 4:
@@ -240,10 +241,9 @@ class TestAudioop(unittest.TestCase):
def test_lin2alaw(self):
self.assertEqual(audioop.lin2alaw(datas[1], 1),
b'\xd5\x87\xa4\x24\xaa\x2a\x5a')
- self.assertEqual(audioop.lin2alaw(datas[2], 2),
- b'\xd5\x87\xa4\x24\xaa\x2a\x55')
- self.assertEqual(audioop.lin2alaw(datas[4], 4),
- b'\xd5\x87\xa4\x24\xaa\x2a\x55')
+ for w in 2, 3, 4:
+ self.assertEqual(audioop.lin2alaw(datas[w], w),
+ b'\xd5\x87\xa4\x24\xaa\x2a\x55')
def test_alaw2lin(self):
encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\
@@ -262,10 +262,9 @@ class TestAudioop(unittest.TestCase):
def test_lin2ulaw(self):
self.assertEqual(audioop.lin2ulaw(datas[1], 1),
b'\xff\xad\x8e\x0e\x80\x00\x67')
- self.assertEqual(audioop.lin2ulaw(datas[2], 2),
- b'\xff\xad\x8e\x0e\x80\x00\x7e')
- self.assertEqual(audioop.lin2ulaw(datas[4], 4),
- b'\xff\xad\x8e\x0e\x80\x00\x7e')
+ for w in 2, 3, 4:
+ self.assertEqual(audioop.lin2ulaw(datas[w], w),
+ b'\xff\xad\x8e\x0e\x80\x00\x7e')
def test_ulaw2lin(self):
encoded = b'\x00\x0e\x28\x3f\x57\x6a\x76\x7c\x7e\x7f'\