diff options
author | Paul Wicks <pwicks86@gmail.com> | 2018-05-29 14:12:59 -0700 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-07-15 15:59:57 +0200 |
commit | 5c63d71d44f299cda7ca5f8a3617a1d5b67c7544 (patch) | |
tree | eb86b294874e0ea2d1a8263c76d0f4178dbd632a /gr-blocks/python | |
parent | dea45c14abb5c4a76a507376198f954d01a74f9c (diff) |
Implement fix for gnuradio bug https://github.com/gnuradio/gnuradio/issues/959
Diffstat (limited to 'gr-blocks/python')
-rwxr-xr-x | gr-blocks/python/blocks/qa_skiphead.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gr-blocks/python/blocks/qa_skiphead.py b/gr-blocks/python/blocks/qa_skiphead.py index a9b6df40cf..098e7b1e94 100755 --- a/gr-blocks/python/blocks/qa_skiphead.py +++ b/gr-blocks/python/blocks/qa_skiphead.py @@ -21,6 +21,19 @@ # from gnuradio import gr, gr_unittest, blocks +import pmt +import numpy + + +def make_tag(key, value, offset, srcid=None): + tag = gr.tag_t() + tag.key = pmt.string_to_symbol(key) + tag.value = pmt.to_pmt(value) + tag.offset = offset + if srcid is not None: + tag.srcid = pmt.to_pmt(srcid) + return tag + class test_skiphead(gr_unittest.TestCase): @@ -97,6 +110,19 @@ class test_skiphead(gr_unittest.TestCase): dst_data = dst1.data() self.assertEqual(expected_result, dst_data) + def test_skip_tags(self): + skip_cnt = 25 + expected_result = tuple(self.src_data[skip_cnt:]) + + src_tags = tuple([make_tag('foo', 'bar', 50, 'src')]) + src1 = blocks.vector_source_i(self.src_data, tags=src_tags) + op = blocks.skiphead(gr.sizeof_int, skip_cnt) + dst1 = blocks.vector_sink_i() + self.tb.connect(src1, op, dst1) + self.tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + self.assertEqual(dst1.tags()[0].offset, 25, "Tag offset is incorrect") if __name__ == '__main__': gr_unittest.run(test_skiphead, "test_skiphead.xml") |