Beispiel #1
0
    def no_test_001_pad(self):
        s = "abcd"
        x = self.make_waveform(s)
        m = self.tobytes(x)
        msg = gr.message_from_string(m)
        Ntx = 2
        msg.set_arg1(Ntx)
        msg.set_arg2(len(x)/Ntx)

        pad = rf.pad()
        dst = gr.vector_sink_c()

        pad.inputQ().insert_tail(msg)
        pad.shutdown()  # schedules shutdown

        self.tb.connect (pad, dst)
        pad.set_npost(3)
        self.tb.run()
        result_data = dst.data ()
        
        block_size = pad.block_size()
        # prepad:(1+npre)*Ntx, postpad:(1+npost)*Ntx
        pre_pad = int(1+pad.npre())*Ntx*block_size
        post_pad = int(1+pad.npost())*Ntx*block_size
        pad_size = pre_pad + post_pad - len(x)%block_size
        self.assertComplexTuplesAlmostEqual (tuple(x), \
                   result_data[pre_pad:pre_pad+len(x)], len(x)+1 )
        self.assertEqual(len(result_data), len(x)+pad_size )
        self.assertEqual(phy.phyglobal.ctrlQ().count(), 1)