diff options
author | Tom Rondeau | 2011-10-23 17:22:25 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-10-23 17:22:25 -0400 |
commit | 529e942f6456d45c957fe8248e7621c956c5f2f1 (patch) | |
tree | 88048361abc7d986d933f9a76769571def8e1463 /gnuradio-core/src/python | |
parent | 7112e308a6b0b84387c73460c4c8d1e8ff9f3b5a (diff) | |
download | gnuradio-529e942f6456d45c957fe8248e7621c956c5f2f1.tar.gz gnuradio-529e942f6456d45c957fe8248e7621c956c5f2f1.tar.bz2 gnuradio-529e942f6456d45c957fe8248e7621c956c5f2f1.zip |
core: added a test for float_to_int overflow clipping.
Diffstat (limited to 'gnuradio-core/src/python')
-rw-r--r-- | gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py index 6eaf2e8f0..2f54d0329 100644 --- a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py @@ -44,6 +44,22 @@ class test_float_to_int (gr_unittest.TestCase): self.assertEqual(expected_result, result_data) + def test_002(self): + + src_data = ( 2147483647, 2147483648, 2200000000, + -2147483648, -2147483649, -2200000000) + expected_result = [2147483647, 2147483647, 2147483647, + -2147483648, -2147483648, -2147483648] + src = gr.vector_source_f(src_data) + op = gr.float_to_int() + dst = gr.vector_sink_i() + + self.tb.connect(src, op, dst) + self.tb.run() + result_data = list(dst.data()) + + self.assertEqual(expected_result, result_data) + if __name__ == '__main__': gr_unittest.run(test_float_to_int, "test_float_to_int.xml") |