summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJosh Blum2012-11-04 15:42:20 -0800
committerJosh Blum2012-11-04 15:42:20 -0800
commitc6c54f66c714115e666ed067cc05aa07a759da5c (patch)
tree2e2a34f723e060dbfc5ac79faed24de0059bf2d8 /tests
parent0b6be66da90cf18130891682969a1d74c0ba1c87 (diff)
downloadsandhi-c6c54f66c714115e666ed067cc05aa07a759da5c.tar.gz
sandhi-c6c54f66c714115e666ed067cc05aa07a759da5c.tar.bz2
sandhi-c6c54f66c714115e666ed067cc05aa07a759da5c.zip
work on SWIG director block...
Diffstat (limited to 'tests')
-rw-r--r--tests/block_test.py35
1 files changed, 31 insertions, 4 deletions
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)