def puncture_bb(self, P, seq_len=100): """ Tests that the puncture block correctly drops bytes from a sequence Note: This method itself is not a unit test method. """ src_data = [random.randint(0,1) for _ in range(seq_len)] expected_result = tuple([i[0] for i in zip(src_data, range(len(src_data))) if P[i[1] % len(P)] != 0]) src = gr.vector_source_b(src_data) puncture = dvb_swig.puncture_bb(P) dst = gr.vector_sink_b() self.tb.connect(src, puncture, dst) self.tb.run() self.assertEqual(expected_result, dst.data())
def depuncture_puncture(self, P, seq_len=100): """ Tests that the depuncture block is matched to the puncture block Note: This method itself is not a unit test method. """ src_data = [random.randint(0,1) for _ in range(seq_len)] expected_result = tuple(src_data) src = gr.vector_source_f(src_data) depuncture = dvb_swig.depuncture_ff(P) f2c = gr.float_to_uchar() puncture = dvb_swig.puncture_bb(P) dst = gr.vector_sink_b() self.tb.connect(src, depuncture, f2c, puncture, dst) self.tb.run() self.assertEqual(expected_result, dst.data())