From 5f0edaff226025943f03df92e24ba1c1f1171810 Mon Sep 17 00:00:00 2001 From: Swarnava Ghosh Date: Tue, 29 Aug 2023 12:13:16 -0400 Subject: [PATCH] added defualts, fixed test fail --- .../gnuradio/UTAT_HERON/tagged_stream_tail_tagger.h | 2 +- .../bindings/tagged_stream_tail_tagger_python.cc | 6 +++--- python/UTAT_HERON/qa_tagged_stream_tail_tagger.py | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/gnuradio/UTAT_HERON/tagged_stream_tail_tagger.h b/include/gnuradio/UTAT_HERON/tagged_stream_tail_tagger.h index 478e874..3029f0f 100644 --- a/include/gnuradio/UTAT_HERON/tagged_stream_tail_tagger.h +++ b/include/gnuradio/UTAT_HERON/tagged_stream_tail_tagger.h @@ -33,7 +33,7 @@ class UTAT_HERON_API tagged_stream_tail_tagger : virtual public gr::block * class. UTAT_HERON::tagged_stream_tail_tagger::make is the public interface for * creating new instances. */ - static sptr make(const std::string& length_tag_key, const std::string& tail_tag_key); + static sptr make(const std::string& length_tag_key = "packet_len", const std::string& tail_tag_key = "trailer"); }; } // namespace UTAT_HERON diff --git a/python/UTAT_HERON/bindings/tagged_stream_tail_tagger_python.cc b/python/UTAT_HERON/bindings/tagged_stream_tail_tagger_python.cc index 994a17e..7ce0928 100644 --- a/python/UTAT_HERON/bindings/tagged_stream_tail_tagger_python.cc +++ b/python/UTAT_HERON/bindings/tagged_stream_tail_tagger_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(tagged_stream_tail_tagger.h) */ -/* BINDTOOL_HEADER_FILE_HASH(a544000c6ef5c511ea9a95c65ec60c94) */ +/* BINDTOOL_HEADER_FILE_HASH(1a18d8b8942924c053aa80b1485453d3) */ /***********************************************************************************/ #include @@ -40,8 +40,8 @@ void bind_tagged_stream_tail_tagger(py::module& m) m, "tagged_stream_tail_tagger", D(tagged_stream_tail_tagger)) .def(py::init(&tagged_stream_tail_tagger::make), - py::arg("length_tag_key"), - py::arg("tail_tag_key"), + py::arg("length_tag_key") = "packet_len", + py::arg("tail_tag_key") = "trailer", D(tagged_stream_tail_tagger, make)) diff --git a/python/UTAT_HERON/qa_tagged_stream_tail_tagger.py b/python/UTAT_HERON/qa_tagged_stream_tail_tagger.py index 301dbaf..14d5f13 100755 --- a/python/UTAT_HERON/qa_tagged_stream_tail_tagger.py +++ b/python/UTAT_HERON/qa_tagged_stream_tail_tagger.py @@ -26,25 +26,26 @@ def tearDown(self): self.tb = None def test_instance(self): - instance = tagged_stream_tail_tagger('packet_len') + instance = tagged_stream_tail_tagger('packet_len', 'trailer') def test_001_basic(self): input = (complex(1,1), complex(2,2), complex(3,3)) expected_output = [complex(1,1), complex(2,2), complex(3,3), complex()] - source = blocks.vector_source_c(input, False, 1, []) + source = blocks.vector_source_c(input, True, 1, []) tag_packet = blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, 1, 3, 'packet_len') - instance = tagged_stream_tail_tagger('packet_len') + instance = tagged_stream_tail_tagger('packet_len', 'trailer') + head = blocks.head(gr.sizeof_gr_complex, 4) sink = blocks.vector_sink_c(1, 4) self.tb.connect(source, tag_packet) self.tb.connect(tag_packet, instance) - self.tb.connect(instance, sink) + self.tb.connect(instance, head) + self.tb.connect(head, sink) self.tb.run() output = sink.data() - self.assertEqual(output[:4], expected_output[:4]) - # check data + self.assertEqual(output, expected_output) if __name__ == '__main__':