ea3f3e14ce16363f5e2110f3e8d54557e546d156
[debian/gnuradio] / gnuradio-core / src / lib / runtime / qa_gr_block.cc
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
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)
10  * any later version.
11  * 
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.
16  * 
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.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 #include <qa_gr_block.h>
27 #include <gr_block.h>
28 #include <gr_io_signature.h>
29 #include <gr_null_sink.h>
30 #include <gr_null_source.h>
31
32
33 // ----------------------------------------------------------------
34
35
36 void
37 qa_gr_block::t0 ()
38 {
39   // test creation of sources
40   gr_block_sptr src1 (gr_make_null_source (sizeof (int)));
41   CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src1->name ());
42   CPPUNIT_ASSERT_EQUAL (0, src1->input_signature()->max_streams ());
43   CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->min_streams ());
44   CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->max_streams ());
45   CPPUNIT_ASSERT_EQUAL ((int) sizeof(int),
46                         src1->output_signature()->sizeof_stream_item (0));
47
48   gr_block_sptr src2 (gr_make_null_source (sizeof (short)));
49   CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src2->name ());
50   CPPUNIT_ASSERT_EQUAL (0, src2->input_signature()->max_streams ());
51   CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->min_streams ());
52   CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->max_streams ());
53   CPPUNIT_ASSERT_EQUAL ((int) sizeof (short),
54                         src2->output_signature()->sizeof_stream_item (0));
55 }
56
57
58 void
59 qa_gr_block::t1 ()
60 {
61   // test creation of sinks
62   gr_block_sptr dst1 (gr_make_null_sink (sizeof (int)));
63   CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ());
64   CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ());
65   CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ());
66   CPPUNIT_ASSERT_EQUAL ((int) sizeof (int),
67                         dst1->input_signature()->sizeof_stream_item (0));
68
69   CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ());
70
71   gr_block_sptr dst2 (gr_make_null_sink (sizeof (short)));
72   CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ());
73   CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ());
74   CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ());
75   CPPUNIT_ASSERT_EQUAL ((int) sizeof (short),
76                         dst2->input_signature()->sizeof_stream_item (0));
77   CPPUNIT_ASSERT_EQUAL (0, dst2->output_signature()->max_streams ());
78 }
79
80 void
81 qa_gr_block::t2 ()
82 {
83 }
84
85 void
86 qa_gr_block::t3 ()
87 {
88 }