[PATCH libinput 03/26] test: fix double comparison macros

Benjamin Tissoires benjamin.tissoires at gmail.com
Tue Feb 24 08:20:49 PST 2015


On Tue, Feb 24, 2015 at 1:21 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> args needs to be within () to ensure correct calculation
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  test/litest.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/test/litest.h b/test/litest.h
> index 4553c87..dd1ad9a 100644
> --- a/test/litest.h
> +++ b/test/litest.h
> @@ -195,22 +195,22 @@ struct libevdev_uinput * litest_create_uinput_abs_device(const char *name,
>                                                          const struct input_absinfo *abs,
>                                                          ...);
>  #define litest_assert_double_eq(a_, b_)\
> -       ck_assert_int_eq((int)(a_ * 256), (int)(b_ * 256))
> +       ck_assert_int_eq((int)(a_ * 256), (int)((b_) * 256))

Why only b_ is within (), not a_?
I would have assume we should fix both args.

Cheers,
Benjamin

>
>  #define litest_assert_double_ne(a_, b_)\
> -       ck_assert_int_ne((int)(a_ * 256), (int)(b_ * 256))
> +       ck_assert_int_ne((int)(a_ * 256), (int)((b_) * 256))
>
>  #define litest_assert_double_lt(a_, b_)\
> -       ck_assert_int_lt((int)(a_ * 256), (int)(b_ * 256))
> +       ck_assert_int_lt((int)(a_ * 256), (int)((b_) * 256))
>
>  #define litest_assert_double_le(a_, b_)\
> -       ck_assert_int_le((int)(a_ * 256), (int)(b_ * 256))
> +       ck_assert_int_le((int)(a_ * 256), (int)((b_) * 256))
>
>  #define litest_assert_double_gt(a_, b_)\
> -       ck_assert_int_gt((int)(a_ * 256), (int)(b_ * 256))
> +       ck_assert_int_gt((int)(a_ * 256), (int)((b_) * 256))
>
>  #define litest_assert_double_ge(a_, b_)\
> -       ck_assert_int_ge((int)(a_ * 256), (int)(b_ * 256))
> +       ck_assert_int_ge((int)(a_ * 256), (int)((b_) * 256))
>
>  void litest_timeout_tap(void);
>  void litest_timeout_softbuttons(void);
> --
> 2.1.0
>
> _______________________________________________
> 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