summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-12-19 09:52:37 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-12-19 09:52:37 +0000
commitaa5760623c2d769c01567f5c7f07d52fabc3e2d9 (patch)
tree16d2ec9e910917699c74e7605f648622a6798e2a
parent80aa35b3ad53c95607221167b72d9aa00e1f71b5 (diff)
Add a function for unitary tests to test floating point values equality w/wo epsilon values
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration_cmake_improvement@3083 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 835037fd6efea4fbfc9a494df3015186232388bf
-rw-r--r--src/Alpha_complex/test/Alpha_complex_unit_test.cpp19
-rw-r--r--src/Persistence_representations/test/persistence_heat_maps_test.cpp72
-rw-r--r--src/Rips_complex/test/test_rips_complex.cpp25
-rw-r--r--src/cmake/modules/GUDHI_test_coverage.cmake14
-rw-r--r--src/common/include/gudhi/Debug_utils.h2
-rw-r--r--src/common/include/gudhi/Unitary_tests_utils.h39
6 files changed, 96 insertions, 75 deletions
diff --git a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
index 166373fe..c3ad1a9c 100644
--- a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
+++ b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp
@@ -23,6 +23,7 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE "alpha_complex"
#include <boost/test/unit_test.hpp>
+#include <boost/mpl/list.hpp>
#include <CGAL/Delaunay_triangulation.h>
#include <CGAL/Epick_d.h>
@@ -36,7 +37,7 @@
// to construct a simplex_tree from Delaunay_triangulation
#include <gudhi/graph_simplicial_complex.h>
#include <gudhi/Simplex_tree.h>
-#include <boost/mpl/list.hpp>
+#include <gudhi/Unitary_tests_utils.h>
// Use dynamic_dimension_tag for the user to be able to set dimension
typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel_d;
@@ -96,10 +97,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_from_OFF_file, TestedKernel, list_of
BOOST_CHECK(simplex_tree_59.num_simplices() == 23);
}
-bool are_almost_the_same(float a, float b) {
- return std::fabs(a - b) < std::numeric_limits<float>::epsilon();
-}
-
// Use static dimension_tag for the user not to be able to set dimension
typedef CGAL::Epick_d< CGAL::Dimension_tag<4> > Kernel_4;
typedef Kernel_4::Point_d Point_4;
@@ -166,16 +163,16 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_from_points) {
for (auto f_simplex : simplex_tree.filtration_simplex_range()) {
switch (simplex_tree.dimension(f_simplex)) {
case 0:
- BOOST_CHECK(are_almost_the_same(simplex_tree.filtration(f_simplex), 0.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(simplex_tree.filtration(f_simplex), 0.0);
break;
case 1:
- BOOST_CHECK(are_almost_the_same(simplex_tree.filtration(f_simplex), 1.0/2.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(simplex_tree.filtration(f_simplex), 1.0/2.0);
break;
case 2:
- BOOST_CHECK(are_almost_the_same(simplex_tree.filtration(f_simplex), 2.0/3.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(simplex_tree.filtration(f_simplex), 2.0/3.0);
break;
case 3:
- BOOST_CHECK(are_almost_the_same(simplex_tree.filtration(f_simplex), 3.0/4.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(simplex_tree.filtration(f_simplex), 3.0/4.0);
break;
default:
BOOST_CHECK(false); // Shall not happen
@@ -239,10 +236,10 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_from_points) {
for (auto f_simplex : simplex_tree.filtration_simplex_range()) {
switch (simplex_tree.dimension(f_simplex)) {
case 0:
- BOOST_CHECK(are_almost_the_same(simplex_tree.filtration(f_simplex), 0.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(simplex_tree.filtration(f_simplex), 0.0);
break;
case 1:
- BOOST_CHECK(are_almost_the_same(simplex_tree.filtration(f_simplex), 1.0/2.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(simplex_tree.filtration(f_simplex), 1.0/2.0);
break;
default:
BOOST_CHECK(false); // Shall not happen
diff --git a/src/Persistence_representations/test/persistence_heat_maps_test.cpp b/src/Persistence_representations/test/persistence_heat_maps_test.cpp
index 1f1502f5..4da13b86 100644
--- a/src/Persistence_representations/test/persistence_heat_maps_test.cpp
+++ b/src/Persistence_representations/test/persistence_heat_maps_test.cpp
@@ -25,12 +25,15 @@
#include <boost/test/unit_test.hpp>
#include <gudhi/reader_utils.h>
#include <gudhi/Persistence_heat_maps.h>
+#include <gudhi/Unitary_tests_utils.h>
#include <iostream>
using namespace Gudhi;
using namespace Gudhi::Persistence_representations;
+double epsilon = 0.0005;
+
BOOST_AUTO_TEST_CASE(check_construction_of_heat_maps) {
std::vector<std::vector<double> > filter = create_Gaussian_filter(100, 1);
Persistence_heat_maps<constant_scaling_function> p("data/file_with_diagram", filter, false, 1000, 0, 1);
@@ -139,28 +142,15 @@ BOOST_AUTO_TEST_CASE(check_distance_for_heat_maps) {
Persistence_heat_maps<constant_scaling_function> q("data/file_with_diagram_1", filter, false, 1000, 0, 1);
Persistence_heat_maps<constant_scaling_function> r("data/file_with_diagram_2", filter, false, 1000, 0, 1);
- // cerr << p.distance( p ) << endl;
- // cerr << p.distance( q ) << endl;
- // cerr << p.distance( r ) << endl;
- // cerr << q.distance( p ) << endl;
- // cerr << q.distance( q ) << endl;
- // cerr << q.distance( r ) << endl;
- // cerr << r.distance( p ) << endl;
- // cerr << r.distance( q ) << endl;
- // cerr << r.distance( r ) << endl;
- // 0 624.183 415.815
- // 624.183 0 528.06Z
- // 415.815 528.066 0
-
- BOOST_CHECK(fabs(p.distance(p) - 0) < 0.0005);
- BOOST_CHECK(fabs(p.distance(q) - 624.183) < 0.0005);
- BOOST_CHECK(fabs(p.distance(r) - 415.815) < 0.0005);
- BOOST_CHECK(fabs(q.distance(p) - 624.183) < 0.0005);
- BOOST_CHECK(fabs(q.distance(q) - 0) < 0.0005);
- BOOST_CHECK(fabs(q.distance(r) - 528.066) < 0.0005);
- BOOST_CHECK(fabs(r.distance(p) - 415.815) < 0.0005);
- BOOST_CHECK(fabs(r.distance(q) - 528.066) < 0.0005);
- BOOST_CHECK(fabs(r.distance(r) - 0) < 0.0005);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.distance(p), 0., epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.distance(q), 624.183, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.distance(r), 415.815, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.distance(p), 624.183, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.distance(q), 0., epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.distance(r), 528.066, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.distance(p), 415.815, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.distance(q), 528.066, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.distance(r), 0., epsilon);
}
BOOST_AUTO_TEST_CASE(check_projections_to_R_for_heat_maps) {
@@ -169,13 +159,9 @@ BOOST_AUTO_TEST_CASE(check_projections_to_R_for_heat_maps) {
Persistence_heat_maps<constant_scaling_function> q("data/file_with_diagram_1", filter, false, 1000, 0, 1);
Persistence_heat_maps<constant_scaling_function> r("data/file_with_diagram_2", filter, false, 1000, 0, 1);
- // cerr << p.project_to_R(0) << endl;
- // cerr << q.project_to_R(0) << endl;
- // cerr << r.project_to_R(0) << endl;
-
- BOOST_CHECK(fabs(p.project_to_R(0) - 44.3308) < 0.0005);
- BOOST_CHECK(fabs(q.project_to_R(0) - 650.568) < 0.0005);
- BOOST_CHECK(fabs(r.project_to_R(0) - 429.287) < 0.0005);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.project_to_R(0), 44.3308, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.project_to_R(0), 650.568, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.project_to_R(0), 429.287, epsilon);
}
BOOST_AUTO_TEST_CASE(check_scalar_products_for_heat_maps) {
@@ -184,25 +170,15 @@ BOOST_AUTO_TEST_CASE(check_scalar_products_for_heat_maps) {
Persistence_heat_maps<constant_scaling_function> q("data/file_with_diagram_1", filter, false, 1000, 0, 1);
Persistence_heat_maps<constant_scaling_function> r("data/file_with_diagram_2", filter, false, 1000, 0, 1);
- // cerr << p.compute_scalar_product( p ) << endl;
- // cerr << p.compute_scalar_product( q ) << endl;
- // cerr << p.compute_scalar_product( r ) << endl;
- // cerr << q.compute_scalar_product( p ) << endl;
- // cerr << q.compute_scalar_product( q ) << endl;
- // cerr << q.compute_scalar_product( r ) << endl;
- // cerr << r.compute_scalar_product( p ) << endl;
- // cerr << r.compute_scalar_product( q ) << endl;
- // cerr << r.compute_scalar_product( r ) << endl;
-
- BOOST_CHECK(fabs(p.compute_scalar_product(p) - 0.0345687) < 0.0005);
- BOOST_CHECK(fabs(p.compute_scalar_product(q) - 0.0509357) < 0.0005);
- BOOST_CHECK(fabs(p.compute_scalar_product(r) - 0.0375608) < 0.0005);
- BOOST_CHECK(fabs(q.compute_scalar_product(p) - 0.0509357) < 0.0005);
- BOOST_CHECK(fabs(q.compute_scalar_product(q) - 1.31293) < 0.0005);
- BOOST_CHECK(fabs(q.compute_scalar_product(r) - 0.536799) < 0.0005);
- BOOST_CHECK(fabs(r.compute_scalar_product(p) - 0.0375608) < 0.0005);
- BOOST_CHECK(fabs(r.compute_scalar_product(q) - 0.536799) < 0.0005);
- BOOST_CHECK(fabs(r.compute_scalar_product(r) - 0.672907) < 0.0005);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_scalar_product(p), 0.0345687, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_scalar_product(q), 0.0509357, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(p.compute_scalar_product(r), 0.0375608, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(p), 0.0509357, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(q), 1.31293 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(q.compute_scalar_product(r), 0.536799 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(p), 0.0375608, epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(q), 0.536799 , epsilon);
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(r.compute_scalar_product(r), 0.672907 , epsilon);
}
BOOST_AUTO_TEST_CASE(check_arythmetic_operations_for_heat_maps) {
diff --git a/src/Rips_complex/test/test_rips_complex.cpp b/src/Rips_complex/test/test_rips_complex.cpp
index fc83f5f7..89afbc25 100644
--- a/src/Rips_complex/test/test_rips_complex.cpp
+++ b/src/Rips_complex/test/test_rips_complex.cpp
@@ -36,6 +36,7 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/distance_functions.h>
#include <gudhi/reader_utils.h>
+#include <gudhi/Unitary_tests_utils.h>
// Type definitions
using Point = std::vector<double>;
@@ -44,10 +45,6 @@ using Filtration_value = Simplex_tree::Filtration_value;
using Rips_complex = Gudhi::rips_complex::Rips_complex<Simplex_tree::Filtration_value>;
using Distance_matrix = std::vector<std::vector<Filtration_value>>;
-bool are_almost_the_same(float a, float b) {
- return std::fabs(a - b) < std::numeric_limits<float>::epsilon();
-}
-
BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) {
// ----------------------------------------------------------------------------
//
@@ -92,7 +89,7 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) {
std::cout << ") - distance =" << Gudhi::Euclidean_distance()(vp.at(0), vp.at(1)) <<
" - filtration =" << st.filtration(f_simplex) << std::endl;
BOOST_CHECK(vp.size() == 2);
- BOOST_CHECK(are_almost_the_same(st.filtration(f_simplex), Gudhi::Euclidean_distance()(vp.at(0), vp.at(1))));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), Gudhi::Euclidean_distance()(vp.at(0), vp.at(1)));
}
}
@@ -113,14 +110,14 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) {
Simplex_tree::Filtration_value f12 = st2.filtration(st2.find({1, 2}));
Simplex_tree::Filtration_value f012 = st2.filtration(st2.find({0, 1, 2}));
std::cout << "f012= " << f012 << " | f01= " << f01 << " - f02= " << f02 << " - f12= " << f12 << std::endl;
- BOOST_CHECK(are_almost_the_same(f012, std::max(f01, std::max(f02,f12))));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(f012, std::max(f01, std::max(f02,f12)));
Simplex_tree::Filtration_value f45 = st2.filtration(st2.find({4, 5}));
Simplex_tree::Filtration_value f56 = st2.filtration(st2.find({5, 6}));
Simplex_tree::Filtration_value f46 = st2.filtration(st2.find({4, 6}));
Simplex_tree::Filtration_value f456 = st2.filtration(st2.find({4, 5, 6}));
std::cout << "f456= " << f456 << " | f45= " << f45 << " - f56= " << f56 << " - f46= " << f46 << std::endl;
- BOOST_CHECK(are_almost_the_same(f456, std::max(f45, std::max(f56,f46))));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(f456, std::max(f45, std::max(f56,f46)));
const int DIMENSION_3 = 3;
Simplex_tree st3;
@@ -140,7 +137,7 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) {
Simplex_tree::Filtration_value f0123 = st3.filtration(st3.find({0, 1, 2, 3}));
std::cout << "f0123= " << f0123 << " | f012= " << f012 << " - f123= " << f123 << " - f013= " << f013 <<
" - f023= " << f023 << std::endl;
- BOOST_CHECK(are_almost_the_same(f0123, std::max(f012, std::max(f123, std::max(f013, f023)))));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(f0123, std::max(f012, std::max(f123, std::max(f013, f023))));
}
@@ -219,12 +216,12 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) {
std::cout << "dimension(" << st.dimension(f_simplex) << ") - f = " << st.filtration(f_simplex) << std::endl;
switch (st.dimension(f_simplex)) {
case 0:
- BOOST_CHECK(are_almost_the_same(st.filtration(f_simplex), 0.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), 0.0);
break;
case 1:
case 2:
case 3:
- BOOST_CHECK(are_almost_the_same(st.filtration(f_simplex), 2.0));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), 2.0);
break;
default:
BOOST_CHECK(false); // Shall not happen
@@ -276,7 +273,7 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) {
}
std::cout << ") - filtration =" << st.filtration(f_simplex) << std::endl;
BOOST_CHECK(vvh.size() == 2);
- BOOST_CHECK(are_almost_the_same(st.filtration(f_simplex), distances[vvh.at(0)][vvh.at(1)]));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), distances[vvh.at(0)][vvh.at(1)]);
}
}
@@ -297,14 +294,14 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) {
Simplex_tree::Filtration_value f12 = st2.filtration(st2.find({1, 2}));
Simplex_tree::Filtration_value f012 = st2.filtration(st2.find({0, 1, 2}));
std::cout << "f012= " << f012 << " | f01= " << f01 << " - f02= " << f02 << " - f12= " << f12 << std::endl;
- BOOST_CHECK(are_almost_the_same(f012, std::max(f01, std::max(f02,f12))));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(f012, std::max(f01, std::max(f02,f12)));
Simplex_tree::Filtration_value f45 = st2.filtration(st2.find({4, 5}));
Simplex_tree::Filtration_value f56 = st2.filtration(st2.find({5, 6}));
Simplex_tree::Filtration_value f46 = st2.filtration(st2.find({4, 6}));
Simplex_tree::Filtration_value f456 = st2.filtration(st2.find({4, 5, 6}));
std::cout << "f456= " << f456 << " | f45= " << f45 << " - f56= " << f56 << " - f46= " << f46 << std::endl;
- BOOST_CHECK(are_almost_the_same(f456, std::max(f45, std::max(f56,f46))));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(f456, std::max(f45, std::max(f56,f46)));
const int DIMENSION_3 = 3;
Simplex_tree st3;
@@ -324,7 +321,7 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) {
Simplex_tree::Filtration_value f0123 = st3.filtration(st3.find({0, 1, 2, 3}));
std::cout << "f0123= " << f0123 << " | f012= " << f012 << " - f123= " << f123 << " - f013= " << f013 <<
" - f023= " << f023 << std::endl;
- BOOST_CHECK(are_almost_the_same(f0123, std::max(f012, std::max(f123, std::max(f013, f023)))));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(f0123, std::max(f012, std::max(f123, std::max(f013, f023))));
}
diff --git a/src/cmake/modules/GUDHI_test_coverage.cmake b/src/cmake/modules/GUDHI_test_coverage.cmake
index ce171a0e..bea5b2d6 100644
--- a/src/cmake/modules/GUDHI_test_coverage.cmake
+++ b/src/cmake/modules/GUDHI_test_coverage.cmake
@@ -8,7 +8,19 @@ if (GPROF_PATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()
+if (DEBUG_TRACES)
+ # Make CTest more verbose with DEBUG_TRACES - no XML output
+ set(GUDHI_UT_LOG_LEVEL "--log_level=all")
+ set(GUDHI_UT_REPORT_LEVEL "--report_level=detailed")
+else()
+ set(GUDHI_UT_LOG_FORMAT "--log_format=XML")
+ set(GUDHI_UT_LOG_SINK "--log_sink=${CMAKE_BINARY_DIR}/${unitary_test}_UT.xml")
+ set(GUDHI_UT_LOG_LEVEL "--log_level=test_suite")
+ set(GUDHI_UT_REPORT_LEVEL "--report_level=no")
+endif()
+
function(gudhi_add_coverage_test unitary_test)
add_test(NAME ${unitary_test} COMMAND $<TARGET_FILE:${unitary_test}>
- "--log_format=XML" "--log_sink=${CMAKE_BINARY_DIR}/${unitary_test}_UT.xml" "--log_level=test_suite" "--report_level=no")
+ ${GUDHI_UT_LOG_FORMAT} ${GUDHI_UT_LOG_SINK}
+ ${GUDHI_UT_LOG_LEVEL} ${GUDHI_UT_REPORT_LEVEL})
endfunction()
diff --git a/src/common/include/gudhi/Debug_utils.h b/src/common/include/gudhi/Debug_utils.h
index 8ed3b7b3..f9d9c50c 100644
--- a/src/common/include/gudhi/Debug_utils.h
+++ b/src/common/include/gudhi/Debug_utils.h
@@ -4,7 +4,7 @@
*
* Author(s): David Salinas
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
+ * Copyright (C) 2014 INRIA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/include/gudhi/Unitary_tests_utils.h b/src/common/include/gudhi/Unitary_tests_utils.h
new file mode 100644
index 00000000..7ae5d356
--- /dev/null
+++ b/src/common/include/gudhi/Unitary_tests_utils.h
@@ -0,0 +1,39 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Vincent Rouvreau
+ *
+ * Copyright (C) 2017 INRIA
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef UNITARY_TESTS_UTILS_H_
+#define UNITARY_TESTS_UTILS_H_
+
+#include <boost/test/unit_test.hpp>
+
+#include <iostream>
+
+template<typename FloatingType >
+void GUDHI_TEST_FLOAT_EQUALITY_CHECK(FloatingType a, FloatingType b,
+ FloatingType epsilon = std::numeric_limits<FloatingType>::epsilon()) {
+#ifdef DEBUG_TRACES
+ std::cout << "GUDHI_TEST_FLOAT_EQUALITY_CHECK - " << a << " versus " << b
+ << " | diff = " << std::fabs(a - b) << " - epsilon = " << epsilon << std::endl;
+#endif
+ BOOST_CHECK(std::fabs(a - b) < epsilon);
+}
+
+#endif // UNITARY_TESTS_UTILS_H_