Ejemplo n.º 1
0
 def test_float_to_short_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_short(1, 5)
     dst = blocks.vector_sink_s()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertEqual(expected_data, dst.data())
Ejemplo n.º 2
0
 def test_float_to_short_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_short(1, 5)
     dst = blocks.vector_sink_s()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertEqual(expected_data, dst.data())
Ejemplo n.º 3
0
 def test_float_to_short_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_short()
     dst = blocks.vector_sink_s()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertEqual(expected_data, dst.data())
Ejemplo n.º 4
0
 def test_float_to_short_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_short()
     dst = blocks.vector_sink_s()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertEqual(expected_data, dst.data())