def test_float_to_int_scale(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (5, 10, 15, 20, 25) src = blocks.vector_source_f(src_data) op = blocks.float_to_int(1, 5) dst = blocks.vector_sink_i() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data())
def test_float_to_int_identity(self): src_data = (1.0, 2.0, 3.0, 4.0, 5.0) expected_data = (1, 2, 3, 4, 5) src = blocks.vector_source_f(src_data) op = blocks.float_to_int() dst = blocks.vector_sink_i() self.tb.connect(src, op, dst) self.tb.run() self.assertEqual(expected_data, dst.data())