[Liblas-commits] hg: rename tut test files to remove las_ prefix. Add a Transfor...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 22 14:41:34 EST 2010


changeset 3f63ce4340f0 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=3f63ce4340f0
summary: rename tut test files to remove las_ prefix.  Add a TransformI test for the ColorFetchingTransform and test with Autzen data

diffstat:

 test/unit/CMakeLists.txt               |   19 +-
 test/unit/bounds_test.cpp              |   89 +++++
 test/unit/classification_test.cpp      |  512 +++++++++++++++++++++++++++++++++
 test/unit/error_test.cpp               |   77 ++++
 test/unit/header_test.cpp              |  310 +++++++++++++++++++
 test/unit/lasbounds_test.cpp           |   89 -----
 test/unit/lasclassification_test.cpp   |  512 ---------------------------------
 test/unit/laserror_test.cpp            |   77 ----
 test/unit/lasheader_test.cpp           |  310 -------------------
 test/unit/laspoint_test.cpp            |  496 -------------------------------
 test/unit/lasreader_iterator_test.cpp  |  393 -------------------------
 test/unit/lasreader_test.cpp           |  282 ------------------
 test/unit/lasspatialreference_test.cpp |  323 --------------------
 test/unit/lasvariablerecord_test.cpp   |  111 -------
 test/unit/laswriter_test.cpp           |  321 --------------------
 test/unit/point_test.cpp               |  496 +++++++++++++++++++++++++++++++
 test/unit/reader_iterator_test.cpp     |  393 +++++++++++++++++++++++++
 test/unit/reader_test.cpp              |  282 ++++++++++++++++++
 test/unit/spatialreference_test.cpp    |  323 ++++++++++++++++++++
 test/unit/transform_test.cpp           |   82 +++++
 test/unit/variablerecord_test.cpp      |  111 +++++++
 test/unit/writer_test.cpp              |  321 ++++++++++++++++++++
 22 files changed, 3006 insertions(+), 2923 deletions(-)

diffs (truncated from 6025 to 300 lines):

diff -r de68335e5839 -r 3f63ce4340f0 test/unit/CMakeLists.txt
--- a/test/unit/CMakeLists.txt	Wed Dec 22 13:16:01 2010 -0600
+++ b/test/unit/CMakeLists.txt	Wed Dec 22 13:41:27 2010 -0600
@@ -8,17 +8,18 @@
 SET(LIBLAS_UNIT_TEST liblas_test)
 
 SET(LIBLAS_UNIT_TEST_SRC
+    bounds_test.cpp
     common.cpp
+    error_test.cpp
     guid_test.cpp
-    lasbounds_test.cpp
-    laserror_test.cpp
-    lasheader_test.cpp
-    laspoint_test.cpp
-    lasreader_iterator_test.cpp
-    lasreader_test.cpp
-    lasspatialreference_test.cpp
-    lasvariablerecord_test.cpp
-    laswriter_test.cpp
+    header_test.cpp
+    point_test.cpp
+    reader_iterator_test.cpp
+    reader_test.cpp
+    spatialreference_test.cpp
+    transform_test.cpp
+    variablerecord_test.cpp
+    writer_test.cpp
     liblas_test_suite.cpp)
 
 INCLUDE_DIRECTORIES(
diff -r de68335e5839 -r 3f63ce4340f0 test/unit/bounds_test.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/bounds_test.cpp	Wed Dec 22 13:41:27 2010 -0600
@@ -0,0 +1,89 @@
+// (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 <liblas/lasbounds.hpp>
+#include <liblas/guid.hpp>
+#include <tut/tut.hpp>
+#include <string>
+#include <vector>
+#include <stdexcept>
+#include "common.hpp"
+
+namespace tut
+{ 
+    struct lasbounds_data
+    {
+        liblas::Bounds<double> m_default;
+        typedef std::vector< liblas::Range<double> > Ranges;
+    };
+
+    typedef test_group<lasbounds_data> tg;
+    typedef tg::object to;
+
+    tg test_group_lasbounds("liblas::Bounds");
+
+
+    liblas::Range<double> xrng(0, 100);
+    liblas::Range<double> yrng(0, 200);
+    liblas::Range<double> zrng(0, 300);
+
+
+    // Test default constructor
+    template<>
+    template<>
+    void to::test<1>()
+    {
+        Ranges rngs;
+        rngs.push_back(xrng);
+        rngs.push_back(yrng);
+        rngs.push_back(zrng);
+        
+        typedef liblas::Bounds<double> b_t;
+        b_t b(rngs);
+        ensure_equals(b.minx(), b_t::value_type(0));
+        ensure_equals(b.maxx(), b_t::value_type(100));
+        ensure_equals(b.miny(), b_t::value_type(0));
+        ensure_equals(b.maxy(), b_t::value_type(200));
+        ensure_equals(b.minz(), b_t::value_type(0));
+        ensure_equals(b.maxz(), b_t::value_type(300));
+    }
+
+    template<>
+    template<>
+    void to::test<2>()
+    {
+        ensure(yrng.contains(xrng));
+        ensure(zrng.contains(yrng));
+        
+    }
+
+    template<>
+    template<>
+    void to::test<3>()
+    {
+        Ranges rngs;
+        rngs.push_back(xrng);
+        rngs.push_back(yrng);
+        rngs.push_back(zrng);
+        
+        liblas::Bounds<double> b(rngs);  
+        liblas::Bounds<double> b2(b);
+        ensure_equals(b2.minx(), b.minx());
+        ensure_equals(b2.miny(), b.miny());
+        ensure_equals(b2.minz(), b.minz());
+        ensure_equals(b2.maxx(), b.maxx());
+        ensure_equals(b2.maxy(), b.maxy());
+        ensure_equals(b2.maxz(), b.maxz());
+        
+    }
+
+    template<>
+    template<>
+    void to::test<4>()
+    {
+        liblas::Range<double> r;
+        ensure(r.empty());
+    }
+}
diff -r de68335e5839 -r 3f63ce4340f0 test/unit/classification_test.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/classification_test.cpp	Wed Dec 22 13:41:27 2010 -0600
@@ -0,0 +1,512 @@
+// $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 <liblas/lasclassification.hpp>
+#include <tut/tut.hpp>
+#include <bitset>
+#include <sstream>
+#include <stdexcept>
+#include <string>
+#include "common.hpp"
+
+namespace tut
+{ 
+    struct lasclassification_data
+    {
+        typedef liblas::Classification::bitset_type bitset_type;
+        liblas::Classification m_default;
+    };
+
+    typedef test_group<lasclassification_data> tg;
+    typedef tg::object to;
+
+    tg test_group_lasclassification("liblas::Classification");
+
+    template<>
+    template<>
+    void to::test<1>()
+    {
+        ensure_equals(m_default, bitset_type(0));
+        ensure_equals(m_default.GetClass(), 0);
+        ensure_not(m_default.IsSynthetic());
+        ensure_not(m_default.IsKeyPoint());
+        ensure_not(m_default.IsWithheld());
+    }
+
+    template<>
+    template<>
+    void to::test<2>()
+    {
+        liblas::Classification c0(0);
+
+        ensure_equals(c0, m_default);
+        ensure_equals(c0, bitset_type(0));
+        ensure_equals(c0.GetClass(), 0);
+        ensure_not(c0.IsSynthetic());
+        ensure_not(c0.IsKeyPoint());
+        ensure_not(c0.IsWithheld());
+    }
+
+    template<>
+    template<>
+    void to::test<3>()
+    {
+        liblas::Classification c31(0x1F);
+
+        ensure_not(c31 == m_default);
+        ensure_equals(c31.GetClass(), 31);
+        ensure_not(c31.IsSynthetic());
+        ensure_not(c31.IsKeyPoint());
+        ensure_not(c31.IsWithheld());
+    }
+
+    template<>
+    template<>
+    void to::test<4>()
+    {
+        liblas::Classification c255(255);
+        ensure_equals(c255, bitset_type(255));
+        ensure_equals(c255.GetClass(), 31);
+        ensure(c255.IsSynthetic());
+        ensure(c255.IsKeyPoint());
+        ensure(c255.IsWithheld());
+    }
+
+    template<>
+    template<>
+    void to::test<5>()
+    {
+        liblas::Classification c(31, false, false, false);
+     
+        ensure_equals(c.GetClass(), 31);
+        ensure_not(c.IsSynthetic());
+        ensure_not(c.IsKeyPoint());
+        ensure_not(c.IsWithheld());
+        ensure_equals(c, bitset_type(std::string("00011111")));
+    }
+
+    template<>
+    template<>
+    void to::test<6>()
+    {
+        liblas::Classification c(7, true, false, true);
+     
+        ensure_equals(c.GetClass(), 7);
+        ensure_not(c.IsKeyPoint());
+        ensure(c.IsWithheld());
+        ensure(c.IsSynthetic());
+        ensure_equals(c, bitset_type(std::string("10100111")));
+    }
+
+    template<>
+    template<>
+    void to::test<7>()
+    {
+        try
+        {
+            liblas::Classification c(255, true, true, true);
+
+            fail("std::out_of_range not thrown but expected");
+        }
+        catch (std::out_of_range const& e)
+        {
+            ensure(e.what(), true);
+        }
+        catch (...)
+        {
+            fail("unhandled exception expected");
+        }
+    }
+
+    template<>
+    template<>
+    void to::test<8>()
+    {
+        liblas::Classification cpy(m_default);
+     
+        ensure_equals(cpy, m_default);
+    }
+
+    template<>
+    template<>
+    void to::test<9>()
+    {
+        liblas::Classification c(7, true, false, true);
+        liblas::Classification cpy(c);
+     
+        ensure_equals(cpy.GetClass(), 7);
+        ensure_not(cpy.IsKeyPoint());
+        ensure(cpy.IsWithheld());
+        ensure(cpy.IsSynthetic());
+        ensure_equals(cpy, bitset_type(std::string("10100111")));
+        ensure_equals(cpy, c);
+    }
+
+    template<>
+    template<>
+    void to::test<10>()
+    {
+        liblas::Classification cpy;
+        cpy = m_default;
+     
+        ensure_equals(cpy, m_default);
+    }
+
+    template<>
+    template<>
+    void to::test<11>()
+    {
+        liblas::Classification c(7, true, false, true);
+        liblas::Classification cpy = c;
+     
+        ensure_equals(cpy.GetClass(), 7);
+        ensure_not(cpy.IsKeyPoint());
+        ensure(cpy.IsWithheld());
+        ensure(cpy.IsSynthetic());
+        ensure_equals(cpy, bitset_type(std::string("10100111")));
+        ensure_equals(cpy, c);
+    }


More information about the Liblas-commits mailing list