summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 15:01:46 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 15:01:46 -0700
commit41e1a272e6794feb4d58fed9807d409bd1930c01 (patch)
treed254831fe61361eb52d1b6176873ca547ef32786 /gr-blocks/python
parente776f1e7196a7543de240b88005b26a02a4c87af (diff)
parentf9dd0a8a347e97e08bc7644f0467e58dcaf1ca66 (diff)
Merge branch 'next' into python3
Conflicts: grc/core/Param.py grc/gui/Application.py grc/gui/NotebookPage.py
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 d4794179bd..23036eec57 100644
--- a/gr-blocks/python/blocks/qa_block_gateway.py
+++ b/gr-blocks/python/blocks/qa_block_gateway.py
@@ -27,6 +27,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__(
@@ -277,5 +290,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")