Unitary_tests_utils.h
1 /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2  * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3  * Author(s): Vincent Rouvreau
4  *
5  * Copyright (C) 2017 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 #ifndef UNITARY_TESTS_UTILS_H_
11 #define UNITARY_TESTS_UTILS_H_
12 
13 #include <boost/test/unit_test.hpp>
14 
15 #include <iostream>
16 #include <limits> // for std::numeric_limits<>
17 
18 template<typename FloatingType >
19 void GUDHI_TEST_FLOAT_EQUALITY_CHECK(FloatingType a, FloatingType b,
20  FloatingType epsilon = std::numeric_limits<FloatingType>::epsilon()) {
21 #ifdef DEBUG_TRACES
22  std::cout << "GUDHI_TEST_FLOAT_EQUALITY_CHECK - " << a << " versus " << b
23  << " | diff = " << std::fabs(a - b) << " - epsilon = " << epsilon << std::endl;
24 #endif
25  BOOST_CHECK(std::fabs(a - b) <= epsilon);
26 }
27 
28 #endif // UNITARY_TESTS_UTILS_H_
GUDHI  Version 3.0.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Tue Dec 10 2019 13:33:51 for GUDHI by Doxygen 1.8.13