def test_copy(self): src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) expected_result = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) src = blocks.vector_source_b(src_data) op = blocks.copy(gr.sizeof_char) dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() dst_data = dst.data() self.assertEqual(expected_result, dst_data)
def test_030_nested_input(self): tb = gr.top_block() src = blocks.vector_source_b([ 1, ]) hb1 = gr.hier_block2("hb1", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(0, 0, 0)) hb2 = gr.hier_block2("hb2", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(0, 0, 0)) dst = blocks.vector_sink_b() tb.connect(src, hb1) hb1.connect(hb1, hb2) hb2.connect(hb2, blocks.copy(gr.sizeof_char), dst) tb.run() self.assertEquals(dst.data(), (1, ))
def test_030_nested_input(self): tb = gr.top_block() src = blocks.vector_source_b([1,]) hb1 = gr.hier_block2("hb1", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(0, 0, 0)) hb2 = gr.hier_block2("hb2", gr.io_signature(1, 1, gr.sizeof_char), gr.io_signature(0, 0, 0)) dst = blocks.vector_sink_b() tb.connect(src, hb1) hb1.connect(hb1, hb2) hb2.connect(hb2, blocks.copy(gr.sizeof_char), dst) tb.run() self.assertEquals(dst.data(), (1,))