Imported Upstream version 3.0
[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 2, 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_runtime.h>
29 #include <gr_io_signature.h>
30 #include <gr_null_sink.h>
31 #include <gr_null_source.h>
32
33
34 // ----------------------------------------------------------------
35
36
37 void
38 qa_gr_block::t0 ()
39 {
40   // test creation of sources
41   gr_block_sptr src1 (gr_make_null_source (sizeof (int)));
42   CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src1->name ());
43   CPPUNIT_ASSERT_EQUAL (0, src1->input_signature()->max_streams ());
44   CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->min_streams ());
45   CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->max_streams ());
46   CPPUNIT_ASSERT_EQUAL (sizeof (int),
47                         src1->output_signature()->sizeof_stream_item (0));
48
49   gr_block_sptr src2 (gr_make_null_source (sizeof (short)));
50   CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src2->name ());
51   CPPUNIT_ASSERT_EQUAL (0, src2->input_signature()->max_streams ());
52   CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->min_streams ());
53   CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->max_streams ());
54   CPPUNIT_ASSERT_EQUAL (sizeof (short),
55                         src2->output_signature()->sizeof_stream_item (0));
56 }
57
58
59 void
60 qa_gr_block::t1 ()
61 {
62   // test creation of sinks
63   gr_block_sptr dst1 (gr_make_null_sink (sizeof (int)));
64   CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ());
65   CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ());
66   CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ());
67   CPPUNIT_ASSERT_EQUAL (sizeof (int),
68                         dst1->input_signature()->sizeof_stream_item (0));
69
70   CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ());
71
72   gr_block_sptr dst2 (gr_make_null_sink (sizeof (short)));
73   CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ());
74   CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ());
75   CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ());
76   CPPUNIT_ASSERT_EQUAL (sizeof (short),
77                         dst2->input_signature()->sizeof_stream_item (0));
78   CPPUNIT_ASSERT_EQUAL (0, dst2->output_signature()->max_streams ());
79 }
80
81 void
82 qa_gr_block::t2 ()
83 {
84 }
85
86 void
87 qa_gr_block::t3 ()
88 {
89 }