summaryrefslogtreecommitdiff
path: root/docs/howto-write-a-block/qa_howto_1.py
diff options
context:
space:
mode:
authorJohnathan Corgan2009-11-12 10:50:03 -0800
committerJohnathan Corgan2009-11-12 10:50:03 -0800
commitb3858bfe3b559722bd788e7c32159d4963422c01 (patch)
tree570dabd2bf93584af5ecab429089783eb24903b8 /docs/howto-write-a-block/qa_howto_1.py
parent5d80acab66a91a6c7bc476761f857d5e876e8bcc (diff)
downloadgnuradio-b3858bfe3b559722bd788e7c32159d4963422c01.tar.gz
gnuradio-b3858bfe3b559722bd788e7c32159d4963422c01.tar.bz2
gnuradio-b3858bfe3b559722bd788e7c32159d4963422c01.zip
howto: move limbo'd docs into toplevel doc dir for preservation
Diffstat (limited to 'docs/howto-write-a-block/qa_howto_1.py')
-rwxr-xr-xdocs/howto-write-a-block/qa_howto_1.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/howto-write-a-block/qa_howto_1.py b/docs/howto-write-a-block/qa_howto_1.py
new file mode 100755
index 000000000..3173110f8
--- /dev/null
+++ b/docs/howto-write-a-block/qa_howto_1.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gr_unittest
+import howto
+
+class qa_howto (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 (expected_result, result_data, 6)
+
+if __name__ == '__main__':
+ gr_unittest.main ()