[Liblas-commits] hg-main-tree: more test of chipper

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Mar 24 15:26:17 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/06f5aad81e0c
changeset: 434:06f5aad81e0c
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Mar 24 14:26:10 2011 -0500
description:
more test of chipper

diffstat:

 test/unit/ChipperTest.cpp |  48 ++++++++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 17 deletions(-)

diffs (74 lines):

diff -r d3a0a658ccc6 -r 06f5aad81e0c test/unit/ChipperTest.cpp
--- a/test/unit/ChipperTest.cpp	Thu Mar 24 12:12:56 2011 -0700
+++ b/test/unit/ChipperTest.cpp	Thu Mar 24 14:26:10 2011 -0500
@@ -46,6 +46,7 @@
 
 BOOST_AUTO_TEST_SUITE(ChipperTest)
 
+
 BOOST_AUTO_TEST_CASE(test_construction)
 {
     LiblasReader reader(TestConfig::g_data_path + "1.2-with-color.las");
@@ -70,32 +71,45 @@
         libpc::Range<double> x = ranges[0];
         libpc::Range<double> y = ranges[1];
         
-        BOOST_CHECK(Utils::compare_approx(x.getMinimum(), (double)635674, (double) 1) == true);
-        BOOST_CHECK(Utils::compare_approx(x.getMaximum(), (double)635994, (double) 1) == true);
-        BOOST_CHECK(Utils::compare_approx(y.getMinimum(), (double)848992, (double) 1) == true);
-        BOOST_CHECK(Utils::compare_approx(y.getMaximum(), (double)849427, (double) 1) == true);
+        BOOST_CHECK_CLOSE_FRACTION (x.getMinimum(), 635674.0, 0.05);
+        BOOST_CHECK_CLOSE_FRACTION (x.getMaximum(), 635994.0, 0.05);
+        BOOST_CHECK_CLOSE_FRACTION (y.getMinimum(), 848992.0, 0.05);
+        BOOST_CHECK_CLOSE_FRACTION (y.getMaximum(), 849427.0, 0.05);
 
         std::vector<boost::uint32_t> ids = chipper.GetBlock(70).GetIDs();
 
         BOOST_CHECK(ids.size() == 15);
         BOOST_CHECK(ids[14] == 1050 );
 
-        // PointBuffer buffer = chipper.GetBlock(20).GetPointBuffer(libpc::SchemaLayout(reader.getHeader().getSchema()));
+        PointBuffer buffer = chipper.GetBlock(20).GetBuffer(reader);
+
         // 
-        // // Check X's of first three points in block 20
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(0, 0) == 63567405);
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(1, 0) == 63568054);
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(2, 0) == 63569865);
+        // std::cout << buffer.getField<boost::int32_t>(0, 0) << std::endl;
+        // std::cout << buffer.getField<boost::int32_t>(1, 0) << std::endl;
+        // std::cout << buffer.getField<boost::int32_t>(2, 0) << std::endl;
         // 
-        // // Check Y's of first three points in block 20
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(0, 1) == 84901732);
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(1, 1) == 84936266);
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(2, 1) == 84941588);
+        // std::cout << buffer.getField<boost::int32_t>(0, 1) << std::endl;
+        // std::cout << buffer.getField<boost::int32_t>(1, 1) << std::endl;
+        // std::cout << buffer.getField<boost::int32_t>(2, 1) << std::endl;
         // 
-        // // Check Z's of first three points in block 20
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(0, 2) == 42802);
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(1, 2) == 42156);
-        // BOOST_CHECK(buffer.getField<boost::int32_t>(2, 2) == 42392);
+        // std::cout << buffer.getField<boost::int32_t>(0, 2) << std::endl;
+        // std::cout << buffer.getField<boost::int32_t>(1, 2) << std::endl;
+        // std::cout << buffer.getField<boost::int32_t>(2, 2) << std::endl;
+
+        // Check X's of first three points in block 20
+        BOOST_CHECK(buffer.getField<boost::int32_t>(0, 0) == 63763550);
+        BOOST_CHECK(buffer.getField<boost::int32_t>(1, 0) == 63765279);
+        BOOST_CHECK(buffer.getField<boost::int32_t>(2, 0) == 63771207);
+        
+        // Check Y's of first three points in block 20
+        BOOST_CHECK(buffer.getField<boost::int32_t>(0, 1) == 84992418);
+        BOOST_CHECK(buffer.getField<boost::int32_t>(1, 1) == 85005705);
+        BOOST_CHECK(buffer.getField<boost::int32_t>(2, 1) == 85005840);
+        
+        // Check Z's of first three points in block 20
+        BOOST_CHECK(buffer.getField<boost::int32_t>(0, 2) == 42664);
+        BOOST_CHECK(buffer.getField<boost::int32_t>(1, 2) == 43579);
+        BOOST_CHECK(buffer.getField<boost::int32_t>(2, 2) == 42651);
 
     }
 


More information about the Liblas-commits mailing list