[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Jul 29 12:05:14 EDT 2010


changeset 4f88a603d17c in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=4f88a603d17c
summary: Upgraded TUT framework to most recent SVN r190 version

changeset 6e5d65bfde5e in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=6e5d65bfde5e
summary: Fixed compilation warnings in laspoint_test.cpp

diffstat:

 test/unit/laspoint_test.cpp            |    7 +-
 test/unit/tut/README                   |    2 +-
 test/unit/tut/tut.hpp                  |  132 +++++++----
 test/unit/tut/tut_assert.hpp           |  163 ++++++++++++--
 test/unit/tut/tut_config.hpp           |    6 +
 test/unit/tut/tut_console_reporter.hpp |   95 +++++--
 test/unit/tut/tut_cppunit_reporter.hpp |  201 ------------------
 test/unit/tut/tut_exception.hpp        |   92 +++++++-
 test/unit/tut/tut_posix.hpp            |   37 ++-
 test/unit/tut/tut_restartable.hpp      |    9 +-
 test/unit/tut/tut_result.hpp           |   79 +++++-
 test/unit/tut/tut_runner.hpp           |   55 +++-
 test/unit/tut/tut_xml_reporter.hpp     |  361 ---------------------------------
 13 files changed, 512 insertions(+), 727 deletions(-)

diffs (truncated from 2028 to 300 lines):

diff -r 783324a4e8f5 -r 6e5d65bfde5e test/unit/laspoint_test.cpp
--- a/test/unit/laspoint_test.cpp	Thu Jul 29 17:01:38 2010 +0100
+++ b/test/unit/laspoint_test.cpp	Thu Jul 29 17:08:48 2010 +0100
@@ -424,20 +424,21 @@
     template<>
     void to::test<17>()
     {
-        std::vector<liblas::uint8_t> data;
+        typedef std::vector<liblas::uint8_t> data_t;
         
+        data_t data;
         data.push_back(254);
         data.push_back(254);
         data.push_back(1);
         
         ensure_equals("invalid default extra data",
-            m_default.GetExtraData().size(), 0);
+            m_default.GetExtraData().size(), 0u);
 
 
         m_default.SetExtraData(data);
 
         ensure_equals("invalid set red color",
-            m_default.GetExtraData().size(), 3);
+            m_default.GetExtraData().size(), 3u);
 
         ensure_equals("invalid set green color",
             m_default.GetExtraData()[1], 254);
diff -r 783324a4e8f5 -r 6e5d65bfde5e test/unit/tut/README
--- a/test/unit/tut/README	Thu Jul 29 17:01:38 2010 +0100
+++ b/test/unit/tut/README	Thu Jul 29 17:08:48 2010 +0100
@@ -1,7 +1,7 @@
 ---------------------------------------------------------------------
 TUT: C++ Template Unit Test Framework
 
-Version:  TUT-2008-11-30
+Version:  TUT (SVN Revision 190)
 Homepage: http://tut-framework.sourceforge.net/
 ---------------------------------------------------------------------
 
diff -r 783324a4e8f5 -r 6e5d65bfde5e test/unit/tut/tut.hpp
--- a/test/unit/tut/tut.hpp	Thu Jul 29 17:01:38 2010 +0100
+++ b/test/unit/tut/tut.hpp	Thu Jul 29 17:08:48 2010 +0100
@@ -1,5 +1,6 @@
 #ifndef TUT_H_GUARD
 #define TUT_H_GUARD
+#include <tut/tut_config.hpp>
 
 #include <iostream>
 #include <map>
@@ -9,11 +10,6 @@
 #include <sstream>
 #include <iterator>
 #include <algorithm>
-#include <typeinfo>
-
-#if defined(linux)
-#define TUT_USE_POSIX
-#endif
 
 #include "tut_exception.hpp"
 #include "tut_result.hpp"
@@ -35,6 +31,9 @@
 namespace tut
 {
 
+template <class, int>
+class test_group;
+
 /**
  * Test object. Contains data test run upon and default test method
  * implementation. Inherited from Data to allow tests to
@@ -43,12 +42,29 @@
 template <class Data>
 class test_object : public Data, public test_object_posix
 {
+    template<class D, int M>
+    friend class test_group;
+
+    void set_test_group(const char *group)
+    {
+        current_test_group_ = group;
+    }
+
+    void set_test_id(int current_test_id)
+    {
+        current_test_id_ = current_test_id;
+    }
+
 public:
 
     /**
      * Default constructor
      */
     test_object()
+        : called_method_was_a_dummy_test_(false),
+          current_test_id_(0),
+          current_test_name_(),
+          current_test_group_()
     {
     }
 
@@ -62,9 +78,9 @@
         return current_test_name_;
     }
 
-    void set_test_id(int current_test_id)
+    const std::string& get_test_group() const
     {
-        current_test_id_ = current_test_id;
+        return current_test_group_;
     }
 
     int get_test_id() const
