# Tutorial 1 (C++) QA testing

**URL:** <https://www.ruby-forum.com/t/tutorial-1-c-qa-testing/229788>\
**Category:** GNU Radio\
**Created:** [February 11, 2013, 9:00pm UTC](https://www.ruby-forum.com/t/tutorial-1-c-qa-testing/229788 "2013-02-11T21:00:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brooke\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/77aa72/32.png) [@Brooke\_H](https://www.ruby-forum.com/u/Brooke_H)\
**Post date:** [February 11, 2013, 9:00pm UTC](https://www.ruby-forum.com/t/tutorial-1-c-qa-testing/229788/1 "2013-02-11T21:00:34Z")

</div>

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, 

```

1. 

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

---

<div class="post-metadata">

**Author:** ![Brooke\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/77aa72/32.png) [@Brooke\_H](https://www.ruby-forum.com/u/Brooke_H)\
**Post date:** [February 11, 2013, 9:41pm UTC](https://www.ruby-forum.com/t/tutorial-1-c-qa-testing/229788/2 "2013-02-11T21:41:31Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Brooke\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/77aa72/32.png) [@Brooke\_H](https://www.ruby-forum.com/u/Brooke_H)\
**Post date:** [February 12, 2013, 9:50am UTC](https://www.ruby-forum.com/t/tutorial-1-c-qa-testing/229788/3 "2013-02-12T09:50:37Z")

</div>

On Mon, Feb 11, 2013 at 02:14:15PM -0600, Nathan W. wrote:

> 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](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.

Hi guys,

hope your stuff is working now.  
There might be problems in the tutorial (I actually did the tutorial on  
another screen while I was writing it, so it should be 99% correct, 1%  
remains to be checked :).

The actual output of gr\_modtool as shown in the wiki page might not be  
exactly what you see. There are several versions of modtool out there;  
we’re planning to merge it into main GNU Radio soon. Then, there will be  
one official version to go with.

This concurs with what Nathan said: When 3.6.4 is the official release,  
the tutorial, modtool and GNU Radio will fit much better.

However, right now, it should still be useful, assuming the user can  
adapt to slightly different outputs–with you guys, I’m not worried in  
that respect.

MB

> > from gnuradio import gr, gr\_unittest  
> > def test\_001\_square\_ff (self):
> > 
> > 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.

–  
Karlsruhe Institute of Technology (KIT)  
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.  
Research Associate

Kaiserstraße 12  
Building 05.01  
76131 Karlsruhe

Phone: +49 721 608-43790  
Fax: +49 721 608-46071  
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and  
National Laboratory of the Helmholtz Association
