def test_001(self): #src_data = [float(x) for x in range(16)] #expected_result = tuple(src_data) period = 9177 offset = 0 #src = gr.null_source(1) #head = gr.head(1, 10000000); length = 100000 src = sb.DataSource() head = gr.head_gnu(1, length) ins = gr.vector_insert_b([1], period, offset) dst = gr.vector_sink_b() self.tb.connect(src, head, ins, dst) self.tb.run() src_data = [0 for i in range(length)] src.push(src_data, EOS=True) result_data = dst.data() for i in range(10000): if (i % period == offset): self.assertEqual(1, result_data[i]) else: self.assertEqual(0, result_data[i])
def test_001(self): #src_data = [float(x) for x in range(16)] #expected_result = tuple(src_data) period = 9177; offset = 0; #src = gr.null_source(1) #head = gr.head(1, 10000000); length = 100000 src = sb.DataSource() head = gr.head_gnu(1, length) ins = gr.vector_insert_b([1], period, offset); dst = gr.vector_sink_b() self.tb.connect(src, head, ins, dst) self.tb.run() src_data = [0 for i in range(length)] src.push(src_data, EOS=True) result_data = dst.data() for i in range(10000): if(i%period == offset): self.assertEqual(1, result_data[i]) else: self.assertEqual(0, result_data[i])
def test_001(self): src_data = [float(x) for x in range(16)] expected_result = tuple(src_data) period = 9177; offset = 0; src = gr.null_source(1) head = gr.head(1, 10000000); ins = gr.vector_insert_b([1], period, offset); dst = gr.vector_sink_b() self.tb.connect(src, head, ins, dst) self.tb.run() result_data = dst.data() for i in range(10000): if(i%period == offset): self.assertEqual(1, result_data[i]) else: self.assertEqual(0, result_data[i])
def test_001(self): src_data = [float(x) for x in range(16)] expected_result = tuple(src_data) period = 9177 offset = 0 src = gr.null_source(1) head = gr.head(1, 10000000) ins = gr.vector_insert_b([1], period, offset) dst = gr.vector_sink_b() self.tb.connect(src, head, ins, dst) self.tb.run() result_data = dst.data() for i in range(10000): if (i % period == offset): self.assertEqual(1, result_data[i]) else: self.assertEqual(0, result_data[i])