diff options
author | Johnathan Corgan | 2012-06-26 06:47:26 -0700 |
---|---|---|
committer | Johnathan Corgan | 2012-06-26 06:47:26 -0700 |
commit | 86f15ba3488cde9eededa2af5af8dcadc01e9e47 (patch) | |
tree | c093a0e85025f833ca769fde053e85aa941bd739 /gr-blocks/python | |
parent | 31c61c16e2073f0c3f54a8d0523d8c4f10ca5dd2 (diff) | |
download | gnuradio-86f15ba3488cde9eededa2af5af8dcadc01e9e47.tar.gz gnuradio-86f15ba3488cde9eededa2af5af8dcadc01e9e47.tar.bz2 gnuradio-86f15ba3488cde9eededa2af5af8dcadc01e9e47.zip |
blocks: added gr::blocks::float_to_short
Diffstat (limited to 'gr-blocks/python')
-rwxr-xr-x | gr-blocks/python/qa_type_conversions.py | 20 |
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 fba38ab00..d41fe690d 100755 --- a/gr-blocks/python/qa_type_conversions.py +++ b/gr-blocks/python/qa_type_conversions.py @@ -211,6 +211,26 @@ class test_type_conversions(gr_unittest.TestCase): self.tb.run() self.assertEqual(expected_data, dst.data()) + def test_float_to_short_identity(self): + src_data = (1.0, 2.0, 3.0, 4.0, 5.0) + expected_data = (1, 2, 3, 4, 5) + src = gr.vector_source_f(src_data) + op = blocks_swig.float_to_short() + dst = gr.vector_sink_s() + self.tb.connect(src, op, dst) + self.tb.run() + self.assertEqual(expected_data, dst.data()) + + def test_float_to_short_scale(self): + src_data = (1.0, 2.0, 3.0, 4.0, 5.0) + expected_data = (5, 10, 15, 20, 25) + src = gr.vector_source_f(src_data) + op = blocks_swig.float_to_short(1, 5) + dst = gr.vector_sink_s() + 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") |