summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 14:53:16 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 14:53:16 -0700
commitf9dd0a8a347e97e08bc7644f0467e58dcaf1ca66 (patch)
treeb83fb21adc638772bcec2099b81587c1042923c1 /gr-blocks/python
parenta6ed53ecd93cd6b1e0b4fdd627615e4e24697d04 (diff)
parent811bee8c54bdca5c53c2ccbc6ef6d1bbca55eaae (diff)
Merge branch 'master' into next
Diffstat (limited to 'gr-blocks/python')
-rw-r--r--gr-blocks/python/blocks/qa_block_gateway.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/gr-blocks/python/blocks/qa_block_gateway.py b/gr-blocks/python/blocks/qa_block_gateway.py
index 1e848cff04..6fdb0090ae 100644
--- a/gr-blocks/python/blocks/qa_block_gateway.py
+++ b/gr-blocks/python/blocks/qa_block_gateway.py
@@ -25,6 +25,19 @@ import pmt
from gnuradio import gr, gr_unittest, blocks
+
+class non_sync_block(gr.basic_block):
+ def __init__(self):
+ gr.basic_block.__init__(self,
+ name="non_sync_block",
+ in_sig=[numpy.float32],
+ out_sig=[numpy.float32, numpy.float32])
+ def general_work(self, input_items, output_items):
+ self.consume(0, len(input_items[0]))
+ self.produce(0,2)
+ self.produce(1,1)
+ return gr.WORK_CALLED_PRODUCE
+
class add_2_f32_1_f32(gr.sync_block):
def __init__(self):
gr.sync_block.__init__(
@@ -275,5 +288,17 @@ class test_block_gateway(gr_unittest.TestCase):
tb.run()
self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
+ def test_non_sync_block(self):
+ tb = gr.top_block ()
+ src = blocks.vector_source_f(range(1000000))
+ sinks = [blocks.vector_sink_f(), blocks.vector_sink_f()]
+ dut = non_sync_block()
+ tb.connect(src, dut)
+ tb.connect((dut,0), sinks[0])
+ tb.connect((dut,1), sinks[1])
+ tb.run ()
+ self.assertEqual(len(sinks[0].data()), 2*len(sinks[1].data()))
+
+
if __name__ == '__main__':
gr_unittest.run(test_block_gateway, "test_block_gateway.xml")