Exemplo n.º 1
0
 def test_int_to_float_scale(self):
     src_data = (1, 2, 3, 4, 5)
     expected_data = (0.2, 0.4, 0.6, 0.8, 1.0)
     src = blocks.vector_source_i(src_data)
     op = blocks.int_to_float(1, 5)
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Exemplo n.º 2
0
 def test_int_to_float_scale(self):
     src_data = (1, 2, 3, 4, 5)
     expected_data = (0.2, 0.4, 0.6, 0.8, 1.0)
     src = blocks.vector_source_i(src_data)
     op = blocks.int_to_float(1, 5)
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Exemplo n.º 3
0
 def test_int_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_i(src_data)
     op = blocks.int_to_float()
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Exemplo n.º 4
0
 def test_int_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_i(src_data)
     op = blocks.int_to_float()
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())