3 * Copyright 2004 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.
26 #include <qa_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>
34 // ----------------------------------------------------------------
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));
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));
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));
70 CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ());
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 ());