[Liblas-commits] libpc: comment

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Feb 23 21:18:41 EST 2011


details:   http://hg.liblas.orglibpc/rev/09728dc0f2fd
changeset: 84:09728dc0f2fd
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Feb 23 18:18:02 2011 -0800
description:
comment
Subject: libpc: revise error tolerance

details:   http://hg.liblas.orglibpc/rev/7b7170b9a018
changeset: 85:7b7170b9a018
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Feb 23 18:18:28 2011 -0800
description:
revise error tolerance

diffstat:

 include/libpc/Utils.hpp      |   1 +
 test/unit/FauxWriterTest.cpp |  20 ++++++++++----------
 2 files changed, 11 insertions(+), 10 deletions(-)

diffs (41 lines):

diff -r d796f3aee4ff -r 7b7170b9a018 include/libpc/Utils.hpp
--- a/include/libpc/Utils.hpp	Wed Feb 23 18:00:03 2011 -0800
+++ b/include/libpc/Utils.hpp	Wed Feb 23 18:18:28 2011 -0800
@@ -61,6 +61,7 @@
     }
 
     // compares two values to within a given tolerance
+    // BUG: need to disallow T to be an unsigned type
     template<class T>
     static bool compare_approx(const T& actual, const T& expected, const T& tolerance)
     {
diff -r d796f3aee4ff -r 7b7170b9a018 test/unit/FauxWriterTest.cpp
--- a/test/unit/FauxWriterTest.cpp	Wed Feb 23 18:00:03 2011 -0800
+++ b/test/unit/FauxWriterTest.cpp	Wed Feb 23 18:18:28 2011 -0800
@@ -45,16 +45,16 @@
 
     BOOST_CHECK(numWritten == 750);
 
-    // test all the values to +/- 1.0
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getMinX(), 1.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getMinY(), 2.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getMinZ(), 3.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getMaxX(), 101.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getMaxY(), 102.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getMaxZ(), 103.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getAvgX(), 51.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getAvgY(), 52.0, 1.0));
-    BOOST_CHECK(Utils::compare_approx<float>(writer.getAvgZ(), 53.0, 1.0));
+    // test all the values to +/- 10%
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getMinX(), 1.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getMinY(), 2.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getMinZ(), 3.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getMaxX(), 101.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getMaxY(), 102.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getMaxZ(), 103.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getAvgX(), 51.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getAvgY(), 52.0, 10.0));
+    BOOST_CHECK(Utils::compare_approx<float>(writer.getAvgZ(), 53.0, 10.0));
 
     return;
 }


More information about the Liblas-commits mailing list