mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 21:03:00 +00:00
Testing: Add minimum/maximum support (#5192)
This commit is contained in:
parent
25ef8f8711
commit
c37c9d4f26
5 changed files with 108 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue