From 438bf336644fd801aaac312293d01b19f2c79b24 Mon Sep 17 00:00:00 2001
From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Thu, 20 May 2010 09:29:42 +0000
Subject: [PATCH] Fixed unit test for windows (double / float precision errors)

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2271 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/img/alg/tests/test_discrete_shrink.cc | 2 +-
 modules/img/base/tests/test_image.cc          | 2 +-
 modules/io/tests/test_io_sdf.cc               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/img/alg/tests/test_discrete_shrink.cc b/modules/img/alg/tests/test_discrete_shrink.cc
index 30be5ab06..96708a050 100644
--- a/modules/img/alg/tests/test_discrete_shrink.cc
+++ b/modules/img/alg/tests/test_discrete_shrink.cc
@@ -53,7 +53,7 @@ void test()
       h.GetReal(p2+Point(1,0))+
       h.GetReal(p2+Point(0,1))+
       h.GetReal(p2+Point(1,1)));
-    BOOST_CHECK(std::fabs(sm-rh.GetReal(it))<1e-10);
+    BOOST_CHECK_CLOSE(std::fabs(sm-rh.GetReal(it)),0.0,0.000001);
   }
   
 }
diff --git a/modules/img/base/tests/test_image.cc b/modules/img/base/tests/test_image.cc
index 38c4431e5..8ee8161a0 100644
--- a/modules/img/base/tests/test_image.cc
+++ b/modules/img/base/tests/test_image.cc
@@ -312,7 +312,7 @@ void test_ImageOps()
   ImageHandle h3=h1+h2;
   for(ExtentIterator it(Extent(Point(-4,-3),Point(4,5))); !it.AtEnd(); ++it) {
     if(ex1.Contains(it) && ex2.Contains(it)) {
-      BOOST_REQUIRE(std::fabs(h3.GetReal(it)-(h1.GetReal(it)+h2.GetReal(it)))<1e-10);
+      BOOST_REQUIRE_CLOSE(std::fabs(h3.GetReal(it)-(h1.GetReal(it)+h2.GetReal(it))),0.0,0.000001);
     } else if (ex1.Contains(it)) {
       BOOST_REQUIRE(h3.GetReal(it)==h1.GetReal(it));
     } else {
diff --git a/modules/io/tests/test_io_sdf.cc b/modules/io/tests/test_io_sdf.cc
index 369ea6f8b..bbf858427 100644
--- a/modules/io/tests/test_io_sdf.cc
+++ b/modules/io/tests/test_io_sdf.cc
@@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(read_sdf)
 
   // check properties
   BOOST_CHECK(ch.HasProp("r_i_glide_rmsd"));
-  BOOST_CHECK_EQUAL(boost::lexical_cast<Real>(boost::trim_copy
+  BOOST_CHECK_EQUAL(boost::lexical_cast<float>(boost::trim_copy
                      (ch.GetStringProp("r_i_glide_rmsd"))),
                      0.543804f);
 }
-- 
GitLab