From: Paul Brossier Date: Fri, 15 Apr 2011 08:19:53 +0000 (+0000) Subject: timeside/tests/testdecoding.py: added simple decoding tests X-Git-Tag: 0.3.2~45 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d98969e27994ab0ed06de4597b8af504fee6d115;p=timeside.git timeside/tests/testdecoding.py: added simple decoding tests --- diff --git a/timeside/tests/testdecoding.py b/timeside/tests/testdecoding.py new file mode 100644 index 0000000..69c2c8a --- /dev/null +++ b/timeside/tests/testdecoding.py @@ -0,0 +1,52 @@ +from timeside.core import * +from timeside.decoder import * +from timeside.api import * + +from timeside.component import * +from timeside.tests import TestCase, TestRunner +import unittest + +import os.path + +__all__ = ['TestDecoding'] + +class TestLowLevel(TestCase): + "Test the low level streaming features" + + def setUp(self): + pass + + def testWav(self): + "Test wav decoding" + self.source = os.path.join (os.path.dirname(__file__), "samples/sweep.wav") + + def testFlac(self): + "Test flac decoding" + self.source = os.path.join (os.path.dirname(__file__), "samples/sweep.flac") + + def testOgg(self): + "Test ogg decoding" + self.source = os.path.join (os.path.dirname(__file__), "samples/sweep.ogg") + + def testMp3(self): + "Test mp3 decoding" + self.source = os.path.join (os.path.dirname(__file__), "samples/sweep.mp3") + + def tearDown(self): + decoder = FileDecoder(self.source) + decoder.setup() + + totalframes = 0. + + while True: + frames, eod = decoder.process() + totalframes += frames.shape[0] + if eod: break + + # FIXME compute actual number of frames from file + self.assertEquals(totalframes, 352801) + +if __name__ == '__main__': + unittest.main(testRunner=TestRunner()) + +