コード例 #1
0
ファイル: qa_packed_to_unpacked.py プロジェクト: jinjoh/SDR
    def test_201b(self):
        """
        test int version
        """
        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 = gr.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST)
        op2 = gr.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST)
        self.tb.connect(src, op1, op2)
        dst = gr.vector_sink_i()
        self.tb.connect(op2, dst)

        self.tb.run()
        self.assertEqual(expected_results, dst.data())
コード例 #2
0
    def test_201b(self):
        """
        test int version
        """
        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 = gr.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST)
        op2 = gr.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST)
        self.tb.connect(src, op1, op2)
        dst = gr.vector_sink_i()
        self.tb.connect(op2, dst)

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