Testing: Add minimum/maximum support (#5192)

This commit is contained in:
Montel Laurent 2024-05-10 16:18:02 +02:00 committed by GitHub
parent 25ef8f8711
commit c37c9d4f26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 108 additions and 2 deletions

View file

@ -51,6 +51,9 @@ void assert_eq_impl(const A &a, const B &b, const char *a_str, const char *b_str
// Do a cast to the common type to avoid warning about signed vs. unsigned compare
using T = std::common_type_t<A, B>;
nok = T(a) != T(b);
} else if constexpr (std::is_floating_point_v<A> && std::is_floating_point_v<B>) {
const double dEpsilon = 0.000001; // or some other small number
nok = fabs(a - b) > dEpsilon * fabs(a);
} else {
nok = a != b;
}