Exemplo n.º 1
0
    def test_003_float(self):
        tb = gr.top_block()

        data = [0.5, 0, 0, -0.1, -30.0, -10]
        exp = [1, 0, 0, -1, -1, -1]
        vlen = 1
        src = blocks.vector_source_f(data, False, vlen)
        sign = misc.signum_xx(misc.FLOAT, vlen)
        snk = blocks.vector_sink_f(vlen)
        tb.connect(src, sign, snk)
        tb.run()
        res = snk.data()
        self.assertTupleEqual(res, tuple(exp))
Exemplo n.º 2
0
    def test_002_int(self):
        tb = gr.top_block()

        data = [5, 0, 0, -1, -3, -10]
        exp = [1, 0, 0, -1, -1, -1]
        vlen = 1
        src = blocks.vector_source_i(data, False, vlen)
        sign = misc.signum_xx(misc.INT, vlen)
        snk = blocks.vector_sink_i(vlen)
        tb.connect(src, sign, snk)
        tb.run()
        res = snk.data()
        self.assertTupleEqual(res, tuple(exp))