Unitary_tests_utils.h
1 /* This file is part of the Gudhi Library. The Gudhi library
2  * (Geometric Understanding in Higher Dimensions) is a generic C++
3  * library for computational topology.
4  *
5  * Author(s): Vincent Rouvreau
6  *
7  * Copyright (C) 2017 Inria
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 #ifndef UNITARY_TESTS_UTILS_H_
23 #define UNITARY_TESTS_UTILS_H_
24 
25 #include <boost/test/unit_test.hpp>
26 
27 #include <iostream>
28 #include <limits> // for std::numeric_limits<>
29 
30 template<typename FloatingType >
31 void GUDHI_TEST_FLOAT_EQUALITY_CHECK(FloatingType a, FloatingType b,
32  FloatingType epsilon = std::numeric_limits<FloatingType>::epsilon()) {
33 #ifdef DEBUG_TRACES
34  std::cout << "GUDHI_TEST_FLOAT_EQUALITY_CHECK - " << a << " versus " << b
35  << " | diff = " << std::fabs(a - b) << " - epsilon = " << epsilon << std::endl;
36 #endif
37  BOOST_CHECK(std::fabs(a - b) < epsilon);
38 }
39 
40 #endif // UNITARY_TESTS_UTILS_H_
GUDHI  Version 2.2.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : GPL v3 Generated on Fri Jun 22 2018 08:12:19 for GUDHI by Doxygen 1.8.13