Пример #1
0
    def test_000 (self):
        if enable_vw_testing:
            return

        # this function will check that the encoder produces correct packet lengths
        payload_sizes = [28, 60, 92, 124, 156, 188, 220]
        codeword_sizes = [47, 79, 111, 159, 191, 223 ,255]

        enc = nuts.ngham_encoder(self.tsb_key, scramble=False, pad_for_usrp=False)
        snk = blocks.vector_sink_b()
        self.tb.connect(enc, snk)
        port = pmt.intern("in")

        self.tb.start()
        for i in range(7):
            snk.reset()
            src_data = [x for x in range(payload_sizes[i])]
            src_vec = pmt.init_u8vector(len(src_data), src_data)
            msg = pmt.cons( pmt.PMT_NIL, src_vec )
            enc.to_basic_block()._post(port, msg)

            time.sleep(0.1)

            res_data = snk.data()
            print len(src_data), "=>", len(res_data), "(", codeword_sizes[i] + 11,")"
            self.assertEqual(len(res_data), codeword_sizes[i]+11)

        self.tb.stop()
        self.tb.wait()
Пример #2
0
    def test_000 (self):
        if enable_vw_testing:
            return

        print "test_000"
        payload_sizes = [28, 60, 92, 124, 156, 188, 220]
        codeword_sizes = [47, 79, 111, 159, 191, 223 ,255]

        enc = nuts.ngham_encoder(self.tsb_key)
        dec = nuts.ngham_decoder(verbose=True)
        dbg = blocks.message_debug()
        self.tb.connect(enc,dec)
        self.tb.msg_connect(dec, "out", dbg, "store")
        port_in = pmt.intern("in")

        print "starting up"
        self.tb.start()
        i = 0
        #for i in range(len(payload_sizes)*0 + 1):
        src_data = [x for x in range(payload_sizes[i])]
        src_vec = pmt.init_u8vector(len(src_data), src_data)
        msg = pmt.cons(pmt.PMT_NIL, src_vec)
        print "posting msg"
        enc.to_basic_block()._post(port_in, msg)
        #while dbg.num_messages() < 1:
            #print "waiting..."
        time.sleep(1)
        self.tb.stop()
        self.tb.wait()
        result_msg = dbg.get_message(0)
        vector = pmt.u8vector_elements(pmt.cdr(result_msg))
        print metadata
        print vector
Пример #3
0
    def test_000(self):
        if enable_vw_testing:
            return

        # this function will check that the encoder produces correct packet lengths
        payload_sizes = [28, 60, 92, 124, 156, 188, 220]
        codeword_sizes = [47, 79, 111, 159, 191, 223, 255]

        enc = nuts.ngham_encoder(self.tsb_key,
                                 scramble=False,
                                 pad_for_usrp=False)
        snk = blocks.vector_sink_b()
        self.tb.connect(enc, snk)
        port = pmt.intern("in")

        self.tb.start()
        for i in range(7):
            snk.reset()
            src_data = [x for x in range(payload_sizes[i])]
            src_vec = pmt.init_u8vector(len(src_data), src_data)
            msg = pmt.cons(pmt.PMT_NIL, src_vec)
            enc.to_basic_block()._post(port, msg)

            time.sleep(0.1)

            res_data = snk.data()
            print len(src_data), "=>", len(
                res_data), "(", codeword_sizes[i] + 11, ")"
            self.assertEqual(len(res_data), codeword_sizes[i] + 11)

        self.tb.stop()
        self.tb.wait()