[PATCH 4/7] litest: float comparision
Peter Hutterer
peter.hutterer at who-t.net
Wed Jun 10 23:05:40 PDT 2015
Drop one "i" from the subject :)
On Wed, Jun 10, 2015 at 04:09:14PM +0200, Andreas Pokorny wrote:
> ---
> test/litest.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/test/litest.h b/test/litest.h
> index 3a08b6a..0d39dd3 100644
> --- a/test/litest.h
> +++ b/test/litest.h
> @@ -428,4 +428,11 @@ void litest_semi_mt_touch_up(struct litest_device *d,
> #define ck_assert_notnull(ptr) ck_assert_ptr_ne(ptr, NULL)
> #endif
>
> +#define litest_assert_double_eq(X,Y) do { \
> + double _litest_x = (X); \
> + double _litest_y = (Y); \
fwiw, you don't need () here, there's no danger of wrong expansion.
otherwise please use the same naming convention that all the other helpers
have.
> + ck_assert_msg(fabs(_litest_x - _litest_y) < 1E-5, "Assertion '" #X " == " #Y "' failed: "#X"==%f, "#Y"==%f", _litest_x, _litest_y); \
> +} while (0)
> +
nope, that's not right. the litest_assert_ macros have a specific behaviour
(see 84e6321f515f0683), using ck_assert_msg will make it inconsistent.
#define this as ck_assert_double and we'll deal with conflicts if check ever
adds the equivalent. and for good measure, add ge, gt, le, lt and ne as
well.
Cheers,
Peter
> +
> #endif /* LITEST_H */
> --
> 2.1.4
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list