summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2021-06-12 22:31:55 +0200
committermormj <34754695+mormj@users.noreply.github.com>2021-06-19 19:46:17 -0400
commit2556a301718f4647b284c6b8ad57748064a3dad3 (patch)
treedc19709794963e77413ba6687b267c10c3fd08eb /gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
parente1b633a95047fce266e575cbc66a314d31c24491 (diff)
testing: rm dependencies from disabled components in blocks/runtime tests
This included shifting of the PDU test from runtime to gr-pdu, and making the tests that actually require blocks conditional on whether there's going to be gr-blocks. Also, don't use gr-analog just because you need data. Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py')
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py52
1 files changed, 28 insertions, 24 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py b/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
index 3e42c79b7d..33a758902b 100644
--- a/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
+++ b/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
@@ -1,5 +1,6 @@
#
# Copyright 2014 Free Software Foundation, Inc.
+# Copyright 2021 Marcus Müller
#
# This file is part of GNU Radio
#
@@ -9,7 +10,7 @@
import time
-from gnuradio import gr_unittest, blocks, gr, analog
+from gnuradio import gr_unittest, blocks, gr
from gnuradio.gr.hier_block2 import _multiple_endpoints, _optional_endpoints
import pmt
@@ -102,40 +103,43 @@ class test_hier_block2(gr_unittest.TestCase):
with self.assertRaises(ValueError):
self.multi(self.Block(), 5)
- def test_010(self):
- s, h, k = analog.sig_source_c(44100, analog.GR_COS_WAVE, 440, 1.0, 0.0), blocks.head(
- gr.sizeof_gr_complex, 1000), test_hblk([gr.sizeof_gr_complex], 0)
+ def test_010_end_with_head(self):
+ import math
+ exp = 1j * 440 / 44100
+ src = blocks.vector_source_c([math.e**(exp*n) for n in range(10**6)])
+ head = blocks.head(gr.sizeof_gr_complex, 1000)
+ test = test_hblk([gr.sizeof_gr_complex], 0)
tb = gr.top_block()
- tb.connect(s, h, k)
+ tb.connect(src, head, test)
tb.run()
- def test_011(self):
- s, st, h, k = analog.sig_source_c(
- 44100, analog.GR_COS_WAVE, 440, 1.0, 0.0), blocks.message_strobe(
- pmt.PMT_NIL, 100), blocks.head(
- gr.sizeof_gr_complex, 1000), test_hblk(
- [
- gr.sizeof_gr_complex], 1)
+ def test_011_test_message_connect(self):
+ import math
+ exp = 1j * 440 / 44100
+ src = blocks.vector_source_c([math.e**(exp*n) for n in range(10**6)])
+ strobe = blocks.message_strobe(pmt.PMT_NIL, 100)
+ head = blocks.head(gr.sizeof_gr_complex, 1000)
+ test = test_hblk([gr.sizeof_gr_complex], 1)
tb = gr.top_block()
- tb.connect(s, h, k)
- tb.msg_connect(st, "strobe", k, "msg_in")
+ tb.connect(src, head, test)
+ tb.msg_connect(strobe, "strobe", test, "msg_in")
tb.start()
- time.sleep(1)
+ time.sleep(0.5)
tb.stop()
tb.wait()
def test_012(self):
- s, st, h, k = analog.sig_source_c(
- 44100, analog.GR_COS_WAVE, 440, 1.0, 0.0), blocks.message_strobe(
- pmt.PMT_NIL, 100), blocks.head(
- gr.sizeof_gr_complex, 1000), test_hblk(
- [
- gr.sizeof_gr_complex], 16)
+ import math
+ exp = 1j * 440 / 44100
+ src = blocks.vector_source_c([math.e**(exp*n) for n in range(10**6)])
+ strobe = blocks.message_strobe(pmt.PMT_NIL, 100)
+ head = blocks.head(gr.sizeof_gr_complex, 1000)
+ test = test_hblk([gr.sizeof_gr_complex], 16)
tb = gr.top_block()
- tb.connect(s, h, k)
- tb.msg_connect(st, "strobe", k, "msg_in")
+ tb.connect(src, head, test)
+ tb.msg_connect(strobe, "strobe", test, "msg_in")
tb.start()
- time.sleep(1)
+ time.sleep(0.5)
tb.stop()
tb.wait()