The following commit has been merged in the master branch:
commit 388362f77e759fd55b5fcf5c5391cd11fbc094f1
Author: Gert Wollny <[email protected]>
Date:   Tue Feb 26 16:46:25 2013 +0100

    fix tests for values close to zero

diff --git a/mia/3d/filter/test_scale.cc b/mia/3d/filter/test_scale.cc
index 90c9e51..6e9bcae 100644
--- a/mia/3d/filter/test_scale.cc
+++ b/mia/3d/filter/test_scale.cc
@@ -203,7 +203,10 @@ BOOST_AUTO_TEST_CASE( test_downscale_float_persists )
        for (size_t i = 0; i < 64; ++i) {
 
                cvdebug() << i << ":" << fscaled[i] << " - " << test_float[i] 
<< '\n'; 
-               BOOST_CHECK_CLOSE(fscaled[i], test_float[i], 0.1); 
+               if (fabs(test_float[i]) > 1e-16) 
+                       BOOST_CHECK_CLOSE(fscaled[i], test_float[i], 0.1); 
+               else 
+                       BOOST_CHECK((fabs(fscaled[i]) < 1e-16)); 
        }
                
 
diff --git a/mia/core/test_splineparzenmi.cc b/mia/core/test_splineparzenmi.cc
index 9fac7e0..7856ae2 100644
--- a/mia/core/test_splineparzenmi.cc
+++ b/mia/core/test_splineparzenmi.cc
@@ -254,9 +254,12 @@ BOOST_FIXTURE_TEST_CASE( test_self, CSplineParzenMIFixture 
)
                        cvdebug() << self_grad << " vs " << test_grad << ":" << 
self_grad / test_grad<<"\n"; 
 
 
-                       if (test_grad != 0) 
+                       // if the gradient is very small test against 'close to 
zero'
+                       if (fabs(test_grad) > 1e-16) 
                                BOOST_CHECK_CLOSE(self_grad, test_grad, 0.1); 
-                }
+                       else 
+                               BOOST_CHECK(fabs(self_grad) < 1e-16);
+                }      
        
 }
 

-- 
Packaging of mia in Debian

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to