'QA_test for multiple outputs on gnuradio with different types

I have written a gnuradio block with 1 input and 2 outputs. Now I'm writing the qa_test in python. the code below is to test a block with 1 input and 1 output. How can I adapt the code to test two outputs of different types (complex and float)

src_data = (0, 1, -2, 5.5, -0.5)
expected_result = (0, 2, -4, 11, -1)
src = blocks.vector_source_f (src_data)
mult = multiply_py_ff (2)
snk = blocks.vector_sink_f ()
self.tb.connect (src, mult)
self.tb.connect (mult, snk)
self.tb.run ()
result_data = snk.data ()
self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6)


Solution 1:[1]

How can I adapt the code to test two outputs of different types (complex and float)

Try creating two sink blocks - one vector_sink_f and one vector_sink_c and then connecting the corresponding outputs of the block under test to them using the connect function by specifying src_port and dst_port. See https://www.gnuradio.org/doc/doxygen/classgr_1_1hier__block2.html#a915d1d5b4b6d8a9db4211d9a4507c955

It should be something like this

tb.connect((block,0), (snk1,0))
tb.connect((block,1), (snk2,0))

An example from pfb_channelizer tests

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vasil Velichkov