summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorJohnathan Corgan2012-06-28 09:27:59 -0700
committerJohnathan Corgan2012-06-28 09:27:59 -0700
commit9482c8986d0a7bd4772a78972880a9e574531052 (patch)
treed605f2a7ea9b823463c7fe8bb1952ab8f0ebb5c0 /gr-blocks/python
parentc128e5aee66838c849ffc2ac45217ff1efab42e8 (diff)
downloadgnuradio-9482c8986d0a7bd4772a78972880a9e574531052.tar.gz
gnuradio-9482c8986d0a7bd4772a78972880a9e574531052.tar.bz2
gnuradio-9482c8986d0a7bd4772a78972880a9e574531052.zip
blocks: added gr::blocks::short_to_float
Diffstat (limited to 'gr-blocks/python')
-rwxr-xr-xgr-blocks/python/qa_type_conversions.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/gr-blocks/python/qa_type_conversions.py b/gr-blocks/python/qa_type_conversions.py
index ddb876b3d..a77fe8af5 100755
--- a/gr-blocks/python/qa_type_conversions.py
+++ b/gr-blocks/python/qa_type_conversions.py
@@ -281,6 +281,26 @@ class test_type_conversions(gr_unittest.TestCase):
self.tb.run()
self.assertEqual(expected_data, dst.data())
+ def test_short_to_float_identity(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src = gr.vector_source_s(src_data)
+ op = blocks_swig.short_to_float()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_short_to_float_scale(self):
+ src_data = (5, 10, 15, 20, 25)
+ expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src = gr.vector_source_s(src_data)
+ op = blocks_swig.short_to_float(1, 5)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
if __name__ == '__main__':
gr_unittest.run(test_type_conversions, "test_type_conversions.xml")