3 # Copyright 2007 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Radio; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street,
20 # Boston, MA 02110-1301, USA.
23 from gnuradio import gr, gr_unittest
26 class test_sig_source (gr_unittest.TestCase):
29 self.tb = gr.top_block ()
34 def test_regen1 (self):
38 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
39 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
41 expected_result = (0, 0, 0,
42 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
43 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
46 src = gr.vector_source_b(data, False)
47 regen = gr.regenerate_bb(5, 2)
48 dst = gr.vector_sink_b()
50 tb.connect (src, regen)
51 tb.connect (regen, dst)
54 dst_data = dst.data ()
56 self.assertEqual (expected_result, dst_data)
58 def test_regen2 (self):
65 expected_result = 200*[0,]
66 expected_result[9] = 1
67 expected_result[19] = 1
68 expected_result[29] = 1
69 expected_result[39] = 1
71 expected_result[99] = 1
72 expected_result[109] = 1
73 expected_result[119] = 1
74 expected_result[129] = 1
76 src = gr.vector_source_b(data, False)
77 regen = gr.regenerate_bb(10, 3)
78 dst = gr.vector_sink_b()
80 tb.connect (src, regen)
81 tb.connect (regen, dst)
84 dst_data = dst.data ()
86 self.assertEqual (tuple(expected_result), dst_data)
89 if __name__ == '__main__':