def test_002_s_4(self): #Test streams_to_stream (using stream_to_streams). n = 4 src_len = n * 8 src_data = tuple(range(src_len)) expected_results = src_data src = gr.vector_source_s(src_data) op1 = gr.stream_to_streams_comp(gr.sizeof_short, n) op2 = gr.streams_to_stream_comp(gr.sizeof_short, n) dst = gr.vector_sink_s() self.tb.connect(src, op1) for i in range(n): self.tb.connect((op1, i), (op2, i)) self.tb.connect(op2, dst) self.tb.run() self.assertEqual(expected_results, dst.data())
def test_004_f_3(self): #Test vector_to_streams. n = 3 src_len = n * 8 src_data = tuple(range(src_len)) expected_results = src_data src = gr.vector_source_f(src_data) op1 = gr.stream_to_vector_comp(gr.sizeof_float, n) op2 = gr.vector_to_streams_comp(gr.sizeof_float, n) op3 = gr.streams_to_stream_comp(gr.sizeof_float, n) dst = gr.vector_sink_f() self.tb.connect(src, op1, op2) for i in range(n): self.tb.connect((op2, i), (op3, i)) self.tb.connect(op3, dst) self.tb.run() self.assertEqual(expected_results, dst.data())