@@ -86,13 +102,17 @@
      * Used to detect usused test numbers and avoid unnecessary
      * test object creation which may be time-consuming depending
      * on operations described in Data::Data() and Data::~Data().
-     * TODO: replace with throwing special exception from default test.
      */
     bool called_method_was_a_dummy_test_;
 
+    virtual ~test_object()
+    {
+    }
+
 private:
     int             current_test_id_;
     std::string     current_test_name_;
+    std::string     current_test_group_;
 };
 
 
@@ -126,6 +146,9 @@
 template <class Data, int MaxTestsInGroup = 50>
 class test_group : public group_base, public test_group_posix
 {
+    test_group(const test_group&);
+    void operator=(const test_group&);
+
     const char* name_;
 
     typedef void (test_object<Data>::*testmethod)();
@@ -139,13 +162,15 @@
     tests tests_;
     tests_iterator current_test_;
 
-	enum seh_result
-	{
-		SEH_OK,
-		SEH_CTOR,
-		SEH_TEST,
-		SEH_DUMMY
-	};
+    enum seh_result
+    {
+        SEH_OK,
+#if defined(TUT_USE_SEH)
+        SEH_CTOR,
+        SEH_TEST,
+#endif
+        SEH_DUMMY
+    };
 
     /**
      * Exception-in-destructor-safe smart-pointer class.
@@ -201,11 +226,16 @@
         {
             try
             {
+#if defined(TUT_USE_SEH)
                 if (delete_obj() == false)
                 {
                     throw warning("destructor of test object raised"
                         " an SEH exception");
                 }
+#else
+                bool d = delete_obj();
+                assert(d && "delete failed with SEH disabled: runtime bug?");
+#endif
             }
             catch (const std::exception& ex)
             {
@@ -268,7 +298,9 @@
      * Creates and registers test group with specified name.
      */
     test_group(const char* name)
-        : name_(name)
+        : name_(name),
+          tests_(),
+          current_test_()
     {
         // register itself
         runner.get().register_group(name_,this);
@@ -281,7 +313,9 @@
      * This constructor is used in self-test run only.
      */
     test_group(const char* name, test_runner& another_runner)
-        : name_(name)
+        : name_(name),
+          tests_(),
+          current_test_()
     {
         // register itself
         another_runner.register_group(name_, this);
@@ -367,22 +401,23 @@
         try
         {
             switch (run_test_seh_(ti->second, obj, current_test_name, ti->first))
-			{
-				case SEH_CTOR:
-					throw bad_ctor("seh");
-					break;
+            {
+#if defined(TUT_USE_SEH)
+                case SEH_CTOR:
+                    throw bad_ctor("seh");
+                    break;
 
-				case SEH_TEST:
-					throw seh("seh");
-					break;
+                case SEH_TEST:
+                    throw seh("seh");
+                    break;
+#endif
+                case SEH_DUMMY:
+                    tr.result = test_result::dummy;
+                    break;
 
-				case SEH_DUMMY:
-					tr.result = test_result::dummy;
-					break;
-
-				case SEH_OK:
-					// ok
-					break;
+                case SEH_OK:
+                    // ok
+                    break;
             }
         }
         catch (const rethrown& ex)
@@ -393,13 +428,13 @@
         catch (const tut_error& ex)
         {
             tr.result = ex.result();
-            tr.exception_typeid = typeid(ex).name();
+            tr.exception_typeid = ex.type();
             tr.message = ex.what();
         }
         catch (const std::exception& ex)
         {
             tr.result = test_result::ex;
-            tr.exception_typeid = typeid(ex).name();
+            tr.exception_typeid = type_name(ex);
             tr.message = ex.what();
         }
         catch (...)
@@ -433,12 +468,12 @@
         __try
         {
 #endif
-        if (obj.get() == 0)
-        {
-            reset_holder_(obj);
-        }
+            if (obj.get() == 0)
+            {
+                reset_holder_(obj);
+            }
 
-        obj->called_method_was_a_dummy_test_ = false;
+            obj->called_method_was_a_dummy_test_ = false;
 
 #if defined(TUT_USE_SEH)
 
@@ -446,6 +481,7 @@
             {
 #endif
                 obj.get()->set_test_id(current_test_id);
+                obj.get()->set_test_group(name_);
                 (obj.get()->*tm)();
 #if defined(TUT_USE_SEH)
             }
@@ -456,20 +492,20 @@
             }
 #endif
 
-        if (obj->called_method_was_a_dummy_test_)
-        {
-            // do not call obj.release(); reuse object
-            return SEH_DUMMY;
-        }
+            if (obj->called_method_was_a_dummy_test_)
+            {
+                // do not call obj.release(); reuse object
+                return SEH_DUMMY;
+            }
 


More information about the Liblas-commits mailing list