Exemplo n.º 1
0
    def test_201b(self):
        random.seed(0)
        src_data = []
        for i in xrange(100):
            src_data.append((random.randint(-2**31, 2**31 - 1)))
        src_data = tuple(src_data)
        expected_results = src_data
        src = gr.vector_source_i(tuple(src_data), False)
        op1 = blocks.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST)
        op2 = blocks.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST)
        dst = gr.vector_sink_i()

        self.tb.connect(src, op1, op2)
        self.tb.connect(op2, dst)
        self.tb.run()

        self.assertEqual(expected_results, dst.data())
    def test_201b(self):
        random.seed(0)
        src_data = []
        for i in xrange(100):
            src_data.append((random.randint(-2**31,2**31-1)))
        src_data = tuple(src_data)
        expected_results = src_data
        src = blocks.vector_source_i(tuple(src_data), False)
        op1 = blocks.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST)
        op2 = blocks.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST)
        dst = blocks.vector_sink_i()

        self.tb.connect(src, op1, op2)
        self.tb.connect(op2, dst)
        self.tb.run()

        self.assertEqual(expected_results, dst.data())