diff options
Diffstat (limited to 'gr-digital/python/digital/qa_constellation_encoder_bc.py')
-rw-r--r-- | gr-digital/python/digital/qa_constellation_encoder_bc.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gr-digital/python/digital/qa_constellation_encoder_bc.py b/gr-digital/python/digital/qa_constellation_encoder_bc.py index 2c6d587dac..ef1991bf80 100644 --- a/gr-digital/python/digital/qa_constellation_encoder_bc.py +++ b/gr-digital/python/digital/qa_constellation_encoder_bc.py @@ -12,6 +12,7 @@ from gnuradio import gr, gr_unittest, digital, blocks import numpy as np + class test_constellation_encoder(gr_unittest.TestCase): def setUp(self): @@ -23,8 +24,8 @@ class test_constellation_encoder(gr_unittest.TestCase): def test_constellation_encoder_bc_bpsk(self): cnst = digital.constellation_bpsk() - src_data = (1, 1, 0, 0, - 1, 0, 1) + src_data = (1, 1, 0, 0, + 1, 0, 1) const_map = [-1.0, 1.0] expected_result = [const_map[x] for x in src_data] @@ -43,8 +44,8 @@ class test_constellation_encoder(gr_unittest.TestCase): def test_constellation_encoder_bc_qpsk(self): cnst = digital.constellation_qpsk() - src_data = (3, 1, 0, 2, - 3, 2, 1) + src_data = (3, 1, 0, 2, + 3, 2, 1) expected_result = [cnst.points()[x] for x in src_data] src = blocks.vector_source_b(src_data) op = digital.constellation_encoder_bc(cnst.base()) @@ -59,7 +60,6 @@ class test_constellation_encoder(gr_unittest.TestCase): # print "expected result", expected_result self.assertFloatTuplesAlmostEqual(expected_result, actual_result) - def test_constellation_encoder_bc_qpsk_random(self): cnst = digital.constellation_qpsk() src_data = np.random.randint(0, 4, size=20000) @@ -77,5 +77,6 @@ class test_constellation_encoder(gr_unittest.TestCase): # print "expected result", expected_result self.assertFloatTuplesAlmostEqual(expected_result, actual_result) + if __name__ == '__main__': gr_unittest.run(test_constellation_encoder) |