[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3857 - gnuradio/branches/developers/jcorgan/cppwrap/g
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3857 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime |
Date: |
Wed, 25 Oct 2006 13:54:42 -0600 (MDT) |
Author: jcorgan
Date: 2006-10-25 13:54:41 -0600 (Wed, 25 Oct 2006)
New Revision: 3857
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.cc
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.h
Log:
Work in progress, adding QA tests for gr_basic_flowgraph
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
2006-10-25 18:25:13 UTC (rev 3856)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
2006-10-25 19:54:41 UTC (rev 3857)
@@ -38,12 +38,18 @@
// allocated on the heap. No further memory management is needed.
gr_basic_flowgraph_sptr gr_make_basic_flowgraph()
{
+#if GR_FLOWGRAPH_DEBUG
+ cout << "Flowgraph constructed." << endl;
+#endif
return gr_basic_flowgraph_sptr(new gr_basic_flowgraph());
}
// Destructor, nothing to do.
gr_basic_flowgraph::~gr_basic_flowgraph()
{
+#if GR_FLOWGRAPH_DEBUG
+ cout << "Flowgraph destructed." << endl;
+#endif
// NOP
}
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.cc
2006-10-25 18:25:13 UTC (rev 3856)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.cc
2006-10-25 19:54:41 UTC (rev 3857)
@@ -1,4 +1,3 @@
-/* -*- c++ -*- */
/*
* Copyright 2006 Free Software Foundation, Inc.
*
@@ -28,7 +27,86 @@
#include <gr_basic_flowgraph.h>
#include <cppunit/TestAssert.h>
-void qa_gr_basic_flowgraph::t0()
+void qa_gr_basic_flowgraph::setUp()
{
- CPPUNIT_ASSERT(1);
+ d_fg = gr_make_basic_flowgraph();
}
+
+void qa_gr_basic_flowgraph::tearDown()
+{
+ d_fg.reset();
+}
+
+void qa_gr_basic_flowgraph::test_make()
+{
+ CPPUNIT_ASSERT(d_fg);
+}
+
+void qa_gr_basic_flowgraph::test_connect()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ d_fg->connect(src1, 0, dst1, 0);
+}
+
+void qa_gr_basic_flowgraph::test_disconnect()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ d_fg->connect(src1, 0, dst1, 0);
+ d_fg->disconnect(src1, 0, dst1, 0);
+}
+
+void qa_gr_basic_flowgraph::test_disconnect_unconnected()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ d_fg->disconnect(src1, 0, dst1, 0);
+}
+
+void qa_gr_basic_flowgraph::test_dst_in_use()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr src2 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ d_fg->connect(src1, 0, dst1, 0);
+ d_fg->connect(src2, 0, dst1, 0);
+}
+
+void qa_gr_basic_flowgraph::test_no_such_src_port()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ d_fg->connect(src1, 1, dst1, 0);
+}
+
+void qa_gr_basic_flowgraph::test_no_such_dst_port()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ d_fg->connect(src1, 0, dst1, 1);
+}
+
+void qa_gr_basic_flowgraph::test_one_src_two_dst()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ gr_block_sptr dst2 = gr_make_null_sink(sizeof(int));
+ d_fg->connect(src1, 0, dst1, 0);
+ d_fg->connect(src1, 0, dst2, 0);
+}
+
+void qa_gr_basic_flowgraph::test_itemsize_mismatch()
+{
+ CPPUNIT_ASSERT(d_fg);
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(char));
+ d_fg->connect(src1, 0, dst1, 0);
+}
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.h
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.h
2006-10-25 18:25:13 UTC (rev 3856)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/qa_gr_basic_flowgraph.h
2006-10-25 19:54:41 UTC (rev 3857)
@@ -25,17 +25,41 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestCase.h>
+#include <gr_basic_flowgraph.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <stdexcept>
-class qa_gr_basic_flowgraph : public CppUnit::TestCase {
+class qa_gr_basic_flowgraph : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_basic_flowgraph);
- CPPUNIT_TEST_SUITE (qa_gr_basic_flowgraph);
- CPPUNIT_TEST (t0);
- CPPUNIT_TEST_SUITE_END ();
+ CPPUNIT_TEST(test_make);
+ CPPUNIT_TEST(test_connect);
+ CPPUNIT_TEST(test_disconnect);
+ CPPUNIT_TEST_EXCEPTION(test_disconnect_unconnected, std::invalid_argument);
+ CPPUNIT_TEST_EXCEPTION(test_dst_in_use, std::invalid_argument);
+ CPPUNIT_TEST_EXCEPTION(test_no_such_src_port, std::out_of_range);
+ CPPUNIT_TEST_EXCEPTION(test_no_such_dst_port, std::out_of_range);
+ CPPUNIT_TEST(test_one_src_two_dst);
+ CPPUNIT_TEST_EXCEPTION(test_itemsize_mismatch, std::invalid_argument);
+
+ CPPUNIT_TEST_SUITE_END();
-
- private:
-
- void t0 ();
+ gr_basic_flowgraph_sptr d_fg;
+ void test_make();
+ void test_connect();
+ void test_disconnect();
+ void test_disconnect_unconnected();
+ void test_dst_in_use();
+ void test_no_such_src_port();
+ void test_no_such_dst_port();
+ void test_one_src_two_dst();
+ void test_itemsize_mismatch();
+
+public:
+ void setUp();
+ void tearDown();
};
#endif /* INCLUDED_QA_GR_BASIC_FLOWGRAPH_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3857 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime,
jcorgan <=