summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/python
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/python')
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/Makefile.am5
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_wavefile.py66
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wavbin0 -> 52 bytes
3 files changed, 69 insertions, 2 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/Makefile.am b/gnuradio-core/src/python/gnuradio/gr/Makefile.am
index 7406d062d..5aaef2540 100644
--- a/gnuradio-core/src/python/gnuradio/gr/Makefile.am
+++ b/gnuradio-core/src/python/gnuradio/gr/Makefile.am
@@ -21,8 +21,9 @@
include $(top_srcdir)/Makefile.common
-EXTRA_DIST = run_tests.in
-
+EXTRA_DIST = \
+ run_tests.in \
+ test_16bit_1chunk.wav
TESTS = \
run_tests
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
new file mode 100755
index 000000000..5f46ea87b
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# Copyright 2008 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+
+import os
+from os.path import getsize
+
+class qa_wavefile(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_checkwavread (self):
+ wf = gr.wavfile_source("./test_16bit_1chunk.wav")
+ self.assertEqual(wf.sample_rate(), 8000)
+
+ def test_002_checkwavcopy (self):
+ infile = "test_16bit_1chunk.wav"
+ outfile = "test_out.wav"
+
+ wf_in = gr.wavfile_source(infile)
+ wf_out = gr.wavfile_sink(outfile,
+ wf_in.channels(),
+ wf_in.sample_rate(),
+ wf_in.bits_per_sample())
+ self.tb.connect(wf_in, wf_out)
+ self.tb.run()
+ wf_out.close()
+
+ self.assertEqual(getsize(infile), getsize(outfile))
+
+ in_f = file(infile, 'rb')
+ out_f = file(outfile, 'rb')
+
+ in_data = in_f.read(getsize(infile))
+ out_data = out_f.read(getsize(outfile))
+ os.remove(outfile)
+
+ self.assertEqual(in_data, out_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.main ()
diff --git a/gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wav b/gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wav
new file mode 100644
index 000000000..0fe12a7a1
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wav
Binary files differ