[Liblas-commits] hg-main-tree: clean up more == comparison tests with epsilon tests

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Mar 16 12:23:11 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/f39615782b97
changeset: 280:f39615782b97
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed Mar 16 11:22:48 2011 -0500
description:
clean up more == comparison tests with epsilon tests

diffstat:

 test/unit/PointDataTest.cpp |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 05bd6aca69e4 -r f39615782b97 test/unit/PointDataTest.cpp
--- a/test/unit/PointDataTest.cpp	Wed Mar 16 11:15:07 2011 -0500
+++ b/test/unit/PointDataTest.cpp	Wed Mar 16 11:22:48 2011 -0500
@@ -36,6 +36,7 @@
 #include <boost/cstdint.hpp>
 
 #include <libpc/PointData.hpp>
+#include <libpc/Utils.hpp>
 
 using namespace libpc;
 
@@ -106,7 +107,9 @@
 
       BOOST_CHECK(x == i+1);
       BOOST_CHECK(y == i*10);
-      BOOST_CHECK(z == i*100);
+
+      BOOST_CHECK(Utils::compare_approx(z, static_cast<double>(i)*100.0, (std::numeric_limits<double>::min)()) == true);
+
     }
 }
 
@@ -135,6 +138,9 @@
       const double z = d2.getField<double>(0, 2);
 
       int ii = 10;
+
+      BOOST_CHECK(Utils::compare_approx(z, ii+100.0, (std::numeric_limits<double>::min)()) == true);
+
       BOOST_CHECK(x == ii+1);
       BOOST_CHECK(y == ii*10);
       BOOST_CHECK(z == ii*100);


More information about the Liblas-commits mailing list