def test_short_to_float_scale(self): src_data = (5, 10, 15, 20, 25) expected_data = (1.0, 2.0, 3.0, 4.0, 5.0) src = blocks.vector_source_s(src_data) op = blocks.short_to_float(1, 5) dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data())
def test_short_to_float_identity(self): src_data = (1, 2, 3, 4, 5) expected_data = (1.0, 2.0, 3.0, 4.0, 5.0) src = blocks.vector_source_s(src_data) op = blocks.short_to_float() dst = blocks.vector_sink_f() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data())