From c6c54f66c714115e666ed067cc05aa07a759da5c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 4 Nov 2012 15:42:20 -0800 Subject: work on SWIG director block... --- tests/block_test.py | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/block_test.py b/tests/block_test.py index 020e615..d076f8e 100644 --- a/tests/block_test.py +++ b/tests/block_test.py @@ -3,19 +3,46 @@ import unittest import gras import numpy +class NullSource(gras.Block): + def __init__(self): + gras.Block.__init__(self, 'NullSource') + self.set_output_signature([numpy.int32]) + + def callback(self, x): + print x + +class NullSink(gras.Block): + def __init__(self): + gras.Block.__init__(self, 'NullSink') + self.set_input_signature([numpy.int32]) + + def callback(self, x): + print x + class BlockTest(unittest.TestCase): def test_make_block(self): - null_src = gras.Block('NullSource') - null_src.set_output_signature([numpy.int32]) + null_src = NullSource() + + null_sink = NullSink() + + #null_src.doit(321) - null_sink = gras.Block('NullSink') - null_sink.set_input_signature([numpy.int32]) + #return tb = gras.TopBlock() print 'connect...' tb.connect(null_src, null_sink) + print 'run' + + print 'py start' + tb.start() + import time; time.sleep(1) + print 'py stop' + tb.stop() + print 'py wait' + tb.wait() print 'ok' tb.disconnect(null_src, null_sink) -- cgit