QA code now works.
authorEric Blossom <eb@comsec.com>
Wed, 19 Aug 2009 01:57:33 +0000 (18:57 -0700)
committerEric Blossom <eb@comsec.com>
Wed, 19 Aug 2009 01:57:33 +0000 (18:57 -0700)
gruel/src/lib/Makefile.am
gruel/src/lib/pmt/Makefile.am
gruel/src/lib/pmt/pmt.cc
gruel/src/lib/pmt/qa_pmt_prims.cc
gruel/src/lib/pmt/test_pmt.cc [deleted file]
gruel/src/lib/test_gruel.cc [new file with mode: 0644]

index 6dfb6787c804ad2f89aafff23c86d51a7488a1fc..9afa0d292f2df871f46af49174f53314d9efe50b 100644 (file)
@@ -25,6 +25,12 @@ SUBDIRS = pmt msg
 
 AM_CPPFLAGS = $(DEFINES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) $(GRUEL_INCLUDES) $(WITH_INCLUDES)
 
+
+TESTS = test_gruel
+
+noinst_PROGRAMS = test_gruel
+
+
 lib_LTLIBRARIES = libgruel.la
 
 # magic flags
@@ -47,3 +53,10 @@ libgruel_la_LIBADD =                         \
        $(PMT_LIB)                      \
        $(MSG_LIB)                      \
        -lstdc++
+
+
+# ----------------------------------------------------------------
+
+test_gruel_SOURCES = test_gruel.cc
+test_gruel_LDADD   = libgruel.la pmt/libpmt-qa.la
+
index 2b710a598f1550b15ad835afc5a51111c85f9fdd..8750cbdf8370788fdafbebbc6e9ef5d6efddd58e 100644 (file)
@@ -23,7 +23,6 @@ include $(top_srcdir)/Makefile.common
 
 AM_CPPFLAGS = $(DEFINES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) $(GRUEL_INCLUDES) $(WITH_INCLUDES)
 
-TESTS = test_pmt
 
 noinst_LTLIBRARIES = libpmt.la
 
@@ -90,14 +89,6 @@ libpmt_qa_la_LIBADD =                        \
        $(CPPUNIT_LIBS)                 \
        -lstdc++                        
 
-noinst_PROGRAMS        =                       \
-       test_pmt
-
-
-LIBPMTQA = libpmt-qa.la
-
-test_pmt_SOURCES = test_pmt.cc
-test_pmt_LDADD   = $(LIBPMTQA)
 
 # Do creation and inclusion of other Makefiles last
 
index 5301529b27ef5c2ed7522c018e0c6a06edbfdb75..42f25b9de9340aae35396c6790a6423611e9a0dc 100644 (file)
@@ -907,11 +907,15 @@ pmt_make_msg_accepter(gruel::msg_accepter_sptr ma)
 gruel::msg_accepter_sptr
 pmt_msg_accepter_ref(const pmt_t &obj)
 {
-  return boost::any_cast<gruel::msg_accepter_sptr>(pmt_any_ref(obj));
+  try {
+    return boost::any_cast<gruel::msg_accepter_sptr>(pmt_any_ref(obj));
+  }
+  catch (boost::bad_any_cast &e){
+    throw pmt_wrong_type("pmt_msg_accepter_ref", obj);
+  }
 }
 
 
-
 ////////////////////////////////////////////////////////////////////////////
 //                          General Functions
 ////////////////////////////////////////////////////////////////////////////
index 2c66b8fdb14a6ba6bdb53c02a964c2f678af170d..e2d6ec4c624d12d27532b52a7595dc940741a513 100644 (file)
@@ -456,9 +456,9 @@ qa_pmt_prims::test_any()
 
 class qa_pmt_msg_accepter_nop : public gruel::msg_accepter {
 public:
-  qa_pmt_msg_accepter_nop();
+  qa_pmt_msg_accepter_nop(){};
   ~qa_pmt_msg_accepter_nop();
-  void post(pmt_t) { };
+  void post(pmt_t){};
 };
 
 qa_pmt_msg_accepter_nop::~qa_pmt_msg_accepter_nop(){}
@@ -478,8 +478,7 @@ qa_pmt_prims::test_msg_accepter()
   CPPUNIT_ASSERT_EQUAL(ma0.get(), pmt_msg_accepter_ref(p1).get());
 
   CPPUNIT_ASSERT_THROW(pmt_msg_accepter_ref(sym), pmt_wrong_type);
-  CPPUNIT_ASSERT_THROW(pmt_msg_accepter_ref(p0),  pmt_wrong_type); // FIXME
-
+  CPPUNIT_ASSERT_THROW(pmt_msg_accepter_ref(p0),  pmt_wrong_type);
 }
 
 // ------------------------------------------------------------------------
diff --git a/gruel/src/lib/pmt/test_pmt.cc b/gruel/src/lib/pmt/test_pmt.cc
deleted file mode 100644 (file)
index 034785f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <cppunit/TextTestRunner.h>
-#include <qa_pmt.h>
-
-int 
-main(int argc, char **argv)
-{
-  
-  CppUnit::TextTestRunner      runner;
-
-  runner.addTest(qa_pmt::suite ());
-  
-  bool was_successful = runner.run("", false);
-
-  return was_successful ? 0 : 1;
-}
diff --git a/gruel/src/lib/test_gruel.cc b/gruel/src/lib/test_gruel.cc
new file mode 100644 (file)
index 0000000..6693034
--- /dev/null
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include "pmt/qa_pmt.h"
+
+int 
+main(int argc, char **argv)
+{
+  
+  CppUnit::TextTestRunner      runner;
+
+  runner.addTest(qa_pmt::suite ());
+  
+  bool was_successful = runner.run("", false);
+
+  return was_successful ? 0 : 1;
+}