[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/06: blocks: annotate QA and add tests fo
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/06: blocks: annotate QA and add tests for vector_sourc_sink setters |
Date: |
Sun, 27 Mar 2016 13:57:57 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 5297e411f206b9c3c45ee022b8f123994b5e7c6e
Author: Nathan West <address@hidden>
Date: Thu Mar 24 15:41:17 2016 -0400
blocks: annotate QA and add tests for vector_sourc_sink setters
---
gr-blocks/python/blocks/qa_vector_sink_source.py | 36 ++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/gr-blocks/python/blocks/qa_vector_sink_source.py
b/gr-blocks/python/blocks/qa_vector_sink_source.py
index 5dab701..026713f 100755
--- a/gr-blocks/python/blocks/qa_vector_sink_source.py
+++ b/gr-blocks/python/blocks/qa_vector_sink_source.py
@@ -46,6 +46,7 @@ class test_vector_sink_source(gr_unittest.TestCase):
self.tb = None
def test_001(self):
+ # Test that sink has data set in source for the simplest case
src_data = [float(x) for x in range(16)]
expected_result = tuple(src_data)
@@ -58,6 +59,7 @@ class test_vector_sink_source(gr_unittest.TestCase):
self.assertEqual(expected_result, result_data)
def test_002(self):
+ # Test vectors (the gnuradio vector I/O type)
src_data = [float(x) for x in range(16)]
expected_result = tuple(src_data)
@@ -70,11 +72,14 @@ class test_vector_sink_source(gr_unittest.TestCase):
self.assertEqual(expected_result, result_data)
def test_003(self):
+ # Test that we can only make vectors (the I/O type) if the input
+ # vector has sufficient size
src_data = [float(x) for x in range(16)]
expected_result = tuple(src_data)
self.assertRaises(RuntimeError, lambda :
blocks.vector_source_f(src_data, False, 3))
def test_004(self):
+ # Test sending and receiving tagged streams
src_data = [float(x) for x in range(16)]
expected_result = tuple(src_data)
src_tags = tuple([make_tag('key', 'val', 0, 'src')])
@@ -92,6 +97,7 @@ class test_vector_sink_source(gr_unittest.TestCase):
self.assertTrue(compare_tags(expected_tags[0], result_tags[0]))
def test_005(self):
+ # Test that repeat works (with tagged streams)
length = 16
src_data = [float(x) for x in range(length)]
expected_result = tuple(src_data + src_data)
@@ -112,6 +118,36 @@ class test_vector_sink_source(gr_unittest.TestCase):
self.assertTrue(compare_tags(expected_tags[0], result_tags[0]))
self.assertTrue(compare_tags(expected_tags[1], result_tags[1]))
+ def test_006(self):
+ # Test set_data
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = blocks.vector_source_f((3,1,4))
+ dst = blocks.vector_sink_f()
+ src.set_data(src_data)
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_007(self):
+ # Test set_repeat
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = blocks.vector_source_f(src_data, True)
+ dst = blocks.vector_sink_f()
+ src.set_repeat(False)
+
+ self.tb.connect(src, dst)
+ # will timeout if set_repeat does not work
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+
if __name__ == '__main__':
gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml")
- [Commit-gnuradio] [gnuradio] branch master updated (64a702e -> d44dae8), git, 2016/03/27
- [Commit-gnuradio] [gnuradio] 06/06: Merge remote-tracking branch 'nwest/vector-repeat', git, 2016/03/27
- [Commit-gnuradio] [gnuradio] 02/06: blocks: add a setter for repeat flag on vector source, git, 2016/03/27
- [Commit-gnuradio] [gnuradio] 05/06: Merge remote-tracking branch 'noc0lour/constellation_add_new_types_grc', git, 2016/03/27
- [Commit-gnuradio] [gnuradio] 04/06: Merge branch 'maint', git, 2016/03/27
- [Commit-gnuradio] [gnuradio] 01/06: gr-digital: add more constellation types to grc constellation block, git, 2016/03/27
- [Commit-gnuradio] [gnuradio] 03/06: blocks: annotate QA and add tests for vector_sourc_sink setters,
git <=