diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2012-11-29 19:46:46 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2012-11-29 19:46:46 -0800 |
commit | 1907e670b5c3658a7c76f3f00ba239c95ab18210 (patch) | |
tree | 9a03542588bdc82c4e9d347f624a000b4413147f /gnuradio-core/src/python/gnuradio/gr | |
parent | 16bed38aef25df384dca56143f298e081eac1972 (diff) | |
parent | 4478cb86a5dc9fccf66c2cdd5806419b70c3837e (diff) |
Merge branch 'master' into next
Diffstat (limited to 'gnuradio-core/src/python/gnuradio/gr')
-rwxr-xr-x | gnuradio-core/src/python/gnuradio/gr/qa_pdu.py | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py new file mode 100755 index 0000000000..64eb80a8fd --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# +# Copyright 2012 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from gruel import pmt +import time; +class test_pdu(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_000(self): + # Just run some data through and make sure it doesn't puke. + src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + + src = gr.pdu_to_tagged_stream(gr.BYTE); + snk3 = gr.tagged_stream_to_pdu(gr.BYTE); + snk2 = gr.vector_sink_b(); + snk = gr.tag_debug(1, "test"); + + dbg = gr.message_debug(); + + self.tb.connect(src, snk) + self.tb.connect(src, snk2) + self.tb.connect(src, snk3) + + self.tb.msg_connect(snk3, "pdus", dbg, "print"); + self.tb.start() + + # make our reference and message pmts + port = pmt.pmt_intern("pdus"); + msg = pmt.pmt_cons( pmt.PMT_NIL, pmt.pmt_make_u8vector(16, 0xFF) ); + + print "printing port & msg" + pmt.pmt_print(port); + pmt.pmt_print(msg); + + # post the message + src.to_basic_block()._post( port, msg ); + + time.sleep(1); + self.tb.stop(); + self.tb.wait(); + + print snk2.data(); + +if __name__ == '__main__': + gr_unittest.run(test_pdu, "test_pdu.xml") |