[Liblas-commits] hg-main-tree: added more read/write laz tests

liblas-commits at liblas.org liblas-commits at liblas.org
Wed May 11 19:07:01 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/1c1b3de6f1a0
changeset: 717:1c1b3de6f1a0
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed May 11 16:06:55 2011 -0700
description:
added more read/write laz tests

diffstat:

 test/data/1.2-with-color.laz   |    0 
 test/unit/LasReaderTest.cpp    |   44 +++++++++++++++++++++++++++++++++++++++++
 test/unit/LasWriterTest.cpp    |    2 +-
 test/unit/LiblasReaderTest.cpp |   43 ++++++++++++++++++++++++++++++++++++++++
 test/unit/LiblasWriterTest.cpp |    2 +-
 5 files changed, 89 insertions(+), 2 deletions(-)

diffs (133 lines):

diff -r 46554fb156ae -r 1c1b3de6f1a0 test/data/1.2-with-color.laz
Binary file test/data/1.2-with-color.laz has changed
diff -r 46554fb156ae -r 1c1b3de6f1a0 test/unit/LasReaderTest.cpp
--- a/test/unit/LasReaderTest.cpp	Wed May 11 13:12:42 2011 -0700
+++ b/test/unit/LasReaderTest.cpp	Wed May 11 16:06:55 2011 -0700
@@ -124,6 +124,50 @@
 }
 
 
+BOOST_AUTO_TEST_CASE(test_random_laz)
+{
+    return; // BUG
+    libpc::drivers::las::LasReader reader(Support::datapath("1.2-with-color.laz"));
+    BOOST_CHECK(reader.getDescription() == "Las Reader");
+
+    const Schema& schema = reader.getSchema();
+    SchemaLayout layout(schema);
+
+    PointBuffer data(layout, 3);
+    
+    libpc::RandomIterator* iter = reader.createRandomIterator();
+
+    {
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 3);
+
+        Support::check_p0_p1_p2(data, schema);
+    }
+
+    // Can we seek it? Yes, we can!
+    iter->seek(100);
+    {
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 3);
+
+        Support::check_p100_p101_p102(data, schema);
+    }
+
+    // Can we seek to beginning? Yes, we can!
+    iter->seek(0);
+    {
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 3);
+
+        Support::check_p0_p1_p2(data, schema);
+    }
+    
+    delete iter;
+
+    return;
+}
+
+
 BOOST_AUTO_TEST_CASE(test_two_iters)
 {
     libpc::drivers::las::LasReader reader(Support::datapath("1.2-with-color.las"));
diff -r 46554fb156ae -r 1c1b3de6f1a0 test/unit/LasWriterTest.cpp
--- a/test/unit/LasWriterTest.cpp	Wed May 11 13:12:42 2011 -0700
+++ b/test/unit/LasWriterTest.cpp	Wed May 11 16:06:55 2011 -0700
@@ -118,7 +118,7 @@
         libpc::drivers::las::LasReader reader("temp.laz");
     }
 
-    bool filesSame = Support::compare_files("temp.laz", Support::datapath("simple.laz"));
+    bool filesSame = Support::compare_files("temp.laz", Support::datapath("1.2-with-color.laz"));
     BOOST_CHECK(filesSame);
 
     if (filesSame)
diff -r 46554fb156ae -r 1c1b3de6f1a0 test/unit/LiblasReaderTest.cpp
--- a/test/unit/LiblasReaderTest.cpp	Wed May 11 13:12:42 2011 -0700
+++ b/test/unit/LiblasReaderTest.cpp	Wed May 11 16:06:55 2011 -0700
@@ -127,6 +127,49 @@
 }
 
 
+BOOST_AUTO_TEST_CASE(test_random_laz)
+{
+    LiblasReader reader(Support::datapath("1.2-with-color.laz"));
+    BOOST_CHECK(reader.getDescription() == "Liblas Reader");
+
+    const Schema& schema = reader.getSchema();
+    SchemaLayout layout(schema);
+
+    PointBuffer data(layout, 3);
+    
+    libpc::RandomIterator* iter = reader.createRandomIterator();
+
+    {
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 3);
+
+        Support::check_p0_p1_p2(data, schema);
+    }
+
+    // Can we seek it? Yes, we can!
+    iter->seek(100);
+    {
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 3);
+
+        Support::check_p100_p101_p102(data, schema);
+    }
+
+    // Can we seek to beginning? Yes, we can!
+    iter->seek(0);
+    {
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 3);
+
+        Support::check_p0_p1_p2(data, schema);
+    }
+    
+    delete iter;
+
+    return;
+}
+
+
 BOOST_AUTO_TEST_CASE(test_two_iters)
 {
     LiblasReader reader(Support::datapath("1.2-with-color.las"));
diff -r 46554fb156ae -r 1c1b3de6f1a0 test/unit/LiblasWriterTest.cpp
--- a/test/unit/LiblasWriterTest.cpp	Wed May 11 13:12:42 2011 -0700
+++ b/test/unit/LiblasWriterTest.cpp	Wed May 11 16:06:55 2011 -0700
@@ -113,7 +113,7 @@
 
     Utils::closeFile(ofs);
 
-    bool filesSame = Support::compare_files("temp.laz", Support::datapath("simple.laz"));
+    bool filesSame = Support::compare_files("temp.laz", Support::datapath("1.2-with-color.laz"));
     BOOST_CHECK(filesSame);
 
     if (filesSame)


More information about the Liblas-commits mailing list