[Liblas-commits] r1217 - in trunk: include/liblas test/unit

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Apr 16 10:18:44 EDT 2009


Author: mloskot
Date: Thu Apr 16 10:18:43 2009
New Revision: 1217
URL: http://liblas.org/changeset/1217

Log:
* LASClassification ctor accepts bitset by const-reference (Ticket #131).
* Test initialization of LASClassification with bitset object created from string.

Modified:
   trunk/include/liblas/lasclassification.hpp
   trunk/test/unit/lasclassification_test.cpp

Modified: trunk/include/liblas/lasclassification.hpp
==============================================================================
--- trunk/include/liblas/lasclassification.hpp	(original)
+++ trunk/include/liblas/lasclassification.hpp	Thu Apr 16 10:18:43 2009
@@ -81,12 +81,12 @@
     LASClassification() {}
 
     /// Initializes classification with given set of 8 flags.
-    explicit LASClassification(bitset_type flags)
+    explicit LASClassification(bitset_type const& flags)
         : m_flags(flags)
     {}
 
     /// Initializes classification from flags given as integral type.
-    explicit LASClassification(uint8_t flags)
+    explicit LASClassification(uint8_t const& flags)
         : m_flags(flags)
     {}
 

Modified: trunk/test/unit/lasclassification_test.cpp
==============================================================================
--- trunk/test/unit/lasclassification_test.cpp	(original)
+++ trunk/test/unit/lasclassification_test.cpp	Thu Apr 16 10:18:43 2009
@@ -253,7 +253,7 @@
     template<>
     void to::test<12>()
     {
-        std::string sbits("00000000");
+        std::string const sbits("00000000");
 
         liblas::LASClassification c;
 
@@ -266,7 +266,7 @@
     template<>
     void to::test<13>()
     {
-        std::string sbits("00000011");
+        std::string const sbits("00000011");
 
         liblas::LASClassification c;
         c.SetClass(3);
@@ -280,7 +280,7 @@
     template<>
     void to::test<14>()
     {
-        std::string sbits("10000001");
+        std::string const sbits("10000001");
 
         liblas::LASClassification c;
         
@@ -296,7 +296,7 @@
     template<>
     void to::test<15>()
     {
-        std::string sbits("10110000");
+        std::string const sbits("10110000");
 
         liblas::LASClassification c;
         
@@ -309,4 +309,64 @@
         oss << c;
         ensure_equals(oss.str(), sbits);
     }
+
+    template<>
+    template<>
+    void to::test<16>()
+    {
+        std::string const sbits("00000000");
+        liblas::LASClassification::bitset_type bits(sbits);
+        
+        liblas::LASClassification c(bits);
+        ensure_equals(c, bits);
+
+        std::ostringstream oss;
+        oss << c;
+        ensure_equals(oss.str(), sbits);
+    }
+
+    template<>
+    template<>
+    void to::test<17>()
+    {
+        std::string const sbits("00000011");
+        liblas::LASClassification::bitset_type bits(sbits);
+
+        liblas::LASClassification c(bits);
+        ensure_equals(c, bits);
+
+        std::ostringstream oss;
+        oss << c;
+        ensure_equals(oss.str(), sbits);
+    }
+
+    template<>
+    template<>
+    void to::test<18>()
+    {
+        std::string const sbits("10000001");
+        liblas::LASClassification::bitset_type bits(sbits);
+
+        liblas::LASClassification c(bits);
+        ensure_equals(c, bits);
+
+        std::ostringstream oss;
+        oss << c;
+        ensure_equals(oss.str(), sbits);
+    }
+
+    template<>
+    template<>
+    void to::test<19>()
+    {
+        std::string const sbits("10110000");
+        liblas::LASClassification::bitset_type bits(sbits);
+
+        liblas::LASClassification c(bits);
+        ensure_equals(c, bits);
+
+        std::ostringstream oss;
+        oss << c;
+        ensure_equals(oss.str(), sbits);
+    }
 }


More information about the Liblas-commits mailing list