7#include "polynomial.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
10#include <gtest/gtest.h>
16template<
typename T,
typename U,
int N>
19 if (lhs.size() != rhs.size()) {
23 double max_diff = 0.0;
24 assert(lhs.size() <= lhs.capacity());
25 for (
auto i = 0_uz; i != lhs.size(); ++i) {
28 for (
auto j = 0_uz; j != rhs.size(); ++j) {
29 hi::inplace_min(min_diff, std::abs(lhs[i] - rhs[j]));
32 hi::inplace_max(max_diff, min_diff);
37template<
typename T,
typename U,
int N>
38testing::AssertionResult ResultsNearPredFormat(
41 const char *abs_error_expr,
46 hilet diff = maxAbsDiff(val1, val2);
47 if (diff <= abs_error)
48 return testing::AssertionSuccess();
50 return testing::AssertionFailure() <<
"The difference between " << expr1 <<
" and " << expr2 <<
" is " << diff
51 <<
", which exceeds " << abs_error_expr <<
", where\n"
52 << expr1 <<
" evaluates to " << val1 <<
",\n"
53 << expr2 <<
" evaluates to " << val2 <<
", and\n"
54 << abs_error_expr <<
" evaluates to " << abs_error <<
".";
57#define ASSERT_RESULTS_NEAR(val1, val2, abs_error) ASSERT_PRED_FORMAT3(ResultsNearPredFormat, val1, val2, abs_error)
59#define ASSERT_RESULTS(val1, val2) ASSERT_RESULTS_NEAR(val1, val2, 0.000001)
DOXYGEN BUG.
Definition algorithm.hpp:16
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377