diff options
author | Johnathan Corgan | 2009-11-12 07:24:34 -0800 |
---|---|---|
committer | Johnathan Corgan | 2009-11-12 07:28:02 -0800 |
commit | 0a3595df4693b28031e7220c8c20fa1abeb99d76 (patch) | |
tree | 11233dea883d52e1e0d072431ffb92b3acddf8ea | |
parent | 4e0c8a37c3574f59e34186996cef0c44ff50bd16 (diff) | |
download | gnuradio-0a3595df4693b28031e7220c8c20fa1abeb99d76.tar.gz gnuradio-0a3595df4693b28031e7220c8c20fa1abeb99d76.tar.bz2 gnuradio-0a3595df4693b28031e7220c8c20fa1abeb99d76.zip |
howto: adds C++ QA code
-rw-r--r-- | gr-howto-write-a-block/config/gr_standalone.m4 | 8 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/.gitignore | 1 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/Makefile.am | 42 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/qa_howto.cc | 41 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/qa_howto.h | 36 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/qa_howto_square2_ff.cc | 35 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/qa_howto_square2_ff.h | 39 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/qa_howto_square_ff.cc | 35 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/qa_howto_square_ff.h | 39 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/test_all.cc | 38 |
10 files changed, 312 insertions, 2 deletions
diff --git a/gr-howto-write-a-block/config/gr_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4 index 593583e2d..3f8ddf1d6 100644 --- a/gr-howto-write-a-block/config/gr_standalone.m4 +++ b/gr-howto-write-a-block/config/gr_standalone.m4 @@ -124,4 +124,12 @@ m4_define([GR_STANDALONE], [enable_python=yes] ) AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes]) + + dnl Define where to look for cppunit includes and libs + dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS + dnl Try using pkg-config first, then fall back to cppunit-config. + PKG_CHECK_EXISTS(cppunit, + [PKG_CHECK_MODULES(CPPUNIT, cppunit >= 1.9.14)], + [AM_PATH_CPPUNIT([1.9.14],[], + [AC_MSG_ERROR([GNU Radio requires cppunit. Stop])])]) ]) diff --git a/gr-howto-write-a-block/lib/.gitignore b/gr-howto-write-a-block/lib/.gitignore index d957a6821..b1e56d39e 100644 --- a/gr-howto-write-a-block/lib/.gitignore +++ b/gr-howto-write-a-block/lib/.gitignore @@ -9,3 +9,4 @@ /*.pyc /howto.cc /howto.py +/test_all
\ No newline at end of file diff --git a/gr-howto-write-a-block/lib/Makefile.am b/gr-howto-write-a-block/lib/Makefile.am index e553c193d..336cb8a20 100644 --- a/gr-howto-write-a-block/lib/Makefile.am +++ b/gr-howto-write-a-block/lib/Makefile.am @@ -21,8 +21,12 @@ include $(top_srcdir)/Makefile.common -################################### -# howto C++ library +# list of programs run by "make check" and "make distcheck" +TESTS = test_all + +# ---------------------------------------------------------------- +# howto C++ library: libgnuradio-howto.so +# ---------------------------------------------------------------- # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ @@ -40,3 +44,37 @@ libgnuradio_howto_la_LIBADD = \ libgnuradio_howto_la_LDFLAGS = \ $(NO_UNDEFINED) + +# ---------------------------------------------------------------- +# howto C++ QA library: libgnuradio-howto-qa.so (not installed) +# ---------------------------------------------------------------- + +noinst_LTLIBRARIES = libgnuradio-howto-qa.la + +libgnuradio_howto_qa_la_SOURCES = \ + qa_howto.cc \ + qa_howto_square_ff.cc \ + qa_howto_square2_ff.cc + +libgnuradio_howto_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 + +libgnuradio_howto_qa_la_LIBADD = \ + libgnuradio-howto.la \ + $(CPPUNIT_LIBS) + +# ---------------------------------------------------------------- +# headers that don't get installed +# ---------------------------------------------------------------- +noinst_HEADERS = \ + qa_howto.h \ + qa_howto_square_ff.h \ + qa_howto_square2_ff.h + +# ---------------------------------------------------------------- +# test program +# ---------------------------------------------------------------- +noinst_PROGRAMS = \ + test_all + +test_all_SOURCES = test_all.cc +test_all_LDADD = libgnuradio-howto-qa.la diff --git a/gr-howto-write-a-block/lib/qa_howto.cc b/gr-howto-write-a-block/lib/qa_howto.cc new file mode 100644 index 000000000..f1411a388 --- /dev/null +++ b/gr-howto-write-a-block/lib/qa_howto.cc @@ -0,0 +1,41 @@ +/* + * Copyright 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. + */ + +/* + * This class gathers together all the test cases for the example + * directory into a single test suite. As you create new test cases, + * add them here. + */ + +#include <qa_howto.h> +#include <qa_howto_square_ff.h> +#include <qa_howto_square2_ff.h> + +CppUnit::TestSuite * +qa_howto::suite() +{ + CppUnit::TestSuite *s = new CppUnit::TestSuite("howto"); + + s->addTest(qa_howto_square_ff::suite()); + s->addTest(qa_howto_square2_ff::suite()); + + return s; +} diff --git a/gr-howto-write-a-block/lib/qa_howto.h b/gr-howto-write-a-block/lib/qa_howto.h new file mode 100644 index 000000000..fa5a42fd3 --- /dev/null +++ b/gr-howto-write-a-block/lib/qa_howto.h @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 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 Example 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 Example Public License for more details. + * + * You should have received a copy of the GNU Example 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. + */ + +#ifndef INCLUDED_QA_HOWTO_H +#define INCLUDED_QA_HOWTO_H + +#include <cppunit/TestSuite.h> + +//! collect all the tests for the example directory + +class qa_howto { + public: + //! return suite of tests for all of example directory + static CppUnit::TestSuite *suite (); +}; + +#endif /* INCLUDED_QA_HOWTO_H */ diff --git a/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc b/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc new file mode 100644 index 000000000..a37465104 --- /dev/null +++ b/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <qa_howto_square2_ff.h> +#include <cppunit/TestAssert.h> + +void +qa_howto_square2_ff::t1() +{ + // Insert CPPUNIT tests/asserts here +} + +void +qa_howto_square2_ff::t2() +{ + // Insert CPPUNIT tests/asserts here +} diff --git a/gr-howto-write-a-block/lib/qa_howto_square2_ff.h b/gr-howto-write-a-block/lib/qa_howto_square2_ff.h new file mode 100644 index 000000000..c74d0866f --- /dev/null +++ b/gr-howto-write-a-block/lib/qa_howto_square2_ff.h @@ -0,0 +1,39 @@ +/* -*- c++ -*- */ +/* + * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef INCLUDED_QA_HOWTO_SQUARE2_FF_H +#define INCLUDED_QA_HOWTO_SQUARE2_FF_H + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestCase.h> + +class qa_howto_square2_ff : public CppUnit::TestCase { + + CPPUNIT_TEST_SUITE (qa_howto_square2_ff); + CPPUNIT_TEST (t1); + CPPUNIT_TEST (t2); + CPPUNIT_TEST_SUITE_END (); + + private: + void t1 (); + void t2 (); +}; + +#endif /* INCLUDED_QA_HOWTO_SQUARE2_FF_H */ diff --git a/gr-howto-write-a-block/lib/qa_howto_square_ff.cc b/gr-howto-write-a-block/lib/qa_howto_square_ff.cc new file mode 100644 index 000000000..2f0b59773 --- /dev/null +++ b/gr-howto-write-a-block/lib/qa_howto_square_ff.cc @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <qa_howto_square_ff.h> +#include <cppunit/TestAssert.h> + +void +qa_howto_square_ff::t1() +{ + // Insert CPPUNIT tests/asserts here +} + +void +qa_howto_square_ff::t2() +{ + // Insert CPPUNIT tests/asserts here +} diff --git a/gr-howto-write-a-block/lib/qa_howto_square_ff.h b/gr-howto-write-a-block/lib/qa_howto_square_ff.h new file mode 100644 index 000000000..1b7c5e99f --- /dev/null +++ b/gr-howto-write-a-block/lib/qa_howto_square_ff.h @@ -0,0 +1,39 @@ +/* -*- c++ -*- */ +/* + * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef INCLUDED_QA_HOWTO_SQUARE_FF_H +#define INCLUDED_QA_HOWTO_SQUARE_FF_H + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestCase.h> + +class qa_howto_square_ff : public CppUnit::TestCase { + + CPPUNIT_TEST_SUITE (qa_howto_square_ff); + CPPUNIT_TEST (t1); + CPPUNIT_TEST (t2); + CPPUNIT_TEST_SUITE_END (); + + private: + void t1 (); + void t2 (); +}; + +#endif /* INCLUDED_QA_HOWTO_SQUARE_FF_H */ diff --git a/gr-howto-write-a-block/lib/test_all.cc b/gr-howto-write-a-block/lib/test_all.cc new file mode 100644 index 000000000..192c537bc --- /dev/null +++ b/gr-howto-write-a-block/lib/test_all.cc @@ -0,0 +1,38 @@ +/* -*- c++ -*- */ +/* + * Copyright 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 <qa_howto.h> + +int +main (int argc, char **argv) +{ + + CppUnit::TextTestRunner runner; + + runner.addTest(qa_howto::suite ()); + + bool was_successful = runner.run("", false); + + return was_successful ? 0 : 1; +} |