コード例 #1
0
    def test_003(self):
        """
        Test EDTopBlock with the input (1, 1, 1, 1, 1, 1, 1, 1).
        """
        arr = (1, 1, 1, 1, 1, 1, 1, 1)
        expected_out = 8

        ed = EnergySSArch(fft_size=len(arr),
                          mavg_size=8,
                          algorithm=EnergyDecision(expected_out - 1)
                          )

        src = blocks.vector_source_c(data=arr, vlen=1)
        sink = blocks.probe_signal_f()

        device = RadioDevice()
        device.add_arch(source=src, arch=ed, sink=sink, uhd_device=None, name='ed')

        self.tb.add_radio(device, 'ed')
        self.tb.run()

        ##self.assertEqual(1 , device.sink.level()) # didn't work
        self.assertEqual(1, device.output()[0])