[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Tutorial 1 (C++) QA testing
From: |
Nathan West |
Subject: |
Re: [Discuss-gnuradio] Tutorial 1 (C++) QA testing |
Date: |
Mon, 11 Feb 2013 14:14:15 -0600 |
Hi,
I had the same issue a couple of weeks ago. I forget what the
differences were, but I remember the code that comes with GNU Radio
working, so check here:
http://gnuradio.org/redmine/projects/gnuradio/repository/revisions/master/show/gr-howto-write-a-block
I chalked up the differences to the tutorial being written for the
next release and didn't bother changing the wiki. Maybe it's worth
doing.
-Nathan
On Mon, Feb 11, 2013 at 1:59 PM, Brooke Hayden <address@hidden> wrote:
> Martin,
>
> I'm creating a C++ block using the first tutorial like you assumed. I have
> re-done this tutorial about 10 times now. I have the latest version of GNU
> Radio installed. The part in the tutorial you pointed out is most likely the
> problem, but I don't know how. My QA code is as follows:
> from gnuradio import gr, gr_unittest
> import howto_swig as howto
>
> class qa_square_ff (gr_unittest.TestCase):
>
> def setUp (self):
> self.tb = gr.top_block ()
>
> def tearDown (self):
> self.tb = None
>
> def test_001_square_ff (self):
> src_data = (-3, 4, -5.5, 2, 3)
> expected_result = (9, 16, 30.25, 4, 9)
> src = gr.vector_source_f(src_data)
> sqr = howto.square_ff()
> dst= gr.vector_sink_f()
> self.tb.connect(src, sqr)
> self.tb.connect(sqr, dst)
> self.tb.run()
> result_data = dst.data()
> self.assertFloatTuplesAlmostEqual(expexted_result, result_data, 6)
>
>
> if __name__ == '__main__':
> gr_unittest.run(qa_square_ff, "qa_square_ff.xml")
>
> One thing that is confusing in the tutorial is the following:
> So, we open python/qa_square_ff.py, which we edit to look like this:
>
> Check out this code, which we save as python/qa_howto.py (only the modified
> portion is shown):
>
> I'm not sure if I need to edit and save qa_square_ff.py, create qa_howto,py,
> or do both. If you, or someone else, has a gr-howto folder that works I
> would like to compare and see what is happening.
>
> Thanks
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>