// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
#ifndef BOOST_MATH_TEST_TEST_HPP
#define BOOST_MATH_TEST_TEST_HPP
#include <atomic>
#include <boost/math/special_functions/next.hpp>
#include <boost/core/demangle.hpp>
-
namespace boost { namespace math { namespace test {
namespace detail {
}
using std::max;
using std::abs;
- Real denom = max(abs(expected), Real(1));
+ Real denom = (max)(abs(expected), Real(1));
Real mollified_relative_error = abs(expected - computed)/denom;
if (mollified_relative_error > tol)
{
using std::max;
using std::abs;
using std::isnan;
- BOOST_ASSERT_MSG(sizeof(PreciseReal) >= sizeof(Real),
- "The expected number must be computed in higher (or equal) precision than the number being tested.");
+ // Of course integers can be expected values, and they are exact:
+ if (!std::is_integral<PreciseReal>::value) {
+ BOOST_ASSERT_MSG(sizeof(PreciseReal) >= sizeof(Real),
+ "The expected number must be computed in higher (or equal) precision than the number being tested.");
+ BOOST_ASSERT_MSG(!isnan(expected1), "Expected value cannot be a nan.");
+ }
- BOOST_ASSERT_MSG(!isnan(expected1), "Expected value cannot be a nan.");
if (isnan(computed))
{
std::ios_base::fmtflags f( std::cerr.flags() );
if (dist > ulps)
{
detail::total_ulp_distance += static_cast<int64_t>(dist);
- Real denom = max(abs(expected), Real(1));
+ Real denom = (max)(abs(expected), Real(1));
Real mollified_relative_error = abs(expected - computed)/denom;
std::ios_base::fmtflags f( std::cerr.flags() );
std::cerr << std::setprecision(3);
{
std::cerr << "\033[0;31mError count: " << detail::global_error_count;
if (detail::total_ulp_distance > 0) {
- std::cerr << ", total ulp distance = " << detail::total_ulp_distance << "\n";
+ std::cerr << ", total ulp distance = " << detail::total_ulp_distance << "\n\033[0m";
}
else {
// else we overflowed the ULPs counter and all we could print is a bizarre negative number.
- std::cerr << "\n";
+ std::cerr << "\n\033[0m";
}
detail::global_error_count = 0;
detail::total_ulp_distance = 0;
return 1;
}
- std::cout << "\x1B[32mNo errors detected.\n";
+ std::cout << "\x1B[32mNo errors detected.\n\033[0m";
return 0;
}