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

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 24 14:36:12 PST 2015


On Tue, Feb 24, 2015 at 11:20:49AM -0500, Benjamin Tissoires wrote:
> 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.

yikes, of course. fixed locally, thanks.

Cheers,
   Peter

 
> >
> >  #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
> >


More information about the wayland-devel mailing list