Exemple #1
0
    def test_001(self):
        src_data = [1,2,3,4]
        expected_result = [256, 512, 768, 1024];

        src = blocks.vector_source_s(src_data)
        op = blocks.endian_swap(2)
        dst = blocks.vector_sink_s()

        self.tb.connect(src, op, dst)
        self.tb.run()
        result_data = list(dst.data())

        self.assertEqual(expected_result, result_data)
Exemple #2
0
    def test_002(self):

        src_data = [1,2,3,4]
        expected_result = [16777216, 33554432, 50331648, 67108864];

        src = blocks.vector_source_i(src_data)
        op = blocks.endian_swap(4)
        dst = blocks.vector_sink_i()

        self.tb.connect(src, op, dst)
        self.tb.run()
        result_data = list(dst.data())
    
        self.assertEqual(expected_result, result_data)