diff options
author | Eral Tuerkyilmaz <eral@gmx.net> | 2019-03-22 21:54:19 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2019-04-19 18:11:14 +0200 |
commit | 6658739bfc50cf51f2a75784d92265369a07a04b (patch) | |
tree | 2719a9c921d4ce43dffdbdd54aa3668ca3a81416 /gr-analog/python/analog/qa_sig_source.py | |
parent | 34f124441a23810855434d14311e07ca0e1210c5 (diff) |
gr-analog: sig source byte support mode, added qa tests #1994
Diffstat (limited to 'gr-analog/python/analog/qa_sig_source.py')
-rw-r--r-- | gr-analog/python/analog/qa_sig_source.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gr-analog/python/analog/qa_sig_source.py b/gr-analog/python/analog/qa_sig_source.py index 8b239fc070..0f14ae46c8 100644 --- a/gr-analog/python/analog/qa_sig_source.py +++ b/gr-analog/python/analog/qa_sig_source.py @@ -58,6 +58,18 @@ class test_sig_source(gr_unittest.TestCase): dst_data = dst1.data() self.assertEqual(expected_result, dst_data) + def test_const_b(self): + tb = self.tb + expected_result = (1, 1, 1, 1) + src1 = analog.sig_source_b(1e6, analog.GR_CONST_WAVE, 0, 1) + op = blocks.head(gr.sizeof_char, 4) + dst1 = blocks.vector_sink_b() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + def test_sine_f(self): tb = self.tb sqrt2 = math.sqrt(2) / 2 @@ -71,6 +83,22 @@ class test_sig_source(gr_unittest.TestCase): dst_data = dst1.data() self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) + + def test_sine_b(self): + tb = self.tb + sqrt2 = math.sqrt(2) / 2 + temp_result = (0, sqrt2, 1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0) + amp = 8 + expected_result = tuple([int(z * amp) for z in temp_result]) + src1 = analog.sig_source_b(8, analog.GR_SIN_WAVE, 1.0, amp) + op = blocks.head(gr.sizeof_char, 9) + dst1 = blocks.vector_sink_b() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertFloatTuplesAlmostEqual(expected_result, dst_data) + def test_cosine_f(self): tb = self.tb sqrt2 = math.sqrt(2) / 2 |