diff options
Diffstat (limited to 'gr-digital/python/digital/qa_crc32_bb.py')
-rw-r--r-- | gr-digital/python/digital/qa_crc32_bb.py | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/gr-digital/python/digital/qa_crc32_bb.py b/gr-digital/python/digital/qa_crc32_bb.py index 53ea6f3deb..7ffccb6355 100644 --- a/gr-digital/python/digital/qa_crc32_bb.py +++ b/gr-digital/python/digital/qa_crc32_bb.py @@ -194,6 +194,35 @@ class qa_crc32_bb (gr_unittest.TestCase): # Check that the packets after crc_check are the same as input. self.assertEqual(data, sink.data()[0]) + def test_002_crc_equal_unpacked (self): + """ Test unpacked operation with packed operation + """ + data = (0, 1, 2, 3, 4, 5, 6, 7, 8) + src = blocks.vector_source_b(data) + unpack1 = blocks.repack_bits_bb(8, 1, self.tsb_key, False, gr.GR_LSB_FIRST) + unpack2 = blocks.repack_bits_bb(8, 1, self.tsb_key, False, gr.GR_LSB_FIRST) + crc_unpacked = digital.crc32_bb(False, self.tsb_key, False) + crc_packed = digital.crc32_bb(False, self.tsb_key, True) + sink1 = blocks.tsb_vector_sink_b(tsb_key=self.tsb_key) + sink2 = blocks.tsb_vector_sink_b(tsb_key=self.tsb_key) + + self.tb.connect( + src, + blocks.stream_to_tagged_stream(gr.sizeof_char, 1, len(data), self.tsb_key), + crc_packed, + unpack1, + sink1 + ) + self.tb.connect( + src, + blocks.stream_to_tagged_stream(gr.sizeof_char, 1, len(data), self.tsb_key), + unpack2, + crc_unpacked, + sink2 + ) + self.tb.run() + self.assertEqual(sink1.data(), sink2.data()) + def test_008_crc_correct_lentag (self): tag_name = "length" pack_len = 8 @@ -264,13 +293,19 @@ class qa_crc32_bb (gr_unittest.TestCase): def test_0010_tag_propagation (self): """ Make sure tags on the CRC aren't lost. """ # Data with precalculated CRC - data = ( - 0, 1, 2, 3, 4, 5, 6, 7, 8, - 0, 1, 0, 0, 0, 0, 0, 0, - 1, 1, 0, 0, 0, 0, 1, 0, - 1, 0, 0, 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 0, 1 - ) # 2, 67, 225, 188 + data = (0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 0, 0, 0, 0, + 0, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 1, 1, 0, 0, 0, 0, 1, 0, + 1, 0, 0, 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, 1, 0, 1) testtag = gr.tag_t() testtag.offset = len(data)-1 testtag.key = pmt.string_to_symbol('tag1') |