blob: 5ab20af804a07abc72f74f9b7f42540d12af25c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* 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
*
* Modification(s):
* - YYYY/MM Author: Description of the modification
*/
#ifndef UNITARY_TESTS_UTILS_H_
#define UNITARY_TESTS_UTILS_H_
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <limits> // for std::numeric_limits<>
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_
|