diff options
author | Johnathan Corgan | 2012-06-26 19:43:01 -0700 |
---|---|---|
committer | Johnathan Corgan | 2012-06-26 19:43:01 -0700 |
commit | 3de0c77ed91e417c0b54972a78ffbad62f4bbb87 (patch) | |
tree | 47e9e1742e6e877606b03704a26ce8cc3c67d14b /gr-blocks/python | |
parent | 0b7655a76e5c73b8f5a8310909cf038f12cbb869 (diff) | |
download | gnuradio-3de0c77ed91e417c0b54972a78ffbad62f4bbb87.tar.gz gnuradio-3de0c77ed91e417c0b54972a78ffbad62f4bbb87.tar.bz2 gnuradio-3de0c77ed91e417c0b54972a78ffbad62f4bbb87.zip |
blocks: added gr::blocks::float_to_int
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 a97203566..354cf9392 100755 --- a/gr-blocks/python/qa_type_conversions.py +++ b/gr-blocks/python/qa_type_conversions.py @@ -241,6 +241,26 @@ class test_type_conversions(gr_unittest.TestCase): self.tb.run() self.assertEqual(expected_data, dst.data()) + def test_int_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_i(src_data) + op = blocks_swig.int_to_float() + dst = gr.vector_sink_f() + self.tb.connect(src, op, dst) + self.tb.run() + self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) + + def test_int_to_float_scale(self): + src_data = (1, 2, 3, 4, 5) + expected_data = (0.2, 0.4, 0.6, 0.8, 1.0) + src = gr.vector_source_i(src_data) + op = blocks_swig.int_to_float(1, 5) + dst = gr.vector_sink_f() + self.tb.connect(src, op, dst) + self.tb.run() + self.assertFloatTuplesAlmostEqual(expected_data, dst.data()) + if __name__ == '__main__': gr_unittest.run(test_type_conversions, "test_type_conversions.xml") |