[Liblas-commits] libpc: stub for using boost unit tests

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Feb 17 15:01:02 EST 2011


details:   http://hg.liblas.orglibpc/rev/65261b9e5a03
changeset: 68:65261b9e5a03
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Feb 17 12:00:55 2011 -0800
description:
stub for using boost unit tests

diffstat:

 test/unit/CMakeLists.txt       |   5 ++-
 test/unit/Suite1.cpp           |  17 +++++++++++++
 test/unit/Suite2.cpp           |  17 +++++++++++++
 test/unit/libpc_test.hpp       |  18 --------------
 test/unit/libpc_test_suite.cpp |  53 ------------------------------------------
 test/unit/main.cpp             |   9 +++++++
 test/unit/zipreader_test.cpp   |  38 ------------------------------
 7 files changed, 46 insertions(+), 111 deletions(-)

diffs (191 lines):

diff -r b899ec533e10 -r 65261b9e5a03 test/unit/CMakeLists.txt
--- a/test/unit/CMakeLists.txt	Thu Feb 17 10:23:40 2011 -0800
+++ b/test/unit/CMakeLists.txt	Thu Feb 17 12:00:55 2011 -0800
@@ -8,8 +8,9 @@
 SET(LIBPC_UNIT_TEST libpc_test)
 
 SET(LIBPC_UNIT_TEST_SRC
-    zipreader_test.cpp
-    libpc_test_suite.cpp)
+    Suite1.cpp
+    Suite2.cpp
+    main.cpp)
 
 INCLUDE_DIRECTORIES(
     .
diff -r b899ec533e10 -r 65261b9e5a03 test/unit/Suite1.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/Suite1.cpp	Thu Feb 17 12:00:55 2011 -0800
@@ -0,0 +1,17 @@
+#define BOOST_TEST_DYN_LINK
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_SUITE(Suite1)
+
+BOOST_AUTO_TEST_CASE(Suite_1_Test_1)
+{
+    BOOST_CHECK(true);
+}
+
+BOOST_AUTO_TEST_CASE(Suite_1_Test_2)
+{
+    BOOST_CHECK(true);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff -r b899ec533e10 -r 65261b9e5a03 test/unit/Suite2.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/Suite2.cpp	Thu Feb 17 12:00:55 2011 -0800
@@ -0,0 +1,17 @@
+#define BOOST_TEST_DYN_LINK
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_SUITE(Suite2)
+
+BOOST_AUTO_TEST_CASE(Suite_2_Test_1)
+{
+    BOOST_CHECK(true);
+}
+
+BOOST_AUTO_TEST_CASE(Suite_2_Test_2)
+{
+    BOOST_CHECK(false);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff -r b899ec533e10 -r 65261b9e5a03 test/unit/libpc_test.hpp
--- a/test/unit/libpc_test.hpp	Thu Feb 17 10:23:40 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-// $Id$
-//
-// (C) Copyright Mateusz Loskot 2008, mateusz at loskot.net
-// Distributed under the BSD License
-// (See accompanying file LICENSE.txt or copy at
-// http://www.opensource.org/licenses/bsd-license.php)
-//
-#ifndef LIBLAS_TEST_HPP_INCLUDED
-#define LIBLAS_TEST_HPP_INCLUDED
-
-namespace tut
-{
-    // full path to trunk/test/data
-    extern std::string g_test_data_path;
-}
-
-#endif // LIBLAS_TEST_HPP_INCLUDED
-
diff -r b899ec533e10 -r 65261b9e5a03 test/unit/libpc_test_suite.cpp
--- a/test/unit/libpc_test_suite.cpp	Thu Feb 17 10:23:40 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-// $Id$
-//
-// (C) Copyright Mateusz Loskot 2008, mateusz at loskot.net
-// Distributed under the BSD License
-// (See accompanying file LICENSE.txt or copy at
-// http://www.opensource.org/licenses/bsd-license.php)
-//
-#include <tut/tut.hpp>
-#include <tut/tut_reporter.hpp>
-#include <iostream>
-#include <string>
-
-namespace tut
-{
-    test_runner_singleton runner;
-
-    // full path to trunk/test/data
-    std::string g_test_data_path;
-}
-
-int main(int argc, char* argv[])
-{
-    if (1 == argc)
-    {
-        tut::g_test_data_path = "../data"; // default path
-    }
-    else if (2 == argc)
-    {
-        tut::g_test_data_path = argv[1];
-    }
-    else
-    {
-        std::cout << "Usage: liblas_test <test data path>\n";
-        return 1;
-    }
-
-    std::cout << "libLAS Test Suite:\n==================";
-
-    tut::reporter reporter;
-    tut::runner.get().set_callback(&reporter);
-
-    try
-    {
-        tut::runner.get().run_tests();
-    }
-    catch (std::exception const& e)
-    {
-        std::cerr << "TUT raised exception: " << e.what() << std::endl;
-    }
-
-    return (reporter.all_ok() ? 0 : 1);
-}
-
diff -r b899ec533e10 -r 65261b9e5a03 test/unit/main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/main.cpp	Thu Feb 17 12:00:55 2011 -0800
@@ -0,0 +1,9 @@
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE Main
+#include <boost/test/unit_test.hpp>
+
+#define BOOST_TEST_DYN_LINK
+
+#include <boost/test/unit_test.hpp>
+
+/* actually no code in here, this is just the main file */
diff -r b899ec533e10 -r 65261b9e5a03 test/unit/zipreader_test.cpp
--- a/test/unit/zipreader_test.cpp	Thu Feb 17 10:23:40 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-//
-// (C) Copyright 2010 Michael P. Gerlek (mpg at flaxen.com)
-// Distributed under the BSD License
-// (See accompanying file LICENSE.txt or copy at
-// http://www.opensource.org/licenses/bsd-license.php)
-//
-
-#include <tut/tut.hpp>
-#include <iostream>
-#include <string>
-#include "libpc_test.hpp"
-
-namespace tut
-{ 
-    struct zipreader_data
-    {
-        std::string file_las;
-        std::string file_laz;
-
-        zipreader_data() :
-            file_las(g_test_data_path + "//1.2-with-color.las"),
-            file_laz(g_test_data_path + "//1.2-with-color.laz")
-        {}
-    };
-
-    typedef test_group<zipreader_data> tg;
-    typedef tg::object to;
-
-    tg test_group_zipreader("liblas::ZipReader");
-
-    // Test the factory does the right thing and the header is marked as compressed
-    template<>
-    template<>
-    void to::test<1>()
-    {
-      std::cout << "yow\n";
-    }
-}


More information about the Liblas-commits mailing list