Exemplo n.º 1
0
 def test_multiple_frames_001_t(self):
     frame_length = 4
     nb_of_z_frames = 2
     repetions = 100
     data_source = [1] * frame_length * repetions
     exp = [0] * (nb_of_z_frames * frame_length) + [1] * frame_length + [
         0
     ] * (nb_of_z_frames * frame_length)
     expected_data = []
     for i in range(repetions):
         expected_data = expected_data + exp
     data_src = blocks.vector_source_c(data_source, False)
     burst_shaper = ofdmAux.add_zeros_cc(nb_of_z_frames, frame_length)
     destination = blocks.vector_sink_c(1)
     self.tb.connect(data_src, burst_shaper)
     self.tb.connect(burst_shaper, destination)
     self.tb.run()
     dest_data = destination.data()
     self.assertEqual(len(dest_data),
                      repetions * frame_length * (2 * nb_of_z_frames + 1))
     # check data
     self.assertEqual(len(dest_data), len(expected_data))
     for recv_sample in range(len(dest_data)):
         self.assertEqual(expected_data[recv_sample],
                          dest_data[recv_sample])
Exemplo n.º 2
0
 def test_other_numbers_001_t(self):
     frame_length    = 15
     nb_of_z_frames  = 23
     data_source     = [1]*frame_length
     expected_data   = [0]*(nb_of_z_frames*frame_length) + [1]*frame_length + [0]*(nb_of_z_frames*frame_length)
     data_src        = blocks.vector_source_c(data_source, False)
     burst_shaper    = ofdmAux.add_zeros_cc(nb_of_z_frames,frame_length)
     destination     = blocks.vector_sink_c(1)
     self.tb.connect(data_src,burst_shaper)
     self.tb.connect(burst_shaper, destination)
     self.tb.run()
     dest_data = destination.data()
     self.assertEqual(len(dest_data), frame_length*(2*nb_of_z_frames+1))
     # check data
     self.assertEqual(len(dest_data), len(expected_data))
     for recv_sample in range(len(dest_data)):
             self.assertEqual(expected_data[recv_sample], dest_data[recv_sample